I am trying to solve the linear Schrödinger equation with Fourier transform as follows. Although analytically I was able to solve it and create the graphs I wanted. I have difficulty making the corresponding graph when I solve the problem numerically. Can you explain to me what is my mistake in the following code?

Analytical solution

f[x_] = Exp[-x^2]
u[x_, t_, v_] = 
 Integrate[(Exp[-(I*Pi)/(4) + I*(x - y)^2/(4*v*t)])*
    f[y], {y, -Infinity, Infinity}, 
   Assumptions -> {v > 0, t > 0}]/(Sqrt[4 Pi*v*t])
eik5 = Plot3D[Abs[u[x, t, 0.25]]^2, {x, -25, 25}, {t, 0.05, 30}, 
  PlotRange -> All, PlotPoints -> 250]

enter image description here

Numerical solution

(*  Fourier tranform for the equation  Subscript[u, \
t](x,t)=i*v*Subscript[u, xx](x,t) *)
FourierSinTransform[ D[u[x, t], {t, 1}], x, \[Omega]] == 
 FourierSinTransform[ I*v* D[u[x, t], {x, 2}], x, \[Omega], 
  FourierParameters -> {1, -1}]
ode = D[
\!\(\*OverscriptBox[\(\(\ \ \)\(u\)\), \(^\)]\)[\[Omega], t], {t, 
     1}] == I*v*\[Omega]*(-\[Omega]*
\!\(\*OverscriptBox[\(u\), \(^\)]\)[\[Omega], t] - 2*T0);
sol = DSolve[ode, 
\!\(\*OverscriptBox[\(u\), \(^\)]\)[\[Omega], t], t]
FourierSinTransform[u[x, 0], x, \[Omega]] == 
 FourierSinTransform[f[x], x, \[Omega], FourierParameters -> {1, -1}]
ic = 
\!\(\*OverscriptBox[\(u\), \(^\)]\)[\[Omega], 0] == 
  FourierSinTransform[f[x], x, \[Omega], FourierParameters -> {1, -1}]
sol = DSolve[{ode, ic}, 
\!\(\*OverscriptBox[\(u\), \(^\)]\)[\[Omega], t], t]

\!\(\*OverscriptBox[\(u\), \(^\)]\)[\[Omega]_, t_] = -((
  2 E^(-I t v \[Omega]^2) (-T0 + 
     E^(I t v \[Omega]^2)
       T0 + \[Omega] DawsonF[\[Omega]/2]))/\[Omega])
u[x_, t_] = InverseFourierSinTransform[
\!\(\*OverscriptBox[\(u\), \(^\)]\)[\[Omega], t], \[Omega], x, 
  FourierParameters -> {1, -1}, Assumptions -> {x > 0}]
T0 = 1;
Plot[Abs[u[x, t]]^2, {x, 0, 20}, PlotRange -> All]

You can download the notebook of my project from Wolfram Community enter image description here


1 Answer 1


Too large in comment:

It is very simple actually. The InverseFourierSinTransform in your notebook did not evaluate. Then you are trying to plot it. Here is screen shot from your notebook near the end

enter image description here

You should really always make sure each command completes OK before using its output in the next command.

V 13.2.1 on windows 10

  • $\begingroup$ Why the code did not evaluate? $\endgroup$ Jun 9 at 18:41
  • 1
    $\begingroup$ @AthanasiosParaskevopoulos I do not know. Mathematica just could not do it. May be there is a workaround or may be it is too hard. But this is separate issue. You could post separate question on this part only. I am just answering the question on why you are getting these errors from the plot command. $\endgroup$
    – Nasser
    Jun 9 at 18:43
  • $\begingroup$ Οh ok!!! Thank you. I will do it $\endgroup$ Jun 9 at 18:44

Your Answer

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

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