Omnimaga
Calculator Community => TI Calculators => TI-BASIC => Topic started by: kyllopardiun on October 22, 2010, 04:54:17 pm
-
I kind like nsolve [as solve isn't in my calc ;D]
but it don't show all solutions, so I tried to do this:
Define LibPub nsolver(eq,x)=
Prgm
:Local a,b,c
:a:=−100
:b:=nSolve(eq,x=−100)
:Disp "Solutions: "
:Disp b
:While a≤100
: a:=a+1
: c:=nSolve(eq,x=a)
: If b≠c Then
: Disp c
: b:=c
: EndIf
:EndWhile
:EndPrgm
It actually does work, but not as wished I typed this:
nsolver((x^(2)+4*x-2)*(x+9)*x=0,x)
I got this as output:
Solutions:
−9.
−4.44949
−4.44949
0.
0.44949
0.44949
Look at the code, how can the same output be displayed twice?
-
Well, the way I understand it, nsolve( gives a very crude approximation of the solution. It is very likely that the repeated solutions are not equal out to the 12th decimal place.
Try:
Define LibPub nsolver(eq,x)=
Prgm
:Local a,b,c
:a:=−100
:b:=nSolve(eq,x=−100)
:Disp "Solutions: "
:Disp b
:While a≤100
: a:=a+1
: c:=nSolve(eq,x=a)
: If round(b,5)≠round(c,5) Then
: Disp c
: b:=c
: EndIf
:EndWhile
:EndPrgm
-
Thanks Apcalc, it worked =D
-
BTW, what means :=?
-
It is similar to the "->" key of the TI-84/89 calcs, only the syntax is opposite. Instead of "5->x", you would type "x:=5".
The Nspire has the store command too, so I have no idea why they have this also.
-
BTW, what means :=?
When you define a variable it is done like:
a:="conteudo"
because it has to have some difference between = (logical operator)
and := (define operator)
it does happens in almost every programing language
-
The nspire still has the -> character, too.
-
a:="conteudo" is the same as "conteudo"→a
-
Isn't there also a =: command? I've only used the normal →, though (I'm too used to 83 syntax ;D).
-
Isn't there also a =: command? I've only used the normal →, though (I'm too used to 83 syntax ;D).
Actually if you type a =:
it will be replaced to →
but, you can program with =: without a problem [it just won't remain after salved]