## Numerical

 home  Bib  Algorithms  Bioinfo  FP  Logic  MML  Prog.Lang and the  mmlist

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:

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?
 Coding Ockham's Razor, L. Allison, Springer A Practical Introduction to Denotational Semantics, L. Allison, CUP

 Linux  Ubuntu free op. sys. OpenOffice free office suite The GIMP ~ free photoshop Firefox web browser

 © 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 Saturday, 20-Aug-2022 11:47:09 AEST.