Numerical

LA home
Computing
 Algorithms
 Bioinformatics
 FP,  λ
 Logic,  π
 MML
 Prog.Langs

Algorithms
 glossary
 Numerical
  Num'Errors
  Polynomials
  Stirling
  Mean&S.D.
  Integration

Solving Equations

A zero, x, of a continuous function, f(x), i.e. such that f(x)=0, can be found by an application of the binary search algorithm. Values `Lo' and `Hi' are chosen such that (i) Lo<Hi, and (ii) f(Lo)<0 and f(Hi)>0 or v.v..

Mid=(Lo+Hi)/2 and f(Mid) is computed. If f(Mid) has the same sign as f(Lo) then Lo is moved up to Mid. If it has the same sign as f(Hi) then Hi is moved down to Mid. The algorithm terminates when Hi-Lo is "small". It is not a good idea to wait until f(Mid)=0!

The HTML FORM below can be used to solve a cubic polynomial (we'll ignore the fact that there are better ways to solve cubics). Change the coefficients of the powers of x and click on the `solve' button to find a zero:

©
L
.
A
l
l
i
s
o
n
f(x)=x3+ x2+ x1+ =0
-trace
x  =  [  ]
f(x)=[  ]

Exercises

  1. Find a solution to x3+x2+x+1=0. What are the other two solutions?
  2. Multiply out f(x)=(x-1)(x-2)(x-3), by hand, and use the FORM to find one of the solutions to f(x)=0.
  3. What happens if the coefficient of x3 is set to zero, and the other coefficients are set to 1? Why does this happen? Could the problem be fixed?
window on the wide world:

Computer Science Education Week

Linux
 Ubuntu
free op. sys.
OpenOffice
free office suite,
ver 3.4+

The GIMP
~ free photoshop
Firefox
web browser
FlashBlock
like it says!

© L. Allison   http://www.allisons.org/ll/   (or as otherwise indicated),
Faculty of Information Technology (Clayton), Monash University, Australia 3800 (6/'05 was School of Computer Science and Software Engineering, Fac. Info. Tech., Monash University,
was Department of Computer Science, Fac. Comp. & Info. Tech., '89 was Department of Computer Science, Fac. Sci., '68-'71 was Department of Information Science, Fac. Sci.)
Created with "vi (Linux + Solaris)",  charset=iso-8859-1,  fetched Friday, 25-Apr-2014 04:44:15 EST.