HP Prime - CAS solve()

Introduction, Help

The CAS / solve() function is useful for solving equations involving symbolic and/or numerical coefficients in its terms.  Normally, this is used in the CAS view, but can also be used in the Home view.  

The HP Prime provides useful information about the solve() function and examples you can test yourself.  Pressing the Help key when solve() highlighted, or searching Help Tree provides this:

The examples that follow show the usefulness and flexibility of the solve() function.

Alpha and Shift:  In these examples an orange highlighted key indicates Alpha key pressed first.  For example, a means Alpha then a keys pressed.  Similarly,  = means Shift then = keys pressed.

Example 1:  Solve the polynomial equation ax2 + bx + c = 0 for x


Display, comments

CAS   Toolbox

CAS  3Solve  1Solve[1]

a × x x2 + b × x + c  = 0 , x


 simplif    Enter

Open Toolbox and select Solve

Enter equation and variable to solve for (x).

Used  simplif   to simplify the equation as shown.[2] 

Answer:  the quadratic equation shown


Example 2:  Find the solution(s) to the equation x3 - 5x2 -2x +24 = 0


Display, comments

CAS Toolbox 

CAS  3Solve  1Solve

xtΘn xy  3 [3] - 5 xtΘn x2 

-  2 xtΘn + 24


Move to CAS view, open the Toolbox and select Solve

Enter the equation to solve.  Note that the = sign and , x are optional.


Answer:  -2, 3 and 4 are solutions

Note that .zeros(), csolve(), cZeros() and proot() give similar solutions.

The same example worked using solve in the Home view

Home Toolbox 

CAS  3Solve  1Solve

xtΘn xy   3 - 5 xtΘn x2 

- 2 xtΘn + 24 , xtΘn


Move to Home view, open the Toolbox and select Solve

In this case, the keystrokes are similar however Home view requires uppercase variables (X vs x).  CAS.solve() seeks a solution based on the starting guess.  In the last three rows, 25,0 and -25 were entered as starting guesses.

Answer:  -2, 3 and 4


Example 3:  A falling object may be described by the following equation:  

where d is distance (m) fallen, v0 is initial object downward velocity (m/s), g is gravity (m/sec^2) and t is time (sec).  

  1. Solve for t in terms of the other variables (d, v0 and g).
  2. How long will it take for the object to fall 500m?  Assume v0=0.0 and g=9.8?


Display, comments

CAS Toolbox 

CAS  3Solve  1Solve

d  =  v 0 × t + 0.5 × g × t 

x2  ,  t 


Move to CAS view, open the Toolbox and select Solve

Enter the equation and a variable (t) to solve for

The output shows two mathematical solutions.  Since time (t) should not be less than zero, the right hand solution may be appropriate.



d  = 500 , v 0  = 0 ,  g   = 0 Enter

For question b., use copy puts solve() in the command line.  

Then I used the math palette and selected the substitute key to enter values for d, v0 and g (500, 0 and 0)..  

The +10.1 seconds seems correct.  To check, you can key in the formula from above which also gives 10.1.

Other:  You can use copy again for the whole solve()|d=500…. and edit the values of d, V0 or t if you want. You can also use nsolve() for this type problem. Check out the Solver App which is especially suited to numerical solutions

Answer:  about 10.1 seconds

[1] You could press CAS (3) (1) to choose this menu item

[2] Could have avoided use of simplify by setting CAS simplify = maximum.

[3]    indicates pressing the right arrow, moving the cursor to the right  

[4] xtΘn  key can also be used to enter x, t, Θ or n depending on the App you are in.