Solving ordinary differential equations [growth equation]

Hello, Im having trouble trying to solve this equation(question). I used Dsolve but I think im inputting it wrong.

dn/dt=r n(1-n/k)

r is called the growth rate, and k is called the carrying capacity. n is the population, t is time. initial condition n = n0 at t = 0.

------> What is the symbolic solution? Also, If k = 100, n0 = 1 and r = 0.1, how long(t) until n = 50?

What I’ve tried…

DSolve[Derivative[1][n][t] == n^2*(1 - n/k)*r, n[t], t]

== ordinary differential equation of dn/dt = rn(1 - n/k)

Help?

You need to make n a function of t everywhere.

How do I do that?

Replace “n” with “n[t]”.

So n^2(1 - n/k)r should be written n[t]^2(1 - n[t]/k)r.

Cheers, I get…

{{n[t] →
InverseFunction[Log[#1]/k^2 - Log[-k + #1]/k^2 - 1/(k #1) &][(r t)/
k + C[1]]}}

Look right?

Inverse functions are tricky. The inverse function of a function that is one-to-one can cause problems. You’ll want to be careful about that.

In general, to verify the solution, plug it back into the differential equation and see if it comes back with “True” :

solution = {{n[t] -> 
     InverseFunction[
       Log[#1]/k^2 - Log[-k + #1]/k^2 - 1/(k #1) &][(r t)/k + C[1]]}};

diffEquation = HoldForm[D[n[t], t] == n[t]^2 (1 - n[t]/k) r]

ReleaseHold[diffEquation /. First[solution]]

I’ve used HoldForm to make sure that the subsitution worked. Without it, Mathematica might try to simplify D[n[t], t] to n’[t] which doesn’t match the pattern. ReleaseHold is used after n[t] has been properly substituted with the proposed solution. The result of this is an enormous complicated equality. Fortunately, FullSimplify can handle it:

FullSimplify@%

True

Dear Brendan,

Please take into account that you are trying to solve a wrong equation: be aware of the n[t]^2 factor which should be n[t].

Just try this:

DSolve[D[n[t], t] == r n[t] (1 - n[t]/k), n[t], t][[1]]

with the answer of Mathematica 10.0.1

{n[t] → (E^(r t + k C[1]) k)/( E^(r t + k C[1])-1)}

although the solution you might desire is

{n[t] → (E^(r t + k C[1]) k)/( E^(r t + k C[1])+1)}

Best regards,