HP Prime Forum
POLYROOT does not always work inside a program - Printable Version

+- HP Prime Forum (http://forum.hp-prime.de)
+-- Forum: HP Prime (/forumdisplay.php?fid=1)
+--- Forum: Questions to HP (/forumdisplay.php?fid=3)
+--- Thread: POLYROOT does not always work inside a program (/showthread.php?tid=48)



POLYROOT does not always work inside a program - JMB - 04-01-2016 07:05 PM

I have found a strange behavior (a bug?) while using the function POLYROOT inside a program. My firmware version is 2015 6 17 (8151).

The calculator's built-in help states that the argument of this function can be either a symbolic expression or a vector of coefficients, but I have found that a list of coefficients also works as the function's argument. So both POLYROOT([1 -3 2]) and POLYROOT({1, -3, 2}) return the same answer: {1, 2}, in Home and in CAS.

The problem arises when I use this function inside a program, for example:
EXPORT Test()
BEGIN
POLYROOT([1, -3, 2]);
END;

The first thing worth noting in that commas are needed inside [ ], otherwise you get a syntax error when you tap the Check button. Then when you run the program you get the following error message:

Test
"POLYROOT(ListToMat(EVAL
LIST({0,1,3,1-3,2})))
Error: Bad Argument
Value)"

After trying different numeric values, I have found that this error only happens inside a program, when using [ ] and at least one value is negative. So we have, for example:

POLYROOT({1, 3, 2}): correct answer {-2, -1}
POLYROOT([1, 3, 2]): correct answer {-2, -1}
POLYROOT({1, -3, 2}): correct answer {1, 2}
POLYROOT([1, -3, 2]): error, as stated before


RE: POLYROOT does not always work inside a program - JMB - 30-04-2016 11:56 AM

Corrected in firmware 10077.

Thanks to the HP Prime Team!


RE: POLYROOT does not always work inside a program - Klaas Kuperus - 02-05-2016 04:34 PM

Thanks for the update!