Author Topic: Ti-Nspire programming question  (Read 3216 times)

0 Members and 1 Guest are viewing this topic.

Offline 98devin

  • LV0 Newcomer (Next: 5)
  • Posts: 1
  • Rating: +0/-0
    • View Profile
Ti-Nspire programming question
« on: May 01, 2015, 05:03:35 pm »
Hi, I'm completely new to this forum, and generally also to programming in Ti-basic. I have the Ti-nspire CX CAS, and have been programming interesting functions and such into it for fun using the built in programming environment. As such, this isn't a serious problem, but just a question of whether something is possible to do, for the sake of curiosity really. I might move on to using lua or even C later (if I can get ndless) but as for now this is my dilemma:

Is it possible to create a function f(a,b) such that a is an expression in terms of x, and b is the input? For example, the following outputs would be expected:

f(x2,3) = 9
f(2x,6) = 12
f(x+2,0) = 2
etc.

I've tried to make something like this, (not for use on its own, but for use as one aspect of a more complex program) but keep encountering strange problems. Storing the expression into a variable or internal function hasn't worked, but I might be going about it incorrectly. It seems like using the standard ti-basic on the nspire is unpopular because of the very limited set of things it can do, but if anyone knows or cares enough about it to enlighten me, it'd be appreciated. Thanks!

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: Ti-Nspire programming question
« Reply #1 on: May 01, 2015, 05:07:38 pm »
Well, the TI-Nspire math engine will try to evaluate that expression for you. What might be easier is to let the first input be a string and have for example:

f("2x", 6)

Then store the second param in x and use 'expr' to evaluate the first parameter.