Author Topic: Nspire basic- displaying equation rather than var  (Read 2528 times)

0 Members and 1 Guest are viewing this topic.

Offline ase1590

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 8
  • Rating: +0/-0
    • View Profile
Nspire basic- displaying equation rather than var
« 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
« Last Edit: March 08, 2011, 10:08:14 pm by ase1590 »

Offline fb39ca4

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1749
  • Rating: +60/-3
    • View Profile
Re: Nspire basic- displaying equation rather than var
« Reply #1 on: March 11, 2011, 09:32:28 pm »
Could you convert the expression to a string and output that?

Offline northern_snow

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 132
  • Rating: +17/-1
    • View Profile
Re: Nspire basic- displaying equation rather than var
« Reply #2 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...
« Last Edit: April 08, 2011, 10:14:50 pm by northern_snow »