095Mathematics · University mathematics · Numerical methods

General fixed-point iteration

University mathematics · Numerical methods · fx-50FH II · COMP · 92 bytes

University mathematics: Use fixed-point iteration for an exponential equilibrium, Newton iteration for a square root, and a cosine equation in radians. Enter each equation’s map in EDIT, then supply its numerical starting value when running.

  • 92 bytes
  • COMP mode
01

Worked examples

Example 1

Original university mathematics practice: a dimensionless feedback model is in equilibrium when x = 3(1 − e⁻ˣ). Find the nonzero equilibrium in [2,3] to four decimal places, and justify why there is only one solution in that interval. Keep the default formula and start with x₀ = 3.

Answer
The unique equilibrium in [2,3] is x ≈ 2.8214; Y = 2.821439372 and A = 13.
Standard solution (without a calculator)
  1. Set F(x) = x − 3(1 − e⁻ˣ). F(2) ≈ −0.5939941503 and F(3) ≈ 0.1493612051, so continuity gives a root in [2,3].
  2. For 2 ≤ x ≤ 3, F′(x) = 1 − 3e⁻ˣ ≥ 1 − 3e⁻² > 0. Thus F is strictly increasing there, proving uniqueness in the stated interval.
  3. Independent bisection gives r = 2.8214393721220788934…. The program starting at 3 displays 2.821439372, then 13 evaluations. The map sends [2,3] into itself with |g′| ≤ 3e⁻² < 1, so this starting value converges.
  4. Round the root to four decimal places: x = 2.8214. This is a dimensionless value. The separate zero root is outside the requested interval.
Do it on the calculator

Example 2

Original university mathematics practice: use Newton’s method to find the positive solution of x² = 7 to nine decimal places, starting at x₀ = 3. Derive the fixed-point map from the tangent formula, justify convergence for this seed, and record the program’s iteration count. Do not use the default exponential equation.

Answer
x = √7 ≈ 2.645751311 (9 decimal places); Y = 2.645751311 and A = 5.
Standard solution (without a calculator)
  1. For f(x) = x² − 7, f′(x) = 2x. Newton’s formula is xₙ₊₁ = xₙ − f(xₙ)/f′(xₙ) = (xₙ + 7/xₙ)/2, so prepare this map in EDIT. The denominator requires xₙ ≠ 0.
  2. Let r = √7. For x > 0, g(x) − r = (x − r)²/(2x) ≥ 0. If x ≥ r, then g(x) − x = (7 − x²)/(2x) ≤ 0. Since 3 > r, the iterates stay positive, decrease and remain bounded below by r; their limit is the positive root.
  3. Independent high-precision square-root arithmetic gives √7 = 2.6457513110645905905…. The first iterate is 8/3 and the second is 127/48, providing checks independent of the calculator’s displayed rounding.
  4. The prepared version with seed 3 displays Y = 2.645751311, then A = 5. Report x ≈ 2.645751311 to nine decimal places. The count records the run; the exact root and convergence argument provide the mathematical check.
Do it on the calculator

Example 3

Original university mathematics practice: a point on the unit circle has coordinates (cos θ, sin θ), where θ is measured in radians and 0 ≤ θ ≤ 1. Find the angle whose numerical value equals its horizontal coordinate, so cos θ = θ. Prove uniqueness in the interval, use fixed-point iteration from θ₀ = 1, and give the angle to nine decimal places with the iteration count.

Answer
θ ≈ 0.739085133 rad (9 decimal places); Y = 0.739085133 and A = 59.
Standard solution (without a calculator)
  1. Set H(x) = x − cos x using radians. H(0) = −1 and H(1) = 1 − cos 1 ≈ 0.4596976941. Continuity gives a root in [0,1], and H′(x) = 1 + sin x > 0 there proves uniqueness.
  2. Choose g(x) = cos x. It maps [0,1] into [cos 1,1], still inside [0,1], and |g′(x)| = sin x ≤ sin 1 < 1. Therefore iteration from 1 converges to the unique fixed point. Set Rad before using this map.
  3. Independent high-precision bracketing gives r = 0.7390851332151606417…. The prepared cosine version started at 1 displays Y = 0.739085133 and A = 59.
  4. The angle is θ ≈ 0.739085133 rad to nine decimal places. A Deg calculation interprets the cosine input differently and does not solve this radian equation.
Do it on the calculator
02

When to use it

This is university mathematics material on numerical methods. First rearrange the equation as x = g(x), then enter that map in the program editor so its value is stored in Y. X? accepts only a numerical starting value, not an equation. The three examples use different equations: an exponential equilibrium, x² = 7, and cos x = x in radians.

Choose and enter a starting value

  • Use COMP and Norm 1. The exponential and square-root examples use Deg, although their formulas do not depend on angle units. The cosine example requires Rad. Prepare the selected equation in EDIT before entering the numerical seed at X?.

Interpret the result

  • On success the first result is Y. Press EXE to read the final iteration count A. If no stopping test succeeds within 100 iterations, the only result is −100; it is a failure indicator, not a root.

Reuse the loop for another equation

  • In EDIT, replace only the formula statement that computes g(X) and stores it in Y; preserve the storage target and every other statement. The operation guide prepares each example in a separate empty program area. Formula changes also change the byte count; the appendix retains all six source examples.

Before you start

  • The default exponential source and the square-root example each occupy 92 bytes; the cosine version occupies 86. P1–P4 share 680 bytes. The program overwrites A, X and Y and updates Ans; save important values first. After successful completion Ans contains the count, not Y.
  • Enter x₀ explicitly. A blank EXE at X? reuses the currently stored X; entering 0EXE sets X to zero. These actions are different.
  • The test is |Y − X| < 10⁻¹⁰(|Y| + 10⁻¹⁰). It compares successive iterates, not a universally valid bound on root error or the residual of the original equation.
  • The default exponential equation has both 0 and a positive root; seed 0 stops at 0 after one evaluation. The square-root version needs a nonzero seed and uses a positive seed for the positive root. The cosine version must use Rad. Choose the equation and domain before running.
  • A successful stop can occur on iteration 100. Only 100 unsuccessful tests lead to −100. There is no explicit divergence or two-cycle detector.
  • A poor rearrangement or seed can diverge, cycle, overflow or encounter a forbidden calculation. The result can be −100 or Math ERROR. Recheck the equation, domain, angle unit and returned value; convergence is not guaranteed.
  • At Y, Disp is lit and EXE continues to A. At the final result record both numbers and press AC to leave. Do not infer units or accuracy from the LCD alone.

Sign in to unlock the full programme

Checking access…

The programme code and appendix unlock together.

Checking access…

Sign in to unlock the full programme

Checking access…

The programme code and appendix unlock together.