Skip to content

Instantly share code, notes, and snippets.

@stdray
Created May 22, 2016 15:56
Show Gist options
  • Save stdray/01c2a7d09ae385dc66efa9aded9c99a9 to your computer and use it in GitHub Desktop.
Save stdray/01c2a7d09ae385dc66efa9aded9c99a9 to your computer and use it in GitHub Desktop.
m_e = 9.10938356 * 10 .^-31;
E = 10;
alpha = 1;
from = 0;
to = 1000;
v0 = 0.5 .* 299792458;
p = m_e * v0;
w = @(x) { x .* exp(-alpha .* x) };
N2 = @(x) { integral(w, from, to) };
U = @(x) { 10 .* x };
Ham = @(x) { p .^ 2 / 2 .* m_e + U(x)};
J = @(x) { integral(@(x) { w(x) .* Ham(x) .* w(x) }, from, to) };
fun = @(x) { J(x) / N2(x) };
fplot(fun)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment