Skip to main content
added 49 characters in body
Source Link
xslittlegrass
  • 27.8k
  • 9
  • 102
  • 187

As in version 10.2, there is the NDEigensystem can be used to calculate the eigenstates and eigenvalues of a differential operator.

For example in the harmonic potential case, the even and odd eigen functions can be calculated seperatelyusing Neumann and Dirichlet boundary condition respectively:

{egnVal1, egnVec1} = 
  NDEigensystem[{-1/2 Laplacian[u[x], {x}] + 1/2 x^2 u[x]}, 
   u[x], {x, 0, 10}, 2];

{egnVal2, egnVec2} = 
  NDEigensystem[{-1/2 Laplacian[u[x], {x}] + 1/2 x^2 u[x], 
    DirichletCondition[u[x] == 0, True]}, u[x], {x, 0, 10}, 2];

And the eigenenergies are:

egnVal = Riffle[egnVal1, egnVal2]
(* {0.500079, 1.50054, 2.5019, 3.5047} *)

And the eigenstates are:

egnVec = Riffle[egnVec1, egnVec2];  
Plot[Evaluate[egnVec], {x, 0, 6}, PlotRange -> All]

enter image description here

which gives the correct wave functions apart from the arbitrary phases.

As in version 10.2, there is the NDEigensystem can be used to calculate the eigenstates and eigenvalues of a differential operator.

For example in the harmonic potential case, the even and odd eigen functions can be calculated seperately:

{egnVal1, egnVec1} = 
  NDEigensystem[{-1/2 Laplacian[u[x], {x}] + 1/2 x^2 u[x]}, 
   u[x], {x, 0, 10}, 2];

{egnVal2, egnVec2} = 
  NDEigensystem[{-1/2 Laplacian[u[x], {x}] + 1/2 x^2 u[x], 
    DirichletCondition[u[x] == 0, True]}, u[x], {x, 0, 10}, 2];

And the eigenenergies are:

egnVal = Riffle[egnVal1, egnVal2]
(* {0.500079, 1.50054, 2.5019, 3.5047} *)

And the eigenstates are:

egnVec = Riffle[egnVec1, egnVec2];  
Plot[Evaluate[egnVec], {x, 0, 6}, PlotRange -> All]

enter image description here

which gives the correct wave functions apart from the arbitrary phases.

As in version 10.2, there is the NDEigensystem can be used to calculate the eigenstates and eigenvalues of a differential operator.

For example in the harmonic potential case, the even and odd eigen functions can be calculated using Neumann and Dirichlet boundary condition respectively:

{egnVal1, egnVec1} = 
  NDEigensystem[{-1/2 Laplacian[u[x], {x}] + 1/2 x^2 u[x]}, 
   u[x], {x, 0, 10}, 2];

{egnVal2, egnVec2} = 
  NDEigensystem[{-1/2 Laplacian[u[x], {x}] + 1/2 x^2 u[x], 
    DirichletCondition[u[x] == 0, True]}, u[x], {x, 0, 10}, 2];

And the eigenenergies are:

egnVal = Riffle[egnVal1, egnVal2]
(* {0.500079, 1.50054, 2.5019, 3.5047} *)

And the eigenstates are:

egnVec = Riffle[egnVec1, egnVec2];  
Plot[Evaluate[egnVec], {x, 0, 6}, PlotRange -> All]

enter image description here

which gives the correct wave functions apart from the arbitrary phases.

Source Link
xslittlegrass
  • 27.8k
  • 9
  • 102
  • 187

As in version 10.2, there is the NDEigensystem can be used to calculate the eigenstates and eigenvalues of a differential operator.

For example in the harmonic potential case, the even and odd eigen functions can be calculated seperately:

{egnVal1, egnVec1} = 
  NDEigensystem[{-1/2 Laplacian[u[x], {x}] + 1/2 x^2 u[x]}, 
   u[x], {x, 0, 10}, 2];

{egnVal2, egnVec2} = 
  NDEigensystem[{-1/2 Laplacian[u[x], {x}] + 1/2 x^2 u[x], 
    DirichletCondition[u[x] == 0, True]}, u[x], {x, 0, 10}, 2];

And the eigenenergies are:

egnVal = Riffle[egnVal1, egnVal2]
(* {0.500079, 1.50054, 2.5019, 3.5047} *)

And the eigenstates are:

egnVec = Riffle[egnVec1, egnVec2];  
Plot[Evaluate[egnVec], {x, 0, 6}, PlotRange -> All]

enter image description here

which gives the correct wave functions apart from the arbitrary phases.