Hello.
Recently I bought TI-nspire CX CAS calculator and during programming I observed unexpected behavior. Namely, I wanted to calculate integral numerically from the following test(x) function say from 0 to 5.
Code:
I got an error
Code:
Then, I realized that this is not a problem with If statement, but much wider problem. For example, I want to integrate function w(x) where w and x are related by equation w*exp(w)=x. So, I cannot write explicit expression w=w(x), but rather have to solve this equation numerically. So, my function is
Code:
Attempt to integrate it numerically causes the error:
Code:
"The first argument of nSolve must be an equation in a single variable. It cannot contain a non-valued variable other than the variable of interest."
Here we do not have If statement at all and the error is different. Looks like that nInt() tries to calculate the integral analytically first and calls the integrand with the undefined argument which triggers those errors.
By the way, I tried to integrate the same two functions numerically on Voyage 200 and it computed them without any problems.
Q.
Is this a bug in TI-nspire BASIC or intentional limitation (the feature)?
Thank you.
Recently I bought TI-nspire CX CAS calculator and during programming I observed unexpected behavior. Namely, I wanted to calculate integral numerically from the following test(x) function say from 0 to 5.
Code:
Define LibPub test(x)=
Func
:If x<1
:Return x
:Return (x-1)^(2)+1
:EndFunc
I got an error
Code:
nInt(test(x),x,0,5)
"Error: A test did not resolve to TRUE or FALSE"
Then, I realized that this is not a problem with If statement, but much wider problem. For example, I want to integrate function w(x) where w and x are related by equation w*exp(w)=x. So, I cannot write explicit expression w=w(x), but rather have to solve this equation numerically. So, my function is
Code:
Define LibPub productlog(x)=
Func
:Return nSolve(w*exp(w)=x,w=0)
:EndFunc
Attempt to integrate it numerically causes the error:
Code:
nInt(productlog(x),x,0,1)
"Error: Argument Error"
"The first argument of nSolve must be an equation in a single variable. It cannot contain a non-valued variable other than the variable of interest."
Here we do not have If statement at all and the error is different. Looks like that nInt() tries to calculate the integral analytically first and calls the integrand with the undefined argument which triggers those errors.
By the way, I tried to integrate the same two functions numerically on Voyage 200 and it computed them without any problems.
Q.
Is this a bug in TI-nspire BASIC or intentional limitation (the feature)?
Thank you.