Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using DifferentialEquations
- using LinearAlgebra
- σx = [0.0+0.0im 1.0; 1.0 0]
- function hfun(t)
- σx
- end
- function f(du, u, p, t)
- hmat = hfun(t)
- mul!(du, -1.0im*hmat, u)
- end
- function f_jac(J, u, p, t)
- hmat = hfun(t)
- mul!(J, -1.0im, hmat)
- end
- ff = ODEFunction(f;jac=f_jac)
- tspan = (0.0, 10.0)
- u0 = [1.0+0.0im, 0]
- prob = ODEProblem(ff, u0, tspan)
- sol = solve(prob,TRBDF2(),reltol=1e-8,abstol=1e-8)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement