Omnimaga

Calculator Community => TI Calculators => TI-BASIC => Topic started by: ase1590 on March 08, 2011, 10:07:35 pm

Title: Nspire basic- displaying equation rather than var
Post by: ase1590 on March 08, 2011, 10:07:35 pm
I am still learning the basics of scripting on my Nspire CAS calculator, and am having a problem getting my simple script to work properly

Code: [Select]
  1.
      Define evenodd(eq,var)=
   2.
      Prgm
   3.
      :Local even
   4.
      :©attempting even(-x)=4x+1 should give -4x+1
   5.
      :©I want to display an equation, not the variable "eq"
   6.
      :  even(var):=eq
   7.
      :Disp even(-var)
   8.
      :EndPrgm
after running evenodd() i do not get the expected result.
instead of evenodd(x2+x+1, x) returning x2-x+1 i get the variable eq returned to me.
Basically I am trying to use a function like f1(x)=x+2 in a program, only i want to be able to do it in a manner of f(x)=equation
Title: Re: Nspire basic- displaying equation rather than var
Post by: fb39ca4 on March 11, 2011, 09:32:28 pm
Could you convert the expression to a string and output that?
Title: Re: Nspire basic- displaying equation rather than var
Post by: northern_snow on April 07, 2011, 10:40:30 am
I am still learning the basics of scripting on my Nspire CAS calculator, and am having a problem getting my simple script to work properly

Code: [Select]
   1.
      Define evenodd(eq,var)=
   2.
      Prgm
   3.
      :Local even
   4.
      :©attempting even(-x)=4x+1 should give -4x+1
   5.
      :©I want to display an equation, not the variable "eq"
   6.
      :  even(var):=eq
   7.
      :Disp even(-var)
   8.
      :EndPrgm
after running evenodd() i do not get the expected result.
instead of evenodd(x2+x+1, x) returning x2-x+1 i get the variable eq returned to me.
Basically I am trying to use a function like f1(x)=x+2 in a program, only i want to be able to do it in a manner of f(x)=equation


Not really clear...
I have another idea
Code: [Select]
Define program(input,var)=
Prgm
input|var=a->eq
disp eq|a=-var
delvar eq
EndPrgm
And...You can use f(x)=eq then f(-x) to output... That's really easier...