1
$\begingroup$

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?

$\endgroup$
4
  • $\begingroup$ 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. $\endgroup$
    – user29165
    Commented Nov 4, 2014 at 15:45
  • $\begingroup$ 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]. $\endgroup$ Commented Nov 4, 2014 at 15:45
  • $\begingroup$ @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. $\endgroup$ Commented Nov 4, 2014 at 15:46
  • $\begingroup$ @DumpsterDoofus thanks, I think you are right, how do I input your suggestion? $\endgroup$ Commented Nov 4, 2014 at 15:48

1 Answer 1

2
$\begingroup$

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
$\endgroup$
3
  • $\begingroup$ Thanks for the great answer, what does the c[1] stand for? $\endgroup$ Commented Nov 4, 2014 at 15:54
  • 1
    $\begingroup$ @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. $\endgroup$ Commented Nov 4, 2014 at 16:08
  • 2
    $\begingroup$ @ChristianBillPedersen You can also just use Solve[(s /. t -> 11) == 43, a, Reals], to specify solving over the reals. $\endgroup$
    – Michael E2
    Commented Nov 4, 2014 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.