# Problems solving a differential equation

I am trying to solve a differential equation:

$dN/dt = a*N*(90-N)$ with $N(0)=3$ and $N(11)=43$:

Using:

DSolve[{n'[t] == a*n[t]*(90 - n[t]), n[0] == 3}, n[t], t])


I get:

{{n[t] -> (90 E^(90 a t))/(29 + E^(90 a t))}}


but when I try to solve this equation:

Solve[3870/(43 + 47 E^(990 a)) == 3, a] //N


I get this result:

{{a -> ConditionalExpression[0.0010101 (3.27835 + (0. + 6.28319 I) C[1]), C[1] ∈ Integers]}}


Am I inputting something incorrectly or do I need to use another function for this problem?

• I don't think those 2 boundary conditions are compatible with the solution to the differential equation. You can just add the n[11]==43 into the DSolve and you can see it will return nothing. Commented Nov 4, 2014 at 15:45
• Executing Solve[((90 E^(90 a t))/(29 + E^(90 a t)) /. t -> 11) == 43, a] gives a -> ConditionalExpression[1/990 (2 I \[Pi] C[1] + Log[1247/47]), C[1] \[Element] Integers]. Presumably you want the real branch of this expression, so appending C[1]->0 gives a -> 1/990 Log[1247/47]. Commented Nov 4, 2014 at 15:45
• @user29165: The two boundary conditions are compatible because he is leaving a undefined, including the left boundary condition, and then solving for the value of a which satisfies the right boundary condition. Commented Nov 4, 2014 at 15:46
• @DumpsterDoofus thanks, I think you are right, how do I input your suggestion? Commented Nov 4, 2014 at 15:48

Your approach is correct, and you just need to be aware of the fact that the inverse of Exp is a multi-branched complex function. Presumably you want a real solution, and so you must choose C[1] so that the resulting solution is real-valued.

In more detail, you compute the solution with the left boundary condition, and then solve for the value of a which also satisfies the right boundary condition:

s = DSolveValue[{n'[t] == a*n[t]*(90 - n[t]), n[0] == 3}, n[t], t];
Solve[(s /. t -> 11) == 43, a]


giving

{{a -> ConditionalExpression[1/990 (2 I \[Pi] C[1] + Log[1247/47]),
C[1] \[Element] Integers]}}


This is complex-valued except when C[1] = 0, so we just do the substitution:

% /. C[1] -> 0


giving

{{a -> 1/990 Log[1247/47]}}


You can verify this is correct by the following:

g = s /. a -> 1/990 Log[1247/47]
g /. t -> 0
g /. t -> 11


which gives

3
43

• Thanks for the great answer, what does the c[1] stand for? Commented Nov 4, 2014 at 15:54
• @ChristianBillPedersen: When Solveing for a in the second step, you must take the inverse function of Exp. In Mathematica, Log is the principal branch of the inverse function of Exp in the complex plane, with a branch cut discontinuity along $(-\infty,0)$. However, when Solve does it, it allows for all possible choices of inverse branch, and thus there is an undetermined integer parameter C[1]. The principal branch corresponds to C[1] = 0, so making that substitution gives the answer that you are probably looking for. For more info, check out a course in complex analysis. Commented Nov 4, 2014 at 16:08
• @ChristianBillPedersen You can also just use Solve[(s /. t -> 11) == 43, a, Reals], to specify solving over the reals. Commented Nov 4, 2014 at 19:56