1,984 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
4
votes
1
answer
237
views
The same code runs on MATLAB but in R it is unstable
I am using spectral method to solve an ordinary differential equation.
The following R code and the MATLAB code are completely the same.
But the R code gets explode (the u value it solved would become ...
1
vote
0
answers
114
views
TypeError: 'Symbol' object cannot be interpreted as an integer, when using x**k in differential equation
Any idea why dsolve in sympy 1.14 when given this ode Eq(x**a * y(x) + Derivative(y(x), (x, 2)),0) gives error TypeError: 'Symbol' object cannot be interpreted as an integer
code
from sympy import *
x ...
Nasser's user avatar
- 13.3k
2
votes
2
answers
187
views
How to implement Paris’ law crack growth simulation in Python?
I am trying to model a fatigue crack growth in Python using Paris’ law :
da / dN = C ( DeltaK ) ^ m
where :
a = crack length
N = load cycles
C, m = material constants
( DeltaK ) = Y.( DeltaSigma ).( ...
0
votes
0
answers
124
views
How to apply the method of lines (MOL) with scipy odeint function with Danckwerts boundary conditions?
I am trying to solve a convection-diffusion-reaction problem for a tubular reactor. The reaction governing the process is as follows:
The method I chose to solve it is the line method, which consists ...
2
votes
2
answers
118
views
Differentiating OdeSolution object
I would like to compute the residual of the numerical solution to an ordinary differential equation.
Here is the code
import numpy as np
from scipy.integrate import solve_ivp
def f(t, x):
return ...
2
votes
0
answers
66
views
Implementation of Implicit Runge–Kutta
I’ve written a MATLAB implementation of an implicit Runge–Kutta method (Radau IIA). It behaves well on most test problems, but it refuses to converge on the following very stiff equation like
y' = y^2 ...
1
vote
2
answers
63
views
Adding a Legend to each plot output using plot.deSolve and legend
I am trying to add a legend to each plot output of the ccl4model(ODE model) in the deSolve package using plot.deSolve and the legend method but it only appears on the last plot output of the model. I ...
0
votes
1
answer
91
views
Follow up: building a for-loop to run ODE simulation through different parameter sets in R
I ended up trying to build a for-loop to achieve my end goal (running an ODE function modeling disease transmission through different scenarios/parameter sets in the most transparent way possible) but ...
0
votes
0
answers
29
views
Error in ode45 and 'Events' of a Satellite Tracking Radar Model (MATLAB)
I'm trying to simulate a satellite tracker. With ode45 I have de state of the satellite for each time and then convert position to Azimuth-Elevation local coordinates. If the object enters in the ...
1
vote
2
answers
126
views
graphing nonlinear systems of ODEs in python
the model Im trying to graph this model however I am just not sure whether my code is leading me to a reasonable solution:
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate ...
0
votes
1
answer
56
views
Plotting multiple plots for different initial conditions in one graph
I am using the following code. How can I plot time (x-axis) vs C_WT (y-axis) line plots for different C_WT values as in vectorC_WT in a single graph in R ?
kon_WT = 1
koff_WT = 10
R_WT = 20
...
3
votes
2
answers
102
views
How to loop differential equations through multiple parameter sets in R?
I'm modeling the spread of an infectious disease in R, and I need to loop the model through multiple sets of parameters. I have a working model so far (a dummy version is below), but only for a single ...
1
vote
1
answer
90
views
Unexplained gain in my code when solving coupled differential equations using solve_ivp() in python
I am trying to solve two coupled differential equations in python using the solve:ivp() function from scipy.integrate but I get an unexplained gain on one of my terms that breaks the equation. It is ...
0
votes
1
answer
37
views
Parameter that has been provided "undefined"
I composed the following ODE file:
function [dndt,dmdt,dhdt,dVdt]=hh(n,m,h,V)
C=1; GK=36; GNa=120; GL=0.3; EK=-72; ENa=55; EL=-49.4;
dndt=(1-n)*alphan(V)-n*betan(V);
dmdt=(1-m)*alpham(V)-m*...
0
votes
1
answer
67
views
Solving a system of ODEs using sympy
Let us consider the following code:
import sympy as sy
import scipy as sc
from sympy.physics.units.quantities import Quantity
from sympy.solvers.ode.systems import dsolve_system
from IPython.display ...