Commit 90c8217f authored by Pierre Navaro's avatar Pierre Navaro
Browse files

Update src/evaluate_hermite.jl

parent 76585aca
......@@ -23,19 +23,19 @@ function evaluate_hermite(xk, N, epsilon, gamma)
# Write the values of the first two Hermite functions to initialize the
# three-term recurrence
result[:,1] .= exp.(-0.5.*((gamma*xk).^2))
result[:,2] .= gamma*xk.*sqrt(2).*exp.(-0.5.*((gamma*xk).^2))
result[:,1] = exp.(-0.5.*((gamma*xk).^2))
result[:,2] = gamma*xk.*sqrt(2).*exp.(-0.5.*((gamma*xk).^2))
# Three term recurrence for the Hermite functions with argument gamma*x
for i = 3:N
result[:,i] .= sqrt(2.0/(i-1)) .* (gamma*xk) .* result[:,i-1] .- sqrt((i-2)/(i-1)) .* result[:,i-2]
result[:,i] = sqrt(2.0/(i-1)) .* (gamma*xk) .* result[:,i-1] .- sqrt((i-2)/(i-1)) .* result[:,i-2]
end
# Scaling the Hermite functions with the exponential factor
# exp(-epsilon^2 x^2 + (gamma x)^2/2)
for i=1:N
result[:,i] .= (pi^(1/4)) * result[:,i] .* exp.((xk.^2) .* (gamma*gamma*0.5 - epsilon^2))
result[:,i] = (pi^(1/4)) * result[:,i] .* exp.((xk.^2) .* (gamma*gamma*0.5 - epsilon^2))
end
result
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment