2

I have to solve the following differential equation

L'[t] == L[t]^(-3/2) - 0.1

I tried DSolve:

Clear[t]
Clear[L]
Clear[solution]
solution = DSolve[{L'[t] == L[t]^(-3/2) - 0.1, L[0] == 10}, L[t], t]

which did not work. Now NDSolve gives me a good result:

Clear[t]
Clear[L]
Clear[solution]
extf = 0.1
tmax = 10000
solution = NDSolve[{L'[t] == L[t]^(-3/2) - extf, 
            L[0] == 10}, L[t], {t, 0, tmax}]
Plot[Evaluate[L[t] /. solution], {t, 0, tmax}, PlotRange -> All]

How can I approximate this function through an analytic representation (fitting)? If thats not possible: How to export the InterpolatedFunction as a data file?

Thank you all!

MaxJ
  • 1,535
  • 1
  • 10
  • 16

1 Answers1

6

I'm not sure why DSolve fails, but the differential equation can be solved in the usual way of separating the variables.* So t will be equal to

solt = Integrate[1/(LL^(-3/2) - 1/10), {LL, 10, L}, Assumptions -> 10^(2/3) < L < 10];
(* complicated output omitted - see below *)

We can use InverseFunction to get L in terms of t:

solL = L -> InverseFunction[Evaluate[solt] & /. L -> #]
(*
  L -> InverseFunction[-(10/3) (-30 + 3 #1 - 
      2 Sqrt[3] 10^(2/3) ArcTan[(1 + 2 10^(1/6))/Sqrt[3]] + 
      2 Sqrt[3] 10^(2/3)ArcTan[(5 + 10^(2/3) Sqrt[#1])/(5 Sqrt[3])] - 
      10^(2/3) Log[10] - 2 10^(2/3) Log[-1 + 10^(1/6)] + 
      10^(2/3) Log[1 + 10^(1/6) + 10^(1/3)] + 
      2 10^(2/3) Log[-10 + 10^(2/3) Sqrt[#1]] - 
      10^(2/3) Log[10 + 10^(2/3) Sqrt[#1] + 10^(1/3) #1]) &]
*)

Check:

{L'[t] == L[t]^(-3/2) - 1/10, L[0] == 10} /. solL // FullSimplify
(*  {True, True}  *)

You might want to stick with the NDSolve solution. This one is very difficult to evaluate (yes, that's fifteen seconds for one value):

N[L[450] /. solL] // AbsoluteTiming
(*  {15.478482, 4.6416}  *)

*Update in response to comment: A standard solution to an initial value problem of the form $$ {dL\over dt} = {f(L)\over g(t)}, \quad L(t_0)=L_0$$ is given by $$ \int_{L_0}^L {dL' \over f(L')} = \int_{t_0}^t {dt' \over g(t')} $$ In the example IVP given in the question $f(L)$ is L[t]^(-3/2) - 1/10, $g(t)$ is 1, $L_0$ is 10, and $t_0 = 0$. These parameters have to be adapted to each IVP. The Integrate code above use Assumptions to get a simplified form of the integral as well as the right branch. In general a critical value where $f(L) = 0$ is a singular value of the integral. These can cause trouble for Integrate in the sense that it might (and sometimes does) generate conditions that are more restrictive than necessary

Michael E2
  • 235,386
  • 17
  • 334
  • 747
  • Your L is less than 10 since the derivative at t=0 is negative. – Alexey Bobrick Nov 02 '14 at 22:28
  • @AlexeyBobrick Yes, I know. We have $10^{2/3} < L \le 10$ for $t \ge 0$. (I'm not sure why you made the comment.) – Michael E2 Nov 02 '14 at 22:59
  • Sorry, was a bit brief! I think there are two things here. One is that you use assumtion that L is larger than 10 when solving for the integral. Yes, and I thought that another was that something might start happening to L once it gets to zero. But evidently it doesn't reach zero. – Alexey Bobrick Nov 03 '14 at 10:53
  • @AlexeyBobrick Ah, thanks. Fixed now. And yes it doesn't reach zero because there an equilibrium position where L0^(-3/2) - 1/10 == 0. – Michael E2 Nov 03 '14 at 11:10
  • Yes, exactly. Cheers! – Alexey Bobrick Nov 03 '14 at 11:14
  • Why exactly do you set the range for L? With NDSolve I found a solution (different constants) where the derivative is always >0 so that L>10 for t>0 which is exactly what I am interested in. OK maybe should have specified that. Sorry – MaxJ Nov 03 '14 at 11:35
  • @user3683367 You specified L[0] == 10 in your code. It follows that L[t] will be less than 10 for t > 0. The use of Assumptions was to simplify the result. Integrate will return a complex-valued antiderivative with no assumptions, and a ConditionalExpression if we tell Integrate that L lies in an interval containing 10 and the integral starts at L = 10. Note you get the same integral whether we specify L > 10 or 10^(2/3) < L < 10 in Assumptions. If the initial condition for L[0] is some number ic, then the integral should be over {L0, ic, L}. – Michael E2 Nov 03 '14 at 13:48
  • @user3683367 You must have changed the differential equation to get a solution for which L[t] > 10 remains true. The (real) solutions to L'[t] == L[t]^(-3/2) - 0.1 all converge to 10^(2/3). I'm guessing you're dealing with L'[t] == L[t]^(-3/2) - a for various values of a. Then a^(-2/3) will be the critical value. BTW, with exact solvers such as DSolve and Integrate, and sometimes with numeric solvers that do symbolic analysis, exact input usually gives better results (e.g., use 1/10 instead of 0.1). – Michael E2 Nov 03 '14 at 13:56
  • 1
    note you can use the indefinite integral to get a generic solution without making the assumptions: FullSimplify[# - (# /. L -> L0)] &@ Integrate[1/(L^(-3/2) - c), L]. This will naturally give you L>L0 for appropriate values of c.. – george2079 Nov 03 '14 at 15:38
  • @george2079 Yep, thanks. Funny, I just figured this out. I've been trying to track down why DSolve gives up after finding the general solution. Similar to this answer, but that trick is not working. It appears Solve gives up on a simple equation.... :( – Michael E2 Nov 03 '14 at 16:04