# Solving ordinary differential equations \[growth equation\]

**URL:** <https://community.wolfram.com/t/solving-ordinary-differential-equations-growth-equation/3817>\
**Category:** Questions\
**Tags:** mathematica, calculus, equation-solving\
**Created:** [October 29, 2014, 1:22pm UTC](https://community.wolfram.com/t/solving-ordinary-differential-equations-growth-equation/3817 "2014-10-29T13:22:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bc123456](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@bc123456](https://community.wolfram.com/u/bc123456)\
**Post date:** [October 29, 2014, 1:22pm UTC](https://community.wolfram.com/t/solving-ordinary-differential-equations-growth-equation/3817/1 "2014-10-29T13:22:57Z")

</div>

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 = r_n_(1 - n/k)

Help?

---

<div class="post-metadata">

**Author:** ![fkampas](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/fkampas/32/41217_2.png) [@fkampas](https://community.wolfram.com/u/fkampas)\
**Post date:** [October 29, 2014, 2:10pm UTC](https://community.wolfram.com/t/solving-ordinary-differential-equations-growth-equation/3817/2 "2014-10-29T14:10:03Z")

</div>

You need to make n a function of t everywhere.

---

<div class="post-metadata">

**Author:** ![bc123456](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@bc123456](https://community.wolfram.com/u/bc123456)\
**Post date:** [October 29, 2014, 2:21pm UTC](https://community.wolfram.com/t/solving-ordinary-differential-equations-growth-equation/3817/3 "2014-10-29T14:21:30Z")

</div>

How do I do that?

---

<div class="post-metadata">

**Author:** ![seanc](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/seanc/32/34005_2.png) [@seanc](https://community.wolfram.com/u/seanc)\
**Post date:** [October 29, 2014, 2:25pm UTC](https://community.wolfram.com/t/solving-ordinary-differential-equations-growth-equation/3817/4 "2014-10-29T14:25:16Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![bc123456](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@bc123456](https://community.wolfram.com/u/bc123456)\
**Post date:** [October 29, 2014, 2:46pm UTC](https://community.wolfram.com/t/solving-ordinary-differential-equations-growth-equation/3817/5 "2014-10-29T14:46:55Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![seanc](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/seanc/32/34005_2.png) [@seanc](https://community.wolfram.com/u/seanc)\
**Post date:** [October 29, 2014, 5:23pm UTC](https://community.wolfram.com/t/solving-ordinary-differential-equations-growth-equation/3817/6 "2014-10-29T17:23:40Z")

</div>

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

```

---

<div class="post-metadata">

**Author:** ![aramos](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@aramos](https://community.wolfram.com/u/aramos)\
**Post date:** [October 31, 2014, 4:27pm UTC](https://community.wolfram.com/t/solving-ordinary-differential-equations-growth-equation/3817/7 "2014-10-31T16:27:07Z")

</div>

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,
