Skip to content

Harmonic oscillator mass ignored  #64

Description

@jw3126

While playing with a harmonic oscillator, I encountered the following interesting behaviour.
Somehow DPRKN6 ignores my hard coded mass in the hamiltonian and gives a solution as if the mass was one:

using OrdinaryDiffEq
using DiffEqPhysics
using Plots

function H(p,q, param) 
    m = 1000 # very heavy object, should oscillate slowly
    k = 1.0
    1/2*p^2/m + 1/2*k*q^2
end

p0 = 0.0
q0 = 1.0
tspan = (0, 2pi)
prob = HamiltonianProblem(H, p0, q0, tspan)
alg = McAte5() # works
alg = Tsit5()  # works
alg = DPRKN6()
sol = solve(prob, alg)
plot(sol, fmt=:png)

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions