Trident Help

RPN Advanced 42 manual · Chapter 14 of 18

The SOLVER

Find the root of an equation you describe as a program, one variable at a time.

14.1How the solver works#

The solver finds a value of one variable that makes your program return zero. You write the equation as a program that ends with the quantity that should be zero, for example x2−2x^2-2. The program declares its variables with MVAR lines so the solver knows what to offer.

  1. write a program with MVAR variables
  2. ⇧SOLVER7 SOLVER
  3. pick the program
  4. give a guess for the variable
  5. press the variable again to solve
Solving an equation

14.2Write the equation as a program#

Turn on PRGM mode with shift R/S. Press PGM.FCN (shift 3), LBL, and type a name. Then press down twice to reach MVAR and declare the variable. Type the equation in RPN with RCL for the variables, and finish with RTN. Turn PRGM off with shift R/S.

Example 14.1

Program for x squared minus 2

  1. Create the program FX with one variable X. It computes X squared and subtracts 2.

    ⇧PRGMR/S⇧PGM.FCN3Σ+⇧ALPHAENTER1/xΣ+XEQ1/xENTER⇧PGM.FCN3▼▼Σ+XEQ1/xENTERRCL⇧ALPHAENTERXEQ1/xENTER⇧x²√x2−⇧PGM.FCN31/x⇧PRGMR/SEXITEXIT
  2. Check the label list in the solver: FX is offered.

    ⇧SOLVER7
    After step 2: Check the label list in the solver: FX is offered. The display shows: Select Solve Program /  FX                    .
Result of the example "Program for x squared minus 2" The display shows: Select Solve Program /  FX                    .
You should seeFX

14.3Find a root#

Choose the program, then its variable. Type a guess and press the variable key to store it. Press the variable key again with no number typed to solve. The answer is in X and in the variable; Y holds the previous estimate. If no root is found the message is Extremum or Constant?. You can store two guesses (press the variable key after each) to steer toward a different root.

Example 14.2

Solve x² − 2 = 0

x2−2=0⇒x=2≈1.4142x^{2}-2=0\Rightarrow x=\sqrt2\approx1.4142
  1. Write the program FX (see above), open the solver and pick FX, then the variable X.

    ⇧PRGMR/S⇧PGM.FCN3Σ+⇧ALPHAENTER1/xΣ+XEQ1/xENTER⇧PGM.FCN3▼▼Σ+XEQ1/xENTERRCL⇧ALPHAENTERXEQ1/xENTER⇧x²√x2−⇧PGM.FCN31/x⇧PRGMR/SEXITEXIT⇧SOLVER7Σ+Σ+
  2. Type a guess of 1 and store it into X.

    1Σ+
    After step 2: Type a guess of 1 and store it into X. The display shows: X=1.0000 /  X                     .
  3. Press X again with nothing typed to solve.

    Σ+
Result of the example "Solve x² − 2 = 0" The display shows: X=1.4142 /  X                     .
You should seeX=1.4142
Example 14.3

Two guesses select the negative root

  1. Store guesses −3 and −1, then solve.

    ⇧PRGMR/S⇧PGM.FCN3Σ+⇧ALPHAENTER1/xΣ+XEQ1/xENTER⇧PGM.FCN3▼▼Σ+XEQ1/xENTERRCL⇧ALPHAENTERXEQ1/xENTER⇧x²√x2−⇧PGM.FCN31/x⇧PRGMR/SEXITEXIT⇧SOLVER7Σ+Σ+3+/−Σ+1+/−Σ+Σ+
Result of the example "Two guesses select the negative root" The display shows: X=-1.4142 /  X                     .
You should seeX=-1.4142
Example 14.4

Read the root afterwards

  1. Solve as before, close the menus and recall the variable with all digits (DISP, FIX, 09).

    ⇧PRGMR/S⇧PGM.FCN3Σ+⇧ALPHAENTER1/xΣ+XEQ1/xENTER⇧PGM.FCN3▼▼Σ+XEQ1/xENTERRCL⇧ALPHAENTERXEQ1/xENTER⇧x²√x2−⇧PGM.FCN31/x⇧PRGMR/SEXITEXIT⇧SOLVER7Σ+1Σ+Σ+EXITEXITRCL⇧ALPHAENTERXEQ1/xENTER⇧DISPEΣ+09
Result of the example "Read the root afterwards" The display shows: x: 1.414213562 / FIX■ SCI ENG ALL R.■ R,.
You should see1.414213562

See also Solve an equation with your own programSolve an equation numerically

14.4When there is no root#

Example 14.5

x squared plus 1 has no real root

  1. Make a program NR that computes X squared plus 1.

    ⇧PRGMR/S⇧PGM.FCN3Σ+⇧ALPHAENTERLOGΣ+LNΣ+ENTER⇧PGM.FCN3▼▼Σ+XEQ1/xENTERRCL⇧ALPHAENTERXEQ1/xENTER⇧x²√x1+⇧PGM.FCN31/x⇧PRGMR/SEXITEXIT
  2. Solve from a guess of 1.

    ⇧SOLVER7Σ+1Σ+Σ+
Result of the example "x squared plus 1 has no real root" The display shows: Extremum /  X                     .
You should seeExtremum

HP-42S is a trademark of HP Inc.. Trident Calculator is an independent product by South View Studios and is not affiliated with, sponsored by or endorsed by HP. The name is used only to describe the kind of calculator this model resembles; Trident's names, keys, display, fonts and software are its own clean-room design.