Results 1 to 13 of 13

Math Help - Logistic Equation

  1. #1
    Newbie
    Joined
    Mar 2008
    Posts
    8

    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))
    fromhttp://www.ugrad.math.ubc.ca/coursedoc/math100/notes/mordifeqs/logistic.html

    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<br />

    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
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Behold, the power of SARDINES!
    TheEmptySet's Avatar
    Joined
    Feb 2008
    From
    Yuma, AZ, USA
    Posts
    3,764
    Thanks
    78
    <br />
\frac{dN(t)}{dt}=\lambda N(t)\frac{(K-N(t))}{K}=-\lambda N(t)\frac{(N-K(t))}{K}<br />

    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
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Mar 2008
    Posts
    8
    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
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Junior Member
    Joined
    Mar 2008
    Posts
    61
    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.
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Member
    Joined
    Mar 2008
    Posts
    148
    \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.
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Flow Master
    mr fantastic's Avatar
    Joined
    Dec 2007
    From
    Zeitgeist
    Posts
    16,948
    Thanks
    5
    Quote Originally Posted by TheEmptySet View Post
    <br />
\frac{dN(t)}{dt}=\lambda N(t)\frac{(K-N(t))}{K}=-\lambda N(t)\frac{(N-K(t))}{K}<br />

    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.

    Quote Originally Posted by iknowone View Post
    \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.
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Flow Master
    mr fantastic's Avatar
    Joined
    Dec 2007
    From
    Zeitgeist
    Posts
    16,948
    Thanks
    5
    Quote Originally Posted by mr fantastic View Post
    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.
    Quote Originally Posted by MWG_Thomas View Post
    [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.
    Last edited by mr fantastic; March 28th 2008 at 04:03 PM.
    Follow Math Help Forum on Facebook and Google+

  8. #8
    Newbie
    Joined
    Mar 2008
    Posts
    8
    Excellent guys, thankyou, cant believe the exponent was the problem! lol that caused so much frustration!

    ty again

    Tom
    Follow Math Help Forum on Facebook and Google+

  9. #9
    Flow Master
    mr fantastic's Avatar
    Joined
    Dec 2007
    From
    Zeitgeist
    Posts
    16,948
    Thanks
    5
    Quote Originally Posted by MWG_Thomas View Post
    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
    Follow Math Help Forum on Facebook and Google+

  10. #10
    Newbie
    Joined
    Mar 2008
    Posts
    8
    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
    Follow Math Help Forum on Facebook and Google+

  11. #11
    Flow Master
    mr fantastic's Avatar
    Joined
    Dec 2007
    From
    Zeitgeist
    Posts
    16,948
    Thanks
    5
    Quote Originally Posted by MWG_Thomas View Post
    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.
    Follow Math Help Forum on Facebook and Google+

  12. #12
    Flow Master
    mr fantastic's Avatar
    Joined
    Dec 2007
    From
    Zeitgeist
    Posts
    16,948
    Thanks
    5
    Quote Originally Posted by mr fantastic View Post
    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
    Follow Math Help Forum on Facebook and Google+

  13. #13
    Newbie
    Joined
    Mar 2008
    Posts
    8
    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!
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. The Logistic Equation
    Posted in the Differential Equations Forum
    Replies: 5
    Last Post: January 11th 2011, 02:22 PM
  2. Logistic Equation
    Posted in the Differential Equations Forum
    Replies: 1
    Last Post: November 19th 2010, 10:49 AM
  3. Help with logistic equation
    Posted in the Calculus Forum
    Replies: 0
    Last Post: February 22nd 2010, 03:25 PM
  4. [SOLVED] Logistic Equation
    Posted in the Differential Equations Forum
    Replies: 0
    Last Post: November 4th 2009, 06:29 PM
  5. Logistic Equation Help
    Posted in the Calculus Forum
    Replies: 6
    Last Post: May 8th 2008, 01:51 AM

Search Tags


/mathhelpforum @mathhelpforum