ODE.jl icon indicating copy to clipboard operation
ODE.jl copied to clipboard

provide some examples

Open GaZ3ll3 opened this issue 10 years ago • 3 comments

I think some examples like following will benefits a lot for new users and also can be used for education purposes.

  1. Chemical reaction of Robertson(stiff problem)
  2. Elliptical Orbit w/ perturbation or 3-body And can provide multiple approaches, such as Runge-Kutta, and Sympletic method, even FMM are usually deployed.
  3. For mathematical standpoint, provide convergence plot, A-stable, and so on for Runge-Kutta(explicit, implicit), multistep method will be a lot of helpful for beginners' numerical study.

And when I ran the test.jl, I found the codes seemed are not optimized, while I found adding @inbounds to turn off bound check only can provide very limited boost.

GaZ3ll3 avatar Mar 05 '14 18:03 GaZ3ll3

I was actually thinking about adding some examples (and you can find some basic ones in #14 and #10). There is also (at least) one blog entry on the SIR model. However, I think we have to wait a little bit until the API is more stable.

What do you mean by "the codes seemed are not optimized" (compared to what)? There was a bug in ode45 (#15), which might have slowed down things. In #16 I added a very simple performance test, which you might want to try.

acroy avatar Mar 05 '14 18:03 acroy

@GaZ3ll3 Most of the code you see in this repository now is older than the @inbounds macro. That macro should also only be applied when you are absolutely certain that no input can possibly cause a BoundsError. It has to be done with care.

Also, there is an unfortunate syntax collision between github @ mentions and Julia macros. That means that you should wrap macros in backticks "`" so that you do not ping/email random people.

ivarne avatar Mar 05 '14 19:03 ivarne

@acroy Since this ODE.jl was for julia 0.2.0-, and I think there is a package called Devectorize (by Dahua Lin also for julia 0.2.0 -) which can work here. I can see there are some loops of vector operations in the code. But I haven't tested it yet. That package seemed deprecated long time ago.

@ivarne I ran @inbounds with for-loops on arrays for solvers ode45_dp, ode45_ck, ode45_fb, there is no significant improvement in performance, at most 5%... I will try to make a comparison with matlab and python w/o numpy/cython later. Has anyone run the comparison test for matlab/julia/python/c/c++/fortran/R?

GaZ3ll3 avatar Mar 05 '14 22:03 GaZ3ll3