odeint

Scipy solve_ivp vs odeint

ⅰ亾dé卋堺 提交于 2021-02-11 16:59:51
问题 I have a large system of differential equations I am trying to solve. I get the same results using scipy.odeint and scipy.solve_ivp , however the former is ~17 times faster in my case. I read that solve_ivp is recommended for initial value problems, but can't find more on why I can't use odeint (when it's giving me the same results). Do I need to use solve_ivp when I am getting the same results as from odeint ? When would I use one vs the other? Thanks. 来源: https://stackoverflow.com/questions

Scipy solve_ivp vs odeint

隐身守侯 提交于 2021-02-11 16:58:48
问题 I have a large system of differential equations I am trying to solve. I get the same results using scipy.odeint and scipy.solve_ivp , however the former is ~17 times faster in my case. I read that solve_ivp is recommended for initial value problems, but can't find more on why I can't use odeint (when it's giving me the same results). Do I need to use solve_ivp when I am getting the same results as from odeint ? When would I use one vs the other? Thanks. 来源: https://stackoverflow.com/questions

Eigen Vector3d as state vector with odeint's symplectic_rkn_sb3a_mclachlan

岁酱吖の 提交于 2021-02-11 08:42:44
问题 I'm implementing an n-body simulation by defining individual "particles" with variable (particle to particle, time independent) properties that affect the dynamics, and then defining a "System" of these particles as a vector which defines various operations on them including time evolution of the System by iterating over the vector: symplectic_rkn_sb3a_mclachlan <Vector3d> rkn; class Particle { public: // state.first - position, state.second - velocity std::pair <Vector3d, Vector3d> state; //

Eigen Vector3d as state vector with odeint's symplectic_rkn_sb3a_mclachlan

≡放荡痞女 提交于 2021-02-11 08:42:26
问题 I'm implementing an n-body simulation by defining individual "particles" with variable (particle to particle, time independent) properties that affect the dynamics, and then defining a "System" of these particles as a vector which defines various operations on them including time evolution of the System by iterating over the vector: symplectic_rkn_sb3a_mclachlan <Vector3d> rkn; class Particle { public: // state.first - position, state.second - velocity std::pair <Vector3d, Vector3d> state; //

How to monitor the process of SciPy.odeint?

拜拜、爱过 提交于 2021-02-08 07:21:27
问题 SciPy can solve ode equations by scipy.integrate.odeint or other packages, but it gives result after the function has been solved completely. However, if the ode function is very complex, the program will take a lot of time(one or two days) to give the whole result. So how can I mointor the step it solve the equations(print out result when the equation hasn't been solved completely)? 回答1: You could split the integration domain and integrate the segments, taking the last value of the previous

How to monitor the process of SciPy.odeint?

有些话、适合烂在心里 提交于 2021-02-08 07:20:27
问题 SciPy can solve ode equations by scipy.integrate.odeint or other packages, but it gives result after the function has been solved completely. However, if the ode function is very complex, the program will take a lot of time(one or two days) to give the whole result. So how can I mointor the step it solve the equations(print out result when the equation hasn't been solved completely)? 回答1: You could split the integration domain and integrate the segments, taking the last value of the previous

Does the order of the equations in a coupled OIDENT solver matter?

我与影子孤独终老i 提交于 2021-02-05 10:39:32
问题 My code runs, however, if i change the order of the equations defined in my formula my graphs changes as well. Can somebody tell me why this is? Now i do not know what the right graph is from this system. def myFunction(r,t): g = 9.81 L_L = 20 #draught L_r = 20 #draught L_d = 4 #ukc u_s = 0.08 w_d = 60 #width vessel rho = 1030 b_R = 1.0 b_L = 1.0 b_D = 1.0 A_s = 340*L_L M_s = 40000*10^3 w_L = r[0] w_r = r[1] u_1 = r[2] u_2 = r[3] u_3 = r[4] u_4 = r[5] u_d = r[6] p_1 = r[7] p_2 = r[8] p_3 = r

Does the order of the equations in a coupled OIDENT solver matter?

試著忘記壹切 提交于 2021-02-05 10:39:22
问题 My code runs, however, if i change the order of the equations defined in my formula my graphs changes as well. Can somebody tell me why this is? Now i do not know what the right graph is from this system. def myFunction(r,t): g = 9.81 L_L = 20 #draught L_r = 20 #draught L_d = 4 #ukc u_s = 0.08 w_d = 60 #width vessel rho = 1030 b_R = 1.0 b_L = 1.0 b_D = 1.0 A_s = 340*L_L M_s = 40000*10^3 w_L = r[0] w_r = r[1] u_1 = r[2] u_2 = r[3] u_3 = r[4] u_4 = r[5] u_d = r[6] p_1 = r[7] p_2 = r[8] p_3 = r

Does the order of the equations in a coupled OIDENT solver matter?

为君一笑 提交于 2021-02-05 10:39:18
问题 My code runs, however, if i change the order of the equations defined in my formula my graphs changes as well. Can somebody tell me why this is? Now i do not know what the right graph is from this system. def myFunction(r,t): g = 9.81 L_L = 20 #draught L_r = 20 #draught L_d = 4 #ukc u_s = 0.08 w_d = 60 #width vessel rho = 1030 b_R = 1.0 b_L = 1.0 b_D = 1.0 A_s = 340*L_L M_s = 40000*10^3 w_L = r[0] w_r = r[1] u_1 = r[2] u_2 = r[3] u_3 = r[4] u_4 = r[5] u_d = r[6] p_1 = r[7] p_2 = r[8] p_3 = r

Differences between two ODE solvers

流过昼夜 提交于 2021-01-27 11:28:13
问题 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], args=(a, b)) # a and b are arguments of function f Thank you 回答1: Well the main difference is the following: odeint came first and is uses lsoda from the FORTRAN package odepack to solve ODEs. solve_ivp is a more general solution that lets use decide