I am trying to solve the linear Schrödinger equation with the Fourier transform. 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?

\!\(\*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}]

Then I tried to create the graph

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

ps. Consider using this input as more readable (edit by Nasser)

OverHat[u][ω_, t_] = -((2*(-T0 + E^(I*t*v*ω^2)*T0 + ω*DawsonF[ω/2]))/E^(I*t*v*ω^2)/ω)
u[x_, t_] = InverseFourierSinTransform[OverHat[u][ω, t], ω, x, FourierParameters -> {1, -1}, Assumptions -> {x > 0}]
  • 1
    $\begingroup$ I think it will be better if you just post only the relevant part of your code related to using InverseFourierSinTransform only, which did not evaluate and that why the plot did not work. Do you need all the other definitions of ode and plot commands to show this? I do not think so. This will make your question easier to understand and more chance of getting help. $\endgroup$
    – Nasser
    Jun 9, 2023 at 19:03
  • $\begingroup$ @Nasser I think now it is better $\endgroup$ Jun 9, 2023 at 19:09
  • $\begingroup$ Yes, agree, much better now. But to make it even better consider posting the InputForm instead. Much more readable. See the difference !Mathematica graphics this I can read. But what you showed above due to the 2D fancy letters used which looks good in notebook but not in the post. ps. I put that in your question at the end. Free free to use it if you want, or delete it if you do not want it. $\endgroup$
    – Nasser
    Jun 9, 2023 at 19:09
  • $\begingroup$ @Nasser No i like it. I will keep it $\endgroup$ Jun 9, 2023 at 19:19
  • $\begingroup$ @Nasser Although it does not give me a result too $\endgroup$ Jun 9, 2023 at 19:24

1 Answer 1

OverHat[u][\[Omega]_, t_] = -((2*(-T0 + 
       E^(I*t*v*\[Omega]^2)*T0 + \[Omega]*DawsonF[\[Omega]/2]))/
   E^(I*t*v*\[Omega]^2)/\[Omega]) // FunctionExpand // Expand

(*-((2 T0)/\[Omega]) + (2 E^(-I t v \[Omega]^2) T0)/\[Omega] - 
E^(-(\[Omega]^2/4) - I t v \[Omega]^2) Sqrt[\[Pi]] Erfi[\[Omega]/2]*)

InverseFourierSinTransform[#, \[Omega], x, FourierParameters -> {1, -1}, Assumptions -> {x > 0}] & /@OverHat[u][\[Omega], t]

Mathematica can't compute: $\sqrt{\pi } \text{erfi}\left(\frac{\omega }{2}\right) \left(-e^{-\frac{\omega ^2}{4}-i t v \omega ^2}\right)$ term.

We use identity:$$\text{erfi}\left(\frac{\omega }{2}\right)=\int_0^{\infty } \frac{2 e^{-z^2+\frac{\omega ^2}{4}} \sin (z \omega )}{\sqrt{\pi }} \, dz$$ then:

E^(-(\[Omega]^2/4) - I t v \[Omega]^2) Sqrt[\[Pi]] *(
2 E^(-z^2 + \[Omega]^2/4) Sin[z \[Omega]])/Sqrt[\[Pi]] // 
FullSimplify, \[Omega], x, FourierParameters -> {1, -1}, 
Assumptions -> {x > 0, z >= 0}], {z, 0, Infinity}, 
Assumptions -> x > 0]

(*ConditionalExpression[-(E^(x^2/(-1 - 
(4*I)*t*v))*Sqrt[I*t*v]*Sqrt[(I*t*v - 4*t^2*v^2)^(-1)]*Erf[Sqrt[((4*I)*t*v - 16*t^2*v^2)^(-1)]*x]), Im[1/(t*v)] > -4]*)


$$u(x,t)=-\text{T0} \text{erf}\left(\frac{x}{2 \sqrt{i t v}}\right)-e^{\frac{x^2}{-1-4 i t v}} \sqrt{i t v} \sqrt{\frac{1}{i t v-4 t^2 v^2}} \text{erf}\left(\sqrt{\frac{1}{4 i t v-16 t^2 v^2}} x\right)+\text{T0} \text{sgn}(x)$$

 u[x_, t_] = -T0 Erf[x/(2 Sqrt[I t v])] - 
 E^(x^2/(-1 - 4 I t v)) Sqrt[I t v] Sqrt[1/(I t v - 4 t^2 v^2)]
 Erf[Sqrt[1/(4 I t v - 16 t^2 v^2)] x] + T0 Sign[x]

 T0 = 1; v = 1;(*Assumed parameters *)
 Plot[Abs[u[x, 1/5]]^2, {x, 0, 5}, PlotRange -> All](*for t=1/5*)

enter image description here


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.