Saturday, January 27, 2024

HP Prime - Restart and Some CAS Command Comparisons

HP Prime - Restart and Some CAS Command Comparisons


restart - A Rescue in CAS Mode

I learned about this command in a recent HPCC virtual meeting about the command restart.   One of the participants had trouble storing equations in variables.   After changing settings and trying other formats, the restart command was introduced and it solved the problem.  

What the restart command does is purge all the variables in CAS variables and reset all CAS settings.    The restart command can be typed or found in the Catalog.
The command does not require arguments.

When the restart command, the screen will show:

============== restarted ==============

Pressing enter will show a list of the CAS variables in a list.  



Some CAS Command Comparisons


ifactor vs. ifactors

ifactor gives the prime factorization of integers.

ifactors returns a list of prime factors with the associated multiplicity in a list in the format:    
[ factor1, multiplicity1, factor2, multiplicity2, ... ]


Examples:


ifactor(480) returns 2^5 * 3 * 5

ifactors(480) returns [2, 5, 3, 1, 5, 1]


ifactor(507) returns 3 * 13^2

ifactors(507) returns [3, 1, 13, 2]


normal vs. regroup

Both the normal and regroup commands can be found in the catalog or can be typed.  According to the help facility:

normal simplifies an expression to an irreducible form.

regroup simplifies and collects terms in an expression, to match the Minimum simplification setting.  


Examples:


normal(a*(b+a-b^2)) returns a^2-a*b^2+a*b

regroup(a*(b+a-b^2)) returns a*(-b^2+a*b)


normal(x+5*x+6*(x^2-3*x)) returns 6*x^2-12*x

regroup(x+5*x+6*(x^2-3*x)) returns 6*(x^2-3*x)+6*x


normal(x^2*√2-(x^3-1)/(x+1)) returns ((√2-1)*x^3+2*√2*x^2+1)/(x+2)

regroup(x^2*√2-(x^3-1)/(x+1)) returns √2*x^2-(x^3-1)/(x+2)


normal((x+3)^5) returns x^5+15*x^4+90*x^3+270*x^2+405*x+243

regroup((x+3)^5) just returns (x+3)^5


iquo vs irem vs. iquorem

The three commands iquo, irem, and iquorem are commands in Euclidean Division.

iquo(x,y) returns the quotient of x/y

irem(x,y)  returns the remainder of x/y

iquorem(x,y)  returns the quotient and remainder of x/y in a list.

The arguments x and y must be positive integers.  


Examples:


iquo(258,19) returns 13

irem(258,19) returns 11

iquorem(258,19) returns [13, 11]

258 = 13 * 19 + 11



I really need to work with the CAS engine of the HP Prime more often,

Eddie

All original content copyright, © 2011-2024.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 

Fun with the HP 30b

Fun with the HP 30 b Introduction The following programs are for the HP 30b Business Professional. Did you know that the 30b...