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 of 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 cooperates with many other libraries.

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

512 questions
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
  • 986
  • 2
  • 13
  • 19
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,796
  • 2
  • 21
  • 29
4
votes
2 answers

Bound an odeint variable

I'm using odeint to simulate a system wherein there are several variables which should not go less than zero. Is there an appropriate way to bound a variable in odeint to a particular range?
Richard
  • 56,349
  • 34
  • 180
  • 251
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
  • 56,349
  • 34
  • 180
  • 251
3
votes
1 answer

curve fitting to an ordinary differential equation

I want to fit a curve to the ODE shown below- dA/dt = k1*profit + k2 I have the observed time series of the variables A and profit and I would like to get the optimal values of k1 and k2 using a curve fitting technique in python. I am able to write…
lsr729
  • 752
  • 2
  • 11
  • 25
3
votes
1 answer

Scipy integrate: is solve_ivp "always worse" than odeint?

Analytical solution for an example ODE I was testing the difference between these methods by solving the following initial value problem: y'=2*y-t You can solve this analytically by considering that y(t) is a linear combination of a homogeneous…
Breno
  • 748
  • 8
  • 18
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
  • 707
  • 5
  • 13
3
votes
1 answer

Can you give a simple example of adaptive stepsize scipy.integrate.LSODA function?

I need to understand the mechanism of scipy.integrate.LSODA function. I have written a test script that integrate a simple function. According to the LSODA webpage inputs of functions can be rhs function, t_min, initial y and t_max. On the other…
3
votes
1 answer

How to pass only one argument to odeint?

I am trying to use scipy's odeint to solve some ordinary differential equations. The only problem is that I only want to define one argument, and it seems that to make a tuple, you need at least two values. My code looks like this: def…
Rui Nian
  • 2,544
  • 18
  • 32
3
votes
2 answers

Is boost odeint supporting dimensional analysis via Boost.Units?

I was trying to implement a simple ode to test whether boost.odeint is supporting the usage of boost.units. However my example is failing at compilation. Is it my code, or doesn't boost.odeint support boost.Units for dimensional…
Mojomoko
  • 471
  • 5
  • 12
3
votes
0 answers

How to change Function by without Changing its Parameters

I am new to python and in learning stages. I wanted to implement Particle Swarm Optimization(PSO) algorithm which I did by taking help from on-line materials and python tutorials. In PSO, a simple calculus problem is inferred i-e 100 * ((y - (x2))2)…
Usman YousafZai
  • 1,088
  • 4
  • 18
  • 44
3
votes
0 answers

Using Eigen::VectorXd (Eigen 3.3.4) as a state type in boost::numeric::odeint (Boost 1.65.1)

During my work, it would be a requirement for me to use Eigen::VectorXcd as state type, to solve a huge linear ODE system. In that project, the matrix in the ODE system is sparse. Multiplying a it with a dense vector can be computed in parallel in a…
3
votes
1 answer

scipy odeint result depends on input time array

I'm trying to solve the following one-dimensional ODE (2nd order) using the scipy odeint function: z'' = 2*F*cos(vt-kz)*(z*cos(vt-k*z) - k*(1+z^2)*sin(vt-kz))/(1+z^2)^2 And my python script is import numpy as np from scipy.integrate import…
fab088
  • 33
  • 2
3
votes
1 answer

ODEINT with multiple parameters (time-dependent)

I'm trying to solve a single first-order ODE using ODEINT. Following is the code. I expect to get 3 values of y for 3 time-points. The issue I'm struggling with is ability to pass nth value of mt and nt to calculate dydt. I think the ODEINT passes…
bluetooth
  • 529
  • 6
  • 20
3
votes
1 answer

passed parameters to boost odeint in C++

This answer is helpful, but I would like to know how to pass multiple parameters of different types to the ODE model, perhaps in a struct. For my immediate use case, I need to be able to pass one std::array, two…
Stephen
  • 71
  • 5
1 2
3
34 35