Skip to content

Python implementation of Muller's method for root finding.

License

Notifications You must be signed in to change notification settings

fgittins/muller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 

Repository files navigation

muller

Python implementation of Muller's method for root finding.

Usage

muller has no dependencies.

Here is a quick example to show how it is used. First, import the root finder

from muller import muller

We will look for a root of $$f(x) = e^{-x} \sin(x).$$ This has zeros at $x = n \pi$ with $n$ an integer.

We will look for the root at $x = 0$. We need three initial guesses for the root and will use $x = -1, 0, 1$. So,

from math import exp, sin

def f(x): return exp(-x)*sin(x)

xguesses = (-1, 0, 1)

To search for the root, we type

res = muller(f, xguesses)

We may examine the res object. The most useful attribute is res.root, which contains the estimate of the root.

Testing

To test, run

python -m unittest tests.test

in the root directory.

About

Python implementation of Muller's method for root finding.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages