HP Forums

Full Version: Possible bug with sqrt function in the HP prime
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

I say "possible" bug in the title, because this may just be another case of me not understanding the subtleties of this calculator. I have found that if I pass a dummy variable x to a program and use it with sqrt(x), then I get a program halt with Error: wrong argument type. However, if I express it as v X, v(x), x^.5 or (x)^.5, where v is the square root symbol, then it works fine. I have no problems using other built-in functions such as SIN(x). I do not declare the variable as LOCAL in the program, as this causes it to evaluate to zero, regardless of the value passed to the program.

EXPORT Test(x)


X:=sqrt(x); //this fails with wrong argument type

X:=v x; //this works fine

X:=x^.5; //this also works fine

X:=SIN(x); //this also works fine



Edited: 15 Nov 2013, 11:59 a.m. after one or more responses were posted

Square root symbol? Or the word spelled out "sqrt"?

The square root symbol as inserted by the shift x^2 key and the expression sqrt() as inserted from the catalog.

Ah. You are storing into real variable X. If you just return your sqrt(x), what do you see? (sqrt is a CAS command btw)


Edited: 15 Nov 2013, 12:03 p.m.

Yeah, it works now. I guess I should have realized that it was a CAS command, since it is lower case letters.

I also see that X:=CAS.sqrt(x) works

or CAS("X:=sqrt(x)")

Edited: 15 Nov 2013, 12:30 p.m.

As would EVAL(sqrt(x)) I suspect. The issue is trying to store a symbolic into a real only variable.


What I find very confusing is that if I'm in CAS and select and enter sqrt from the catalog it displays as sqrt() on the command line, but once I enter it as sqrt(x), it becomes v x. If I do the same with sqrt(X) in Home it becomes sqrt(X) on the input side of the history.

Edited: 15 Nov 2013, 12:49 p.m.