Closed sdwfrost closed 2 years ago
Reconfiguring the digits
keyword works out for me:
# As above...
res_koopman = solve(dd_prob, Ψ, DMDPINV(), digits = 2)
sys_koopman = result(res_koopman)
println(sys_koopman)
println(parameters(res_koopman))
Gives:
Model ##Koopman#309 with 3 equations
States : u[1](t) u[2](t) u[3](t)
Parameters : p₁ p₂ p₃ p₄
Independent variable: t
Equations
Differential(t)(u[1](t)) = p₁*u[1](t)*u[2](t)
Differential(t)(u[2](t)) = p₂*u[2](t) + p₃*u[1](t)*u[2](t)
Differential(t)(u[3](t)) = p₄*u[2](t)
[-0.5, -0.25, 0.5, 0.25]
Which is very nice 😄 . May I take this example for future docs and presentations ?
Thanks @AlCap23! Perhaps my issue should be that digits
does not work with SINDy - running solve(dd_prob, Ψ, STLSQ(),digits=1)
DOES give the results to the (correct) 2 significant digits.
Please, feel free to use this example! I'll post a full example at http://github.com/epirecipes/sir-julia soon.
This is from this post on Discourse. The code is cut and paste below - Koopman inference gives the wrong result, while SINDy works fine.
The above gives:
p₂ and p₄ should be -0.25 and 0.25, which is what I get with SINDy.