151Mathematics · University mathematics · Numerical methods

Bisection Root Bracketing

Bisection Root Bracketing

University numerical methods. Bisection Root Bracketing. Use a continuous real function on [a,b], with a<b and opposite endpoint signs, or an endpoint root. Enter a,b,f(a),f(b),N; N is an integer from 1 to 50, not a tolerance. Each round displays X=(a+b)/2; press EXE, then enter the current f(X) at Y?. The function is not stored automatically. All three exercises use Rad, essential for cos(x)−x.

  • 235 bytes
  • COMP mode
01

Worked examples

Example 1

Original exercise. University numerical methods. Data: f(x)=x²−2; [a,b]=[1,2]; f∈C[a,b]; N=4. Find: [a₄,b₄], m=(a₄+b₄)/2, h=(b₄−a₄)/2, |m−α|≤h.

Answer
[1.375,1.4375]; m=1.40625; |m−α|≤0.03125
Standard solution (without a calculator)
  1. Build the mathematical model and substitute the data.
  2. f(x)=x²−2; f∈C[1,2]
  3. f(1)=-1; f(2)=2; f(1)f(2)<0
  4. 1: c=1.5; f(c)=0.25; [a,b]=[1,1.5]
  5. 2: c=1.25; f(c)=-0.4375; [a,b]=[1.25,1.5]
  6. 3: c=1.375; f(c)=-0.109375; [a,b]=[1.375,1.5]
  7. 4: c=1.4375; f(c)=0.06640625; [a,b]=[1.375,1.4375]
  8. m=(1.375+1.4375)/2=1.40625
  9. h=(1.4375−1.375)/2=0.03125; |m−α|≤0.03125
  10. Combine the preceding results to obtain the answer.
Do it on the calculator

Example 2

Original exercise. University numerical methods. Data: f(x)=x³−x−2; [a,b]=[1,2]; f∈C[a,b]; N=4. Find: [a₄,b₄], m=(a₄+b₄)/2, h=(b₄−a₄)/2, |m−α|≤h.

Answer
[1.5,1.5625]; m=1.53125; |m−α|≤0.03125
Standard solution (without a calculator)
  1. Build the mathematical model and substitute the data.
  2. f(x)=x³−x−2; f∈C[1,2]
  3. f(1)=-2; f(2)=4; f(1)f(2)<0
  4. 1: c=1.5; f(c)=-0.125; [a,b]=[1.5,2]
  5. 2: c=1.75; f(c)=1.609375; [a,b]=[1.5,1.75]
  6. 3: c=1.625; f(c)=0.666015625; [a,b]=[1.5,1.625]
  7. 4: c=1.5625; f(c)=0.2521972656; [a,b]=[1.5,1.5625]
  8. m=(1.5+1.5625)/2=1.53125
  9. h=(1.5625−1.5)/2=0.03125; |m−α|≤0.03125
  10. Combine the preceding results to obtain the answer.
Do it on the calculator

Example 3

Original exercise. University numerical methods. Data: f(x)=cos(x)−x; [a,b]=[0,1]; Rad; f∈C[a,b]; N=4. Find: [a₄,b₄], m=(a₄+b₄)/2, h=(b₄−a₄)/2, |m−α|≤h.

Answer
[0.6875,0.75]; m=0.71875; |m−α|≤0.03125
Standard solution (without a calculator)
  1. Build the mathematical model and substitute the data.
  2. f(x)=cos(x)−x; f∈C[0,1]
  3. f(0)=1; f(1)=-0.4596976941; f(0)f(1)<0
  4. 1: c=0.5; f(c)=0.3775825619; [a,b]=[0.5,1]
  5. 2: c=0.75; f(c)=-0.01831113113; [a,b]=[0.5,0.75]
  6. 3: c=0.625; f(c)=0.1859631195; [a,b]=[0.625,0.75]
  7. 4: c=0.6875; f(c)=0.08533494615; [a,b]=[0.6875,0.75]
  8. m=(0.6875+0.75)/2=0.71875
  9. h=(0.75−0.6875)/2=0.03125; |m−α|≤0.03125
  10. Combine the preceding results to obtain the answer.
Do it on the calculator
02

When to use it

University numerical methods. Bisection Root Bracketing. Use a continuous real function on [a,b], with a<b and opposite endpoint signs, or an endpoint root. Enter a,b,f(a),f(b),N; N is an integer from 1 to 50, not a tolerance. Each round displays X=(a+b)/2; press EXE, then enter the current f(X) at Y?. The function is not stored automatically. All three exercises use Rad, essential for cos(x)−x.

Input order

  • A=a
  • B=b
  • C=f(a)
  • D=f(b)
  • M=N
  • Y=f(X)
  • Enter every required value again, including 0. Blank EXE retains memory; it is not zero. Used registers and Ans are overwritten.

Output order

  • c₁,…,cₙ
  • 0,aₙ,bₙ,m,h
  • Record the value and press EXE.
  • The program has ended. Press AC to leave; EXE runs it again.

Conditions and limitations

  • a<b; f∈C[a,b]; f(a)f(b)<0 ∨ f(a)f(b)=0; N∈ℤ,1≤N≤50
  • Y≠9E99
  • Use a continuous real function on [a,b], with a<b and opposite endpoint signs, or an endpoint root. Enter a,b,f(a),f(b),N; N is an integer from 1 to 50, not a tolerance. Each round displays X=(a+b)/2; press EXE, then enter the current f(X) at Y?. The function is not stored automatically. All three exercises use Rad, essential for cos(x)−x.
  • After the iterations read 0,a,b,midpoint,half-width. A zero function value gives a zero-width bracket. A single 1 means invalid bracket, signs or N; 2 means precision stagnation; 3 means blank Y or reserved 9E99. The half-width bounds root error only when continuity and correct function values hold. It does not prove uniqueness. Discontinuities and numerical cancellation can invalidate the sign test.
  • Enter every required value again, including 0. Blank EXE retains memory; it is not zero. Used registers and Ans are overwritten.
  • Finite precision can lose small differences between large numbers or probabilities extremely near 0 or 1. An error marker is never a valid answer.

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.