Possible bug with sqrt function in the HP prime



#8

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)

BEGIN

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

RETURN x,X;

END;


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


#9

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


#10

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


#11

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)

TW

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


#12

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.


#13

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

TW


#14

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.


Possibly Related Threads...
Thread Author Replies Views Last Post
  HP50g: Writing a function that returns a function Chris de Castro 2 208 12-10-2013, 06:49 PM
Last Post: Han
  Sending little images to the Prime (...and Program name bug?) Erwin Ried 19 507 12-10-2013, 05:35 PM
Last Post: Erwin Ried
  [HP Prime] Plots containing complex numbers bug? Chris Pem10 7 337 12-05-2013, 07:40 AM
Last Post: cyrille de Brébisson
  [HP Prime] plotfunc() bug in CAS Chris Pem10 2 181 12-04-2013, 02:46 PM
Last Post: Chris Pem10
  HP Prime Spreadsheet Copy bug Michael de Estrada 1 183 12-03-2013, 11:34 PM
Last Post: Walter B
  IFERR function on HP Prime Mic 2 187 12-02-2013, 01:33 AM
Last Post: cyrille de Brébisson
  HP Prime Matrix TERRIBLE bug and question uklo 19 662 11-25-2013, 12:10 PM
Last Post: Mic
  HP Prime graphing bug BruceH 1 137 11-19-2013, 08:14 AM
Last Post: Joe Horn
  HP Prime: Dirichlet's eta function recognized but not numerically evaluated Helge Gabert 0 117 11-16-2013, 03:41 PM
Last Post: Helge Gabert
  [Prime] Shutdown timer bug? Cristian Arezzini 2 139 11-16-2013, 10:34 AM
Last Post: Cristian Arezzini

Forum Jump: