Is there any ODE solver in ROOT?

Good Day,

I am using ROOT 5.34/36 right now and I could not find any solver for ordinary differential equations. Is there any in the new ROOT version?
Maybe someone can suggest a way to solve ODE’s? (I was thinking of using something like MultiRootFinder)
If someone has a good tutorial or a hands-on, I appriciate it :slight_smile:

Thank you in advance

Hi, I’m not aware of anything in ROOT to integrate ODEs, but there is a nice GNU package called plotutils that is quite simple to use for this and should be easily available in most Linux distributions. Below is an example script showing how to use it:

#!/bin/bash

ode <<-EOF | graph -TX
sine' = cosine
cosine' = -sine
sine = 0
cosine = 1
print t, sine
step 0, 2*PI
EOF

The script above plots this on my screen:

May be @moneta knows about it.

Thank you for advice. I forgot to mention that I am using Windows. Is it also Winodws compatible?

Hi,

There is no ODE available in ROOT, but there is something in GSL, which is used by ROOT in the MathMore package. Looking on how the other GSL wrapper are implemented in MathMore, you can write similar code for ODE,

Lorenzo

Thank you @moneta for your comment. I was looking into GSL and there is an odeiv2 implemented. Unfortunetaly I was not able to include it into root and use the wrapper propperly. Do you know where I can find a good example to start with?
And a quick question to it, if I want to include a library into my macro (using c++ and roots cling/clang), can I still use #include “dir/header.h”, since I was not able to get it running with another library.

Hi ,

I don’t have an example, but looking at the code in math/mathmore/src could be helpful. There you include GSL files and you use in C++.
If you compile the code you need to add include PATH to GSL and link using the GSL library.
If you are at theROOT prompt you can also do:
gSystem->Load(“libgsl”)
#include <gsl/…h>

to have the functions available at the prompt

Lorenzo

@moneta I will try to make it work, thank you again for patience

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.