ode

Adapting initial-value problem to boundary-value problem using scipy.integrate.solve_bvp?

為{幸葍}努か 提交于 2020-04-18 06:32:15
问题 I would like to adapt an initial-value-problem (IVP) to a boundary-value-problem (BVP) using scipy.integrate.solve_bvp . A similar question was asked here, but I do not follow everything explained in the answer. The example below regarding the SIR model was taken from this website. Here, the initial condition y0 is taken to be the initial value of S , I , and R at time x0[0] . This system of ODEs is given by the function SIR below, which returns [dS/dt, dI/dt, dR/dt] over the interval from x

Adapting initial-value problem to boundary-value problem using scipy.integrate.solve_bvp?

≡放荡痞女 提交于 2020-04-18 06:32:12
问题 I would like to adapt an initial-value-problem (IVP) to a boundary-value-problem (BVP) using scipy.integrate.solve_bvp . A similar question was asked here, but I do not follow everything explained in the answer. The example below regarding the SIR model was taken from this website. Here, the initial condition y0 is taken to be the initial value of S , I , and R at time x0[0] . This system of ODEs is given by the function SIR below, which returns [dS/dt, dI/dt, dR/dt] over the interval from x

solve system of ODEs with read in external forcing

落爺英雄遲暮 提交于 2020-03-24 04:54:10
问题 In Julia, I want to solve a system of ODEs with external forcings g1(t), g2(t) like dx1(t) / dt = f1(x1, t) + g1(t) dx2(t) / dt = f2(x1, x2, t) + g2(t) with the forcings read in from a file. I am using this study to learn Julia and the package DifferentialEquations, but I am having difficulties finding the correct approach. I could imagine that using a callback could work, but that seems pretty cumbersome. Do you have an idea of how to implement such an external forcing? 回答1: You can use

solve system of ODEs with read in external forcing

大兔子大兔子 提交于 2020-03-24 04:53:54
问题 In Julia, I want to solve a system of ODEs with external forcings g1(t), g2(t) like dx1(t) / dt = f1(x1, t) + g1(t) dx2(t) / dt = f2(x1, x2, t) + g2(t) with the forcings read in from a file. I am using this study to learn Julia and the package DifferentialEquations, but I am having difficulties finding the correct approach. I could imagine that using a callback could work, but that seems pretty cumbersome. Do you have an idea of how to implement such an external forcing? 回答1: You can use

Two_body_problem: scipy.integrate.RK45 gives broadcasting error and scipy.integrate.LSODA never enters the twoBody function

*爱你&永不变心* 提交于 2020-02-23 03:53:17
问题 I'm working on a trajectory calculator for the Two Body Problem, and I'm attempting to use Scipy's RK45 or LSODA to solve the ODE and return the trajectory. (Please suggest another method if you think there's a better/easier way to do this) I'm using the Spyder IDE with Anaconda. Scipy version 1.1.0 THE PROBLEMS: RK45: When using RK45, the first step seems to work. When stepping through the code in the debugger, twoBody() is entered, and works exactly as expected the first run through.

Curve fitting to coupled ODEs

旧时模样 提交于 2020-02-05 07:12:07
问题 have a question on curve fitting / optimizing. I have three coupled ODEs that descibe a biochemical reaction with a disappearing substrate and two products being formed. I've found examples that have helped me create code to solve the ODEs (below). Now I want to optimize the unknown rate constants (k, k3 and k4) to fit to the experimental data, P, which is a signal from product y[1]. What would be the easiest way of doing this? Thanks. import numpy as np from scipy.integrate import odeint

Curve fitting to coupled ODEs

杀马特。学长 韩版系。学妹 提交于 2020-02-05 07:12:07
问题 have a question on curve fitting / optimizing. I have three coupled ODEs that descibe a biochemical reaction with a disappearing substrate and two products being formed. I've found examples that have helped me create code to solve the ODEs (below). Now I want to optimize the unknown rate constants (k, k3 and k4) to fit to the experimental data, P, which is a signal from product y[1]. What would be the easiest way of doing this? Thanks. import numpy as np from scipy.integrate import odeint

Solving differential equations in Matlab

孤街醉人 提交于 2020-01-25 00:19:13
问题 I need to solve these 2 differential equations simultaneously. dr^3/dt=(-3*D*Cs)/(ρ*r0^2 )*r*(1-C) dC/dt=((D*4π*r0*N*(1-C)*r)-(Af*C))/V Note: dr^3/dt is the derivative of r^3 with respect to t The two equations resemble the change in particle radius (r) and concentration (C) with time for a dissolution process of a microsuspension and its simultaneous absorption in the bloodstream. What is expected to happen as the solid dissolves, is that radius, r, will decrease and the concentration, C,

C++ program has stopped working- Solving ordinary differential equations

你离开我真会死。 提交于 2020-01-24 12:18:33
问题 I'm writing a C++ program to find solutions for first order differential equations for a college assignment. The program starts up and then once I enter the number of iterations to do I get the error message "Euler's method.exe has stopped working". This is my code: #include <functional> #include <vector> using namespace std; double f_r(double x, double r) { return r; } double f_s(double x, double s) { return -x/s; } double eulerstep(const function<double(double,double)>& f, double xsub0,

Generate DifferentialEquations ifrom a vector in Julia

你说的曾经没有我的故事 提交于 2020-01-16 08:40:34
问题 I have created a vector which concatenates strings of differential equations that are in the correct format to be used be the differeq ode sovler in Julia (i.e, f(du,u,p,t): Combine <- c("du[1] = - 1*0.4545*(u[1]^1) - 1*27000000*(u[4]^1)*(u[1]^1)", "du[2] = - 1*3100000000*(u[2]^1)*(u[4]^1)", "du[3] = - 1*33000*(u[3]^1)*(u[4]^1)", "du[4] =2*0.4545*(u[1]^1) - 1*3100000000*(u[2]^1)*(u[4]^1) - 1*33000*(u[3]^1)*(u[4]^1) - 1*27000000*(u[4]^1)*(u[1]^1) - 1*8500000*(u[4]^1)*(u[5]^1) - 1*390000000*(u