upiterbarg / mpmath

Automatically exported from code.google.com/p/mpmath
Other
0 stars 0 forks source link

example: growth process of a plant #120

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Let

h(t) = 220 / (1 + b*exp(-a*t))

describe the growth of a plant. Let h(5) = 20.4 and h(10) = 92.9.

Find the parameters a and b.

>>> from mpmath import *
>>> h1 = lambda a, b: 220 / (1 + b*exp(-a*5)) - 20.4
>>> h2 = lambda a, b: 220 / (1 + b*exp(-a*10)) - 92.9
>>> findroot([h1, h2], (0, 1))
matrix(
[['0.393465986130316'],
 ['69.9730657971833']])

This can be verified by hand. This example could be extended to be
overdetermined.

Do you think it should replace the current example in findroot()'s
docstring (a polynomial system)?

Original issue reported on code.google.com by Vinzent.Steinberg@gmail.com on 25 Jan 2009 at 11:30

GoogleCodeExporter commented 9 years ago
Nice example, though the present one is fine too.

I'll write a blog entry for the 0.11 release, and I might include an example of
function interpolation to demonstrate multidimensional solving.

Original comment by fredrik....@gmail.com on 25 Jan 2009 at 12:07

GoogleCodeExporter commented 9 years ago
Great, looking forward!

Original comment by Vinzent.Steinberg@gmail.com on 25 Jan 2009 at 8:48

GoogleCodeExporter commented 9 years ago
Anything to do before closing this?

Original comment by fredrik....@gmail.com on 10 Jun 2009 at 10:49

GoogleCodeExporter commented 9 years ago
It was in your blog post, you can close this if you don't want it in the 
documentation.

Original comment by Vinzent.Steinberg@gmail.com on 10 Jun 2009 at 11:21

GoogleCodeExporter commented 9 years ago
I don't mind it in the documentation, but I don't think I'm going to add it 
myself.
So unless you are going to do it...

Original comment by fredrik....@gmail.com on 10 Jun 2009 at 11:31

GoogleCodeExporter commented 9 years ago
I considered it to replace the polynomial system in findroot()'s docstring, but 
you
told me it was fine...

Original comment by Vinzent.Steinberg@gmail.com on 10 Jun 2009 at 11:47