Omnimaga

Calculator Community => TI Calculators => TI-BASIC => Topic started by: 98devin on May 01, 2015, 05:03:35 pm

Title: Ti-Nspire programming question
Post by: 98devin 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!
Title: Re: Ti-Nspire programming question
Post by: Jim Bauwens 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.