# ODE problem using DSolve

I would like to use DSolve (or NDSolve) to verify that the solution to the ODE problem

-4(v''[t]+(2/t)v'[t])-2*v[t]*Log[v[t]]-(3+(3/2)Log[4 Pi])*v[t]==0,


for $$t\geq 0$$ with conditions $$\lim_{t\to \infty}v(t)=0$$ and $$v'(0)=0$$ is given by the Gaussian

v[t]=(4 Pi)^(-3/4)*Exp[-t^2/8].


I am able to verify this by hand, but am having trouble using Mathematica to verify it. I would like to use Mathematica to solve this (simple) differential equation, so that I can later on modify some terms in the ODE to see how the solution changes.

Perhaps I am making a foolish mistake. I have also tried using NDSolve, but did not obtain the correct solution. I would appreciate any tips. Below you can find my code as well as the picture of the error messages. Thanks for your help.

Picture of updated output

sol=DSolve[{-4(v''[t]+(2/t)v'[t])-2*v[t]*Log[v[t]]
-(3+(3/2)Log[4 Pi])*v[t]==0,v[Infinity]==0,v'[0]==0},v[t],t]
Plot[Evaluate[v[t] /. sol], {t, 0, 10}, PlotRange -> All]


Edit: Changed r to t to correct a typo. The output is still the same as before.

• If you drop the boundary conditions, DSolve cannot solve for the general solution, which means there's little hope to get DSolve to do it on its own. The particular solution for the BVP might be a special case that someone was able to derive. NDSolve doesn't deal with infinity, so you have problems at both boundary conditions. You could use engineer's approximations, e.g. 10^-8 for 0, and 10 or 100 or whatever for infinity (depends on scale). Still seems difficult. Maybe do shooting manually. Apr 12, 2021 at 16:41

As MichaelE2 noted, DSolve seems unable to solve this ODE system, even when boundary conditions are omitted. I also tried the transformation,

eq = -4 (v''[t] + (2/t) v'[t]) - 2*v[t]*Log[v[t]] - (3 + (3/2) Log[4 Pi])*v[t] == 0;
eq /. v -> Function[{t}, Exp[w[t]]];
Simplify[0 == -2 Exp[-w[t]] First@%, w[t] \[Element] Reals]
(* 6 + 3 Log[4 Pi] + 4 w[t] + (16 w'[t])/t + 8 w'[t]^2 + 8 w''[t] == 0 *)


but DSolve[%, w[t], t, Assumptions -> t > 0] still returned unevaluated.

It is, however, possible to compare the desired solution,

s = (4 Pi)^(-3/4)*Exp[-t^2/8]


with a numerical solution of the ODE.

tmin = 10^-7;
NDSolveValue[{eq, v[tmin] == .1498278, v'[tmin] == 0}, v[t], {t, tmin, 10}];
LogPlot[{%, s}, {t, tmin, 10}, PlotRange -> All, ImageSize -> Large,
AxesLabel -> {t, v}, LabelStyle -> {15, Black, Bold}]


where the numerical solution agrees well with s over four orders of magnitude before diverging, which is inevitable for such problems. The initial condition, v[tmin] == .1498278 was developed by trial and error in just a few minutes. Automating the process is, of course, possible.

Incidentally, Mathematica also can be used to validate s directly by,

Simplify[eq /. v -> Function[{t}, Evaluate@s], t > 0]
(* True *)


The solution you give solves the ODE under very specific condition, which is at one point only, given by r=t

ode=-4(v''[t]+(2/r)v'[t])-2*v[t]*Log[v[t]]-(3+(3/2)Log[4 Pi])*v[t]==0;
sol=v->Function[{t},(4 Pi)^(-3/4)*Exp[-t^2/8]];
Assuming[{t>0,t==r},Simplify[ode/.sol]]

(*True*)


I am able to verify this by hand

The solution you give satisfies the boundary conditions. But a solution to the ODE have to also satisfy the ODE itself as well.

• Many thanks for your reply. I was indeed assuming that r=t and have now adjusted the ODE accordingly (it was a typo). However, I am still getting similar error messages (see new picture). Do you have any suggestions for how to find the solution using DSolve or NDSolve? Apr 12, 2021 at 11:11

"Your" solution doesn't solve the ode:

ode=-4 (v''[t] + (2/r) v'[t]) -2*v[t]*Log[v[t]] - (3 + (3/2) Log[4 Pi])*v[t] == 0

ode/.v -> Function[t, (4 Pi)^(-3/4)*Exp[-t^2/8]] // Simplify
(*(E^(-(t^2/8)) (-8 t + r (8 + t^2) + 8 r Log[E^(-(t^2/8))]))/r == 0*)

• Many thanks for your reply. I was assuming that r=t, in which case my solution does solve the ODE. I have now adjusted the ODE accordingly (it was a typo). However, I am still getting similar error messages (see new picture). Do you have any suggestions for how to find the solution using DSolve or NDSolve? Apr 12, 2021 at 11:12
• Sorry, no idea. Apr 12, 2021 at 12:09