HP Forums
ifactor(Ans) does not work - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: ifactor(Ans) does not work (/thread-4481.html)



ifactor(Ans) does not work - retoa - 08-05-2015 12:59 PM

Hello !

I try to do a factorisation on the result of a previous calculation.
Example: I calculate 78*9 and then try to factorise the result with ifactor.
I receive an error message:
"ifactor(Ans) Error: Bad Argument Value"

See attachment.

Same error both on emulator and real Prime.

Does anyone else have the same problem?
Thank you for the help

Reto


RE: ifactor(Ans) does not work - Arno K - 08-05-2015 01:21 PM

Hm, first I thought: that is a cas-command, I tried in cas-mode and your example worked, I tried in Home, chose Ifactor from the Menu, that provided: CAS.ifactor(Ans) and it worked, too, the last try was, in Home, ifactor from the catalog, it also worked. Perhaps you haven't updated to the latest version.
Arno


RE: ifactor(Ans) does not work - retoa - 08-05-2015 01:28 PM

Hello Arno

I have SW Ver: 2015 6 17 (8151)
HW Ver: C

You are right about CAS, in CAS mode it works.
The problem seems to be only in Home, but ifactor(702) works fine also in Home.

Reto


RE: ifactor(Ans) does not work - Didier Lachieze - 08-05-2015 01:59 PM

This comes from the fact that there are two different Ans: one for Home and one for CAS, and CAS functions use the CAS Ans even when called in Home.
More details here.


RE: ifactor(Ans) does not work - Marcelo Vanti - 08-05-2015 02:15 PM

Hello!
Yes, if I do CAS.ifactor(Ans) the answer I get is 1! Otherwise, CAS.ifactor(702) gives 2*3^3*13. Same in RPN mode.


RE: ifactor(Ans) does not work - DrD - 08-05-2015 02:54 PM

If you put 78*9 [Enter] in the CAS command line first, then switch back to HOME you can see the CAS Ans is used:

[CAS] 78*9 ==> 702
[HOME] ifactor(Ans)) ==> 2*3^3*3


RE: ifactor(Ans) does not work - retoa - 08-05-2015 03:08 PM

Thank you very much to all,

I did not think about the 2 different Ans (Home and Cas).
So as I tried I probably had a value in the Cas Ans that could not be passed to the ifactor function and that caused the error.

I find this a bit confusing. If I calculate 3*5 in Cas then go back to home calculate 3*7 and then I do ifactor(Ans) I find 3*5. This is the right answer because it is the factorisation of 15, the last Cas result, and not of 21, the last Home result.

Quite odd... I can understand that this is right, but if you don't notice you are using a Cas function in home (if you take it from catalog you don't see the CAS.-) you go up with an answer that is not the one you are looking for...

Reto


RE: ifactor(Ans) does not work - Gerald H - 08-05-2015 04:02 PM

A very instructive thread.

The lesson I learn: Don't use the Prime to do a calculation, it's just too complicated.


RE: ifactor(Ans) does not work - Marcelo Vanti - 08-05-2015 04:07 PM

I think the easier way to get round it is using RPN, i.e,
78 9 * Enter
CAS.ifactor (1) ==> 2*3^3*13


RE: ifactor(Ans) does not work - retoa - 08-05-2015 06:12 PM

(08-05-2015 04:07 PM)Marcelo Vanti Wrote:  I think the easier way to get round it is using RPN, i.e,
78 9 * Enter
CAS.ifactor (1) ==> 2*3^3*13

Yes it works, but the RPN of the Prime is not really a "true RPN". In RPN you would not need to specify the (1) as an argument.
You can obtain the same result in Textbook mode using "up arrow" Enter, so you copy the last result as argument for the ifactor() function.

Reto