# Solve a Complex-Valued Oscillator

Solve a harmonic oscillator over a 2D disk region. The mass matrix option is given in order to solve the PDE with complex-valued coefficients.

 In[1]:= X\[CapitalOmega] = Disk[{0, 0}, 10]; uif = NDSolveValue[ {I \!\( \*SubscriptBox[\(\[PartialD]\), \(t\)]\(\[CapitalPsi][t, x, y]\)\) == -(1/2) Inactive[Laplacian][\[CapitalPsi][t, x, y], {x, y}] + 3/2 (x^2 + y^2) \[CapitalPsi][t, x, y], \[CapitalPsi][0, x, y] == E^- ((x - 1)^2 + y^2), DirichletCondition[\[CapitalPsi][t, x, y] == 0, True]}, \[CapitalPsi], {x, y} \[Element] \[CapitalOmega], {t, 0, 5}, Method -> {"EquationSimplification" -> "MassMatrix"} ];

Visualize real and imaginary parts of the result.

 In[2]:= XRow[{Plot3D[Re[uif[1, x, y]], {x, y} \[Element] \[CapitalOmega], PlotRange -> All, Boxed -> False, Axes -> None, PlotPoints -> 40, Mesh -> None], Plot3D[Im[uif[5, x, y]], {x, y} \[Element] \[CapitalOmega], PlotRange -> All, Boxed -> False, Axes -> None, PlotPoints -> 40, Mesh -> None]}]
 Out[2]=

## Mathematica

Questions? Comments? Contact a Wolfram expert »