Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

DEMO: Variational Method

Open in Colab
Source

Harmonic Oscillator

Write functions to compute matrix elements

<Figure size 960x720 with 1 Axes>

Test for numerical accuracy

1.0
0.49999949990084447

Solve eigenvalue problem

Ground-State Energy: 0.6102313319882994
Ground-State Wavefunction Coefficients: [ 0.33492713 -0.97644553]

Visualize Eigenfunctions and eigenvalues

<Figure size 960x720 with 2 Axes>