# Math Help - Logistic Equation

1. ## Logistic Equation

Ok Iv been trying to plot this for a while now and im having some major problems.

Firstly I found the Verhulst logistic equation to be: $\frac{dN(t)}{dt}=\lambda N(t)(1-\frac{\mu}{\lambda}N(t))$

Now if i let $K = \frac{\lambda}{\mu}$

Then we get

$\frac{dN(t)}{dt}=\lambda N(t)(1-\frac{N(t)}{K})=\lambda N(t)\frac{(K-N(t))}{K}$

If i solve this i get:
$t=\frac{1}{\lambda}(\ln|N|-\ln|K-N|)+C=\frac{1}{\lambda}\,\ln\left|\frac{N}{K-N}\right|+C
$

so

$\Rightarrow N(t)=\frac{KAe^{\lambda t}}{1+Ae^{\lambda t}}=\frac{KA}{e^{-\lambda t}+A}$

Now if i use K=1000 Lambda = 2 and N(0)=100 i can solve to find A
$100=\frac{1000A}{1+A{}}$

so A=1/9

However if i try and plot x=(1000/9)/(e^−λt)+1/9 in my graph plotter

I get the graph

when i am expecting a S shaped curve from the logistic equation.
Could someone please tell me what i have done wrong.

Many Thanks

Tom

2. $
\frac{dN(t)}{dt}=\lambda N(t)\frac{(K-N(t))}{K}=-\lambda N(t)\frac{(N-K(t))}{K}
$

Now seperating the equation we get (I will use $N(t)=N$)

$\frac{K}{N(N-K}dN=- \lambda dt$

by partial fractions we get...\

$\left( \frac{1}{N-K}-\frac{1}{N} \right)= -\lambda dt$

integrating

$\ln|N-K|-\ln|N|=-\lambda t + C \iff ln|\frac{N-K}{N}|=-\lambda t + C_0$

$\frac{N-K}{N}=C_1e^{- \lambda t}$

Finally we solve for N
$N-K=NC_1e^{-\lambda t} \iff N-NC_1e^{-\lambda t}=K \iff N(1-C_1e^{-\lambda t})=K$

so

$N(t)=\frac{K}{1+C_2e^{-\lambda t}}$

Note that I replaced $C_1$ with another Constant $C_2$

Give it a try with this one

3. That still gives me a graph that looks like this though:

Why dont i get one that looks like:

Is it that the equation i am using is wrong, and it is not actually the logistic equation?

Basically i just want to make it plot the S shaped curve, then I can do ones like taken from
Interesting Facts about Population Growth Mathematical Models

but the equation as it stands at the moment doesn't look anything like this!

Thanks for any help guys

4. The equation given by TheEmptySet is a start. You need to apply the initial condition. This is thus:

$N_0=\frac{K}{1+C_2}$

This gives C2 and can be put into the equation obtained. After a few steps of algebra you get:

$N(t)=\frac{K\cdot N_0 \cdot e^{\lambda t}}{K+N_0 \cdot (e^{\lambda t}-1)}$

Using now your values K=1000, N0=100 and lambda=2, you have a nice S-shaped curve.

If I look at the equations you plot, there seems to be something wrong with it's definition, you use lambda,
put I don't see it defined anywhere, also the x seems to be used in an awkward way.
Maybe you've entered the equation wrong.

5. $\frac{b}{(1+a e^{-\lambda t})}$ is a sigmoid function and does look like what you are expecting.

I think you are graphing: $\frac{b}{(1+a e^{-\lambda}t)}$ accidentally. Put parantheses around the exponent.

6. Originally Posted by TheEmptySet
$
\frac{dN(t)}{dt}=\lambda N(t)\frac{(K-N(t))}{K}=-\lambda N(t)\frac{(N-K(t))}{K}
$

Now seperating the equation we get (I will use $N(t)=N$)

$\frac{K}{N(N-K}dN=- \lambda dt$

by partial fractions we get...\

$\left( \frac{1}{N-K}-\frac{1}{N} \right)= -\lambda dt$

integrating

$\ln|N-K|-\ln|N|=-\lambda t + C \iff ln|\frac{N-K}{N}|=-\lambda t + C_0$

$\frac{N-K}{N}=C_1e^{- \lambda t}$

Finally we solve for N
$N-K=NC_1e^{-\lambda t} \iff N-NC_1e^{-\lambda t}=K \iff N(1-C_1e^{-\lambda t})=K$

so

$N(t)=\frac{K}{1+C_2e^{-\lambda t}}$

Note that I replaced $C_1$ with another Constant $C_2$

Give it a try with this one
That's just the same solution wearing a coat instead of a cardigan:

$N(t)= \frac{KA}{e^{-\lambda t}+A}$

is correct (I know because I pm'd the calculations leading to this answer myself).

$=\frac{K}{(e^{-\lambda t}/A) + 1} = \frac{K}{C_2 e^{-\lambda t} + 1}$.

where $C_2 = 1/A$.

Originally Posted by iknowone
$\frac{b}{(1+a e^{-\lambda t})}$ is a sigmoid function and does look like what you are expecting.

I think you are graphing: $\frac{b}{(1+a e^{-\lambda}t)}$ accidentally. Put parantheses around the exponent.

iknowone is correct in the first instance and has no doubt hit the nail on the head in the second.

7. Originally Posted by mr fantastic
That's just the same solution wearing a coat instead of a cardigan:

$N(t)= \frac{KA}{e^{-\lambda t}+A}$

is correct (I know because I pm'd the calculations leading to this answer myself).

$=\frac{K}{(e^{-\lambda t}/A) + 1} = \frac{K}{C_2 e^{-\lambda t} + 1}$.

where $C_2 = 1/A$.

iknowone is correct in the first instance and has no doubt hit the nail on the head in the second.
Originally Posted by MWG_Thomas
[snip]
Now if i use K=1000 Lambda = 2 and N(0)=100 i can solve to find A
$100=\frac{1000A}{1+A{}}$

so A=1/9

However if i try and plot x=(1000/9)/(e^−λt)+1/9 in my graph plotter

[snip]
That's the correct solution and can be simplified by multiplying top and bottom by 9 to get:

$N = \frac{1000}{1 + 9 e^{-2t}}$

and this has exactly the shape expected, including N = 100 when t = 0 and a horizontal asymptote N = 1000.

The given graph:

is totally inconsistent with the equation $N = \frac{1000}{1 + 9 e^{-2t}}$. That should have immediately been a red flag for data input error (and you know what the old saying is: garbage in, garbage out). In fact, the clue to the whole trouble is given in the bottom box where the equation defining the graph is given. There is no way the software package will understand from that equation that t is in the exponent. iknowone is right on the money.

8. Excellent guys, thankyou, cant believe the exponent was the problem! lol that caused so much frustration!

ty again

Tom

9. Originally Posted by MWG_Thomas
Excellent guys, thankyou, cant believe the exponent was the problem! lol that caused so much frustration!

ty again

Tom
It's always the little things that cause the trouble

10. Ok Guys now im Having some more problems.

I have managed to make the sigmoid curve required, however, I want the curves to look like the ones on this website
Interesting Facts about Population Growth Mathematical Models

as you can see here even though they use the same values as me the curve is different.

This also allows them to look at multiple fixed point values (something i need to do)

simply by changing their value of r (my value of $\lambda$

He calls his equation the Verhulst equation, but its a difference equation and mine is a differential version of it, however essentially they look pretty much the same to me.

The sigmoid curves that I am achieving always plateau at the value of K i am using, where as the ones he draws pleateau below K, depending on the value of r he uses.

How can I change mine so that I can get these multiple fixed points/declining population to 0, simply by changing my value for $\lambda$

Thanks again guys.

Tom

11. Originally Posted by MWG_Thomas
Ok Guys now im Having some more problems.

I have managed to make the sigmoid curve required, however, I want the curves to look like the ones on this website
Interesting Facts about Population Growth Mathematical Models

as you can see here even though they use the same values as me the curve is different.

This also allows them to look at multiple fixed point values (something i need to do)

simply by changing their value of r (my value of $\lambda$

He calls his equation the Verhulst equation, but its a difference equation and mine is a differential version of it, however essentially they look pretty much the same to me.

The sigmoid curves that I am achieving always plateau at the value of K i am using, where as the ones he draws pleateau below K, depending on the value of r he uses.

How can I change mine so that I can get these multiple fixed points/declining population to 0, simply by changing my value for $\lambda$

Thanks again guys.

Tom
The differential equation you're working is the continuous version of the logistic model.

Your reference is using a logistic map.

These two things are in fact very very different.

You will not be able to get what you're looking for by using the continuous version of the logistic model.

12. Originally Posted by mr fantastic
The differential equation you're working is the continuous version of the logistic model.

Your reference is using a logistic map.

These two things are in fact very very different.

You will not be able to get what you're looking for by using the continuous version of the logistic model.
Another link: Logistic map - Wikipedia, the free encyclopedia

13. ah ok
is the solution to the difference equation, from looking at the one on the wiki page, but then there is no K in it? which on the website there is a K

$x(n)=\frac{1}{r}- \frac{1}{r}(1-rx_{0})^{(r^{n)}}$

?

Then I can plot this and ill get the multiple fixed values etc and chaos?

I guess in my report I can explain that there is a continous and a discrete model

ty!