[Tutor] Complex roots

Dick Moores rdm at rcblue.com
Thu Dec 16 04:00:24 CET 2004


Alan Gauld wrote at 09:25 12/12/2004:
> > Are these "numerical approximation methods" pythonically possible?
> >
>
>Yes and that's how they are normally found - not necessarily with
>Python,
>but by applying computer simulations of the equations. Generally you
>calculate values in ever decreasing increments until you get enough
>accuracy. eg you discover a zero crossingh between 3 and 4, then
>between 3.3 and 3.4 then between 3.36 and 3.37 and so on...
>
>Caveat:
>You also need to look out for double crossings within a single step
>change, so don't make the steps too big. And check the number of
>roots you expect versus the number you get as an error detection
>scheme.

I tried to follow your tips, and came up with pinchCubic.py for 
approximating the real roots of cubic equations.
<http://www.rcblue.com/Python/pinchCubic.py>

I'd appreciate any guidance.

Dick Moores
rdm at rcblue.com




More information about the Tutor mailing list