Questions tagged [odeint]

Odeint is a modern C++ library for numerically solving Ordinary Differential Equations.

Odeint is designed in a very flexible way such that the algorithms are completely independent from the underlying containers and even from the basic algebraic computations. That means odeint works not only with the standard containers like vector< double > or array< double , N > but also nicely coorperates with many other libraries.

Odeint can solve ODEs on GPUs by using nVidia's CUDA technology.

459 questions
4
votes
1 answer

role of get_unit_value in boost ODEINT

In the following code from Boost library: template struct get_unit_value_impl { static T value(const T &t) { return t; } typedef T result_type; }; ... template typename…
torbani
  • 85
  • 5
4
votes
3 answers

Calling another function overload

I am heading to understand odeint from c++ boost library and I need to know which part does what. In boost/numeric/odeint/integrate/integrate_adaptive.hpp, there is a function called integrate_adaptive. This function has a few overloads. The…
barej
  • 1,269
  • 2
  • 17
  • 50
4
votes
1 answer

Creating a controlled stepper in odeint using OpenMP

I try to construct an controlled stepper with boost::odeint using the openmp_range_algebra typedef vector< complex< double > > state_type; typedef runge_kutta_dopri5< state_type > error_stepper_type; typedef controlled_runge_kutta<…
Vergilius
  • 41
  • 2
4
votes
2 answers

Comparison of odeint's runge_kutta4 with Matlab's ode45

I would like to use runge_kutta4 method in the odeint C++ library. I've solved the problem in Matlab. My following code in Matlab to solve x'' = -x - g*x', with initial values x1 = 1, x2 = 0, is as follows main.m clear all clc t = 0:0.1:10; x0 = [1;…
CroCo
  • 4,982
  • 7
  • 47
  • 74
4
votes
1 answer

Solving Matrix Differential Equation in Python using Scipy/Numpy- NDSolve equivalent?

I have two numpy arrays: 9x9 and 9x1. I'd like to solve the differential equation at discrete time points, but am having trouble getting ODEInt to work. I do am unsure if I'm even doing the right thing. With Mathematica, the equation is: Solution =…
StuckOnDiffyQ
  • 119
  • 1
  • 5
4
votes
1 answer

Second order differential equation using C++ Boost odeint library

Using boost c++ odeint library, is it possible to solve a second order differential equation defined as follows ? m*x''[i] + x'[i] = K*\sum{j=1,N} sin(x[j] - x[i]), where i = 1,2,3..N. m = 1, K = 1 where initial value of x is an vector or array of…
ADK
  • 229
  • 2
  • 16
4
votes
1 answer

does boost odeint have a leapfrog algorithm?

I am using boost::odeint and so far I was using the runge_kutta4 stepper. Now I would like to switch to a leapfrog method, e.g. my iteration step should look like: f(t+dt) = f(t-dt) - p * f(t) So I need a multistep method, but I am a bit lost with…
user1304680
  • 550
  • 4
  • 15
4
votes
2 answers

odeint (c++) - downsample observations

Sorry if this is a simple question - but is there a "best practice" for downsampling the evolution of the state variables in odeint? Below, I've copied a nice example for building an "observer" to log the state variables provided in this article…
ahwillia
  • 2,869
  • 2
  • 17
  • 24
4
votes
2 answers

scipy odeint with complex initial values

I need to solve a complex-domain-defined ODE system, with complex initial values. scipy.integrate.odeint does not work on complex systems. I rod about cutting my system in real and imaginary part and solve separately, but my ODE system's rhs…
fmonegaglia
  • 2,508
  • 1
  • 22
  • 32
4
votes
1 answer

integrate_adaptive and integrate_times give different answers for negative step size

I'm using the odeint library in Boost. When using the integrate_adaptive function, the results are as expected. However, when using integrate_times, the ODE is evaluated at very different times that are outside the range of integration. This is a…
OSE
  • 906
  • 2
  • 12
  • 19
4
votes
1 answer

Halt scipy odeint on first error

Edit: This problem is due to a bug, fixed in Scipy 0.15 As I'm developing and testing code, I may make a simple error, like a NameError. When I use scipy.integrate.odeint, odeint will print the error message, but keep integrating for however many…
Alex Szatmary
  • 2,843
  • 3
  • 18
  • 27
4
votes
2 answers

Stop integration with odeint used with thrust

I'm trying to integrate a system of ODEs with the odeint library and thrust in parallel on a set of points (this means same ODE with many different initial conditions). In particular I'm using the adaptive step size algorithm…
Michele
  • 2,057
  • 2
  • 17
  • 25
4
votes
1 answer

Limit number of steps in boost::odeint integration

Say that I have the following boost::odeint code: #include #include #include using namespace std; using namespace boost::numeric::odeint; const double sigma = 10.0; const double R =…
Richard
  • 44,865
  • 24
  • 144
  • 216
3
votes
2 answers

Destructor calls during integration with boost odeint

If I integrate a system with boosts odeint module, using a class to define the derivative, the destructor of this class is called very often. Is this behavior intended? Why is it the case? What should I do if I want to allocate arrays dynamically…
TheIdealis
  • 515
  • 3
  • 10
3
votes
1 answer

Differences between two ODE solvers

I am wondering, what are the differences between ODEINT and solve_ivp for solving a differential equation. What could be advantages and disadvantages between them? f1 = solve_ivp(f, [0,1], y0) #y0 is the initial point f2 = odeint(f, y0, [0, 1],…
Ma Y
  • 654
  • 4
  • 16
1
2
3
30 31