kg583,

The idea that the full form If-Then-Else-EndIf can behave differently is interesting. I have checked it, but with the same negative result.

I think that this is not "If" issue, but rather how nInt() uses the provided function. I have modified the test case. This time I want to integrate numerically function w=w(x) say from 0 to 1, where w and x are related as w*exp(w)=x, so I cannot write the analytical expression w=w(x), but have to solve the non-linear equation numerically. Now my function looks even simpler

```
Define LibPub productlog(x)=
Func
:Return nSolve(w*e^(w)=x,w=0)
:EndFunc
```

There is no If statement at all. Again, by itself, function works fine and returns correct results, but when I try to calcuclate its integral numerically, I get "Argument error"

```
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."

The error is different.

Let's go back to function test() with "If" statement. The description of the error is the following.

"20 A test did not resolve to TRUE or FALSE

This error usually occurs when comparing an undefined variable, in a statement such as If."

In reply to Trenly (see above) I already suggested that it is possible, that nInt() tries to take integral analytically first. In this case the integrand will be called with the undefined argument and "If" statement will trigger this error. To support this idea, I inserted command Disp x in test(x) function right before the If x<1 statement, so the function prints its argument each time it is called. I get the following result:

```
nInt(test(x),x,0,5)
x
"Error: A test did not resolve to TRUE or FALSE"
```

So, the function IS called with the undefined argument (just "x" not a number). This is actual source of the error.

And the last nail into the lid of my TI-nspire CX CAS. I borrowed TI Voyage 200 and performed both tests with test(x) and productlog(x) functions. Voyage 200 calculated both integrals without problems and results coincide with what I get from Mathematica on PC.

Now I can confirm, that this issue is *not 68k BASIC issue*, but specific for TI-nspire CX CAS (I did not test non-CAS version). If we want to use user defined function in nInt(), the user defined function MUST be written in such a way, that it can be called with the undefined argument. This, mostly, means that the user defined function must be *explicit* function. By the way, this problem arises not only when using nInt() but also nSolve() function.

If I new these undocumented programming limitations in advance, I would never buy this fast nice looking and expensive calculator.