Questions tagged [ode]

An ODE (ordinary differential equation, in contrast to partial differential equation) is a differential equation containing a function or functions of exactly one independent variable.

An ODE (ordinary differential equation, in contrast to partial differential equation) is a differential equation containing a function or functions of exactly one independent variable. Equations of this type can be solved numerically or analytically.

1902 questions
6
votes
1 answer

fitting first order equation with nlme and lsoda

I a trying to fit a first order differential model using nlme and lsoda. Here is the basic idea: I first define the function allowing to generate the solution of the differential equation: library(deSolve) ODE1 <- function(time, x, parms)…
denis
  • 5,580
  • 1
  • 13
  • 40
6
votes
1 answer

Ordinary differential equations (ODEs) - Is there any way to prevent negative values?

I am trying to apply a system of ordinary differential equations (ODEs) at each spatial grid cell. Thus, each landscape cell has an associated ODE model. The number of susceptible mosquitoes (Sv), exposed mosquitoes (Se) and infected mosquitoes (St)…
Nell
  • 559
  • 4
  • 20
6
votes
1 answer

Modelica events and hybrid modelling

I would like to understand the general idea behind hybrid modelling (in particular state events) from a numerical point of view (although I am not a mathematician :)). Given the following Modelica model: model BouncingBall constant Real g=9.81 …
AssMero
  • 239
  • 1
  • 5
6
votes
3 answers

Change parameter values at time step in deSolve

I am trying to solve an ODE in R using deSolve. With the following code, I expected the parameter gamma0 takes the values 5 at time step 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 and 10, and 0 otherwise. However, the print(gamma0) shows that gamma0 stays at 0.…
Marine
  • 521
  • 1
  • 4
  • 23
6
votes
1 answer

Using a loop in an ODE to graphically compare different parameters R

I'm using the deSolve package to plot a couple differential equations (read if interested http://www.maa.org/press/periodicals/loci/joma/the-sir-model-for-spread-of-disease-the-differential-equation-model). My eventual goal is to create an…
EJJ
  • 1,474
  • 10
  • 17
6
votes
1 answer

Sympy second order ode

I have a homogeneous solution to a simple second-order ODE, which when I try to solve for initial values using Sympy, returns the same solution. It should substitute for y(0) and y'(0) and yield a solution without constants, but does not. Here is…
Time Lord
  • 331
  • 2
  • 5
  • 12
6
votes
1 answer

Using scipy.integrate.complex_ode instead of scipy.integrate.ode

I am trying to use complex_ode method instead of ode method in scipy.integrate. The help page for complex_ode does not provide example, so I may have done something wrong. This code works properly with scipy.integrate.ode: from scipy.integrate…
wmac
  • 1,023
  • 1
  • 16
  • 34
6
votes
1 answer

How to get SciPy.integrate.odeint to stop when path is closed?

edit: It's been five years, has SciPy.integrate.odeint learned to stop yet? The script below integrates magnetic field lines around closed paths and stops when it returns to original value within some tolerance, using Runge-Kutta RK4 in Python. I…
uhoh
  • 3,713
  • 6
  • 42
  • 95
6
votes
2 answers

Solve ode in python with complex matrix as initial value

I have a von Neumann equation which looks like: dr/dt = - i [H, r], where r and H are square matricies of complex numbers and I need to find r(t) using python script. Is there any standart instruments to integrate such equations? When I was solving…
krems
  • 749
  • 6
  • 14
6
votes
1 answer

How to solve ODEs with Java?

I'm trying to solve an ODE with Java and so far I have tried two different libraries. The one I trust the most is Apache Commons Math however even for simple problems I don't seem to get the correct solution. When I solve my system in Mathematica I…
C. E.
  • 10,297
  • 10
  • 53
  • 77
6
votes
1 answer

Python - Scipy : ode module : issue enabling the step option of the solver

I wanted to store the different integration steps taken by the solver itself when I call it : solver1.integrate(t_end) So I did a while loop and enabled the step option setting its value to True: while solver1.successful() and solver1.t < t0+dt: …
kuider
  • 103
  • 5
6
votes
1 answer

Matlab - solving a third order differential equation

y''' + 41y'' + 360y' + 900y = 600x' + 1200x; y(0)= 2 ; y'(0)= 1 ; y''(0) = -0.05 How can I solve this equation using the ODE45 function? I tried this: ==> function dydt=f(t,y) dydt = [y(2) ; y(3) ; -41*y(3)-360*y(2)- 900*y(1)] ==> clear…
ag.alessandro
  • 63
  • 1
  • 1
  • 6
6
votes
1 answer

Using scipy fft and ifft to solve ordinary differential equation numerically

I have an ordinary differential equation in time domain as follows: C*du/dt = -g*u + I where I = A*t/tau*exp^(1-t/tau) in the freq domain: u(w) = I(w)/(g*(1+C/g*j*w)) j being the complex number sqrt(-1) hence i can get u(t) by going into the freq…
user1854231
  • 61
  • 1
  • 2
6
votes
1 answer

How to solve ODEs with an internal threshold?

I have the following function containing some odes: myfunction <- function(t, state, parameters) { with(as.list(c(state, parameters)),{ if (X>20) { # this is an internal threshold! Y <- 35000 dY <- 0 …
Claudia
  • 996
  • 1
  • 10
  • 27
6
votes
2 answers

In search for a good Java ODE solver

I'm working on a project to create a GUI for an algorithm in MATLAB using an ODE solver (ode45). So I have to translate the MATLAB code to Java. The problem is the ode45 solver. Java does not seem to have a solver ready to use, and ODE's are not…
Sander
  • 591
  • 6
  • 16