Mathematica Asked by Dr. phy on April 25, 2021
I’m trying to solve this second order D.E.
eq[t_] = x''[t] - (D[Log[solx[t]], t] + D[Log[Abs[D[x[t], t]]^2], t]) (x'[t]^2 + Abs[x'[t]]^2)
where:
solx[t_] := -0.7 (0.0015 + t)^(-2)
But both the analytic or numeric solutions give errors:
DSolve[{eq[t] == 0, x[0] == 1}, x[t], t] // FullSimplify
Or
NDSolveValue[{eq[t] == 0, x[0] == 1, x'[1] == 0}, x, {t, 0, 10}]
The initial conditions are so arbitrary. So any help to make these solutions work ?
The OP adds that x[t]
is to be complex. Since D[]
treats functions as complex analytic and Abs[]
is not differentiable anywhere, one is forced to deal with the real-analytic components Re[x[t]]
and Im[x[t]]
of x[t]
. It was easier to just "see" how to write the problematic term in terms of these parts than to figure out how to get Mathematica to transform the original equation.
D[Log[ComplexExpand[Abs[D[u[t] + I*v[t], t]]^2]], t]
(term = 2 Re[x'[t] Conjugate[x''[t]]]/Abs[x'[t]]^2) /.
x -> Function[t, u[t] + I*v[t]] // ComplexExpand // Simplify
(* (2 u'[t] u''[t] + 2 v'[t] v''[t])/(u'[t]^2 + v'[t]^2) (2 u'[t] u''[t] + 2 v'[t] v''[t])/(u'[t]^2 + v'[t]^2) *)
ClearAll[x, t, solx, eq];
solx[t_] := -7/10 (15/10000 + t)^(-2)
eq[t_] = x''[t] - (D[Log[solx[t]], t] + term) *
(x'[t]^2 + Abs[x'[t]]^2);
DSolve[{eq[t] == 0, x[0] == 1}, x[t], t]
(* $Aborted (killed DSolve[] after a minute or so) *)
sol = NDSolveValue[{eq[t] == 0, x[0] == 8/10, x'[0] == -1/40 + I/40},
x, {t, 0, 10}]
ReImPlot[sol[t], {t, 0, 10}]
If you really want to solve a BVP as in the OP — it seems an off-handedly tossed-out problem, though — use your understanding of the problem to pick good "StartingInitialConditions"
.
Original answer, assuming x[t]
is real as it is in the example
Abs
is the complex absolute value and is not differentiable. Use RealAbs
or apply ComplexExpand
to it or its derivative.This gives a solution:
ClearAll[x, t, solx, eq];
solx[t_] := -7/10 (15/10000 + t)^(-2)
eq[t_] = x''[
t] - (D[Log[solx[t]], t] +
D[Log[RealAbs[D[x[t], t]]^2], t]) (x'[t]^2 + RealAbs[x'[t]]^2)
DSolve[{eq[t] == 0, x[0] == 1}, x[t], t]
BVP's are difficult to solve if the ODE is prone to singularities. This gives a solution:
NDSolveValue[{eq[t] == 0, x[0] == 1, x'[1] == -1}, x, {t, 0, 10}]
Answered by Michael E2 on April 25, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP