问题标签 [ode]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
8955 浏览

python - scipy.integrate.ode 与两个耦合的 ODE?

我目前正在尝试使用 SciPy 的 integration.ode 包来解决一对耦合的一阶 ODE:例如Lotka-Volterra 捕食者-猎物方程。但是,这意味着在集成循环期间,我必须在每次迭代时更新我发送给方法的参数,并且简单地跟踪先前的值并set_f_params()在每次迭代时调用似乎并不能解决问题。

我在每次迭代中设置的值set_f_params似乎并没有传播到回调方法,这并不令人惊讶,因为网络上的示例似乎都没有涉及传递给回调的“实时”变量,但这是我能想到的将这些值放入回调方法的唯一方法。

有人对如何使用 SciPy 对这些 ODE 进行数字积分有任何建议吗?

0 投票
1 回答
3856 浏览

matlab - (Matlab)如何根据参数绘制两个ODE的相图(不是图中的x(1),x(2))

亲爱的,我是一个关于动态系统项目的matlab新用户。我有两个方程,其中 T0、epsilon (E)、a 是固定的。我想看看分别在 (0, 4) 和 (0, 100) 的范围内选择 b 和 c 时的噬菌体图。在图中,区域 I 表示不稳定的极限环,区域 II 表示单稳态,区域 II 表示双稳态。

事实上,我认为我可以通过首先在 b、c 噬菌体中任意选择一个点,然后计算 x1 和 x2 的对应值,使 ODE 的左侧部分等于 0 来绘制图形。然后计算右边部分的雅可比矩阵,判断该矩阵是否为egenvalue。如果大于零,则系统不稳定。

结果应该如下图所示。

但我真的不知道如何确定图形分界线上的点。请提出你有用的建议。提前致谢。

PS: T0 = 0.1,ε = 0.1 a = 0.1 0 <= b <= 4.0;0 <= c <= 100;

PP.S:图表和方程摘自http://www.ncbi.nlm.nih.gov/pmc/articles/PMC2527901/(第二部分:生化振荡网络的景观和通量)

等式一

等式二

噬菌体图

我当前的解决方案应该如下,但我不能 cat J. %Condition:

%(1) F1 = F2 = 0 (2) 雅可比 = 0

%目标:

%获得b和c的非线性方程;

a = 0.1; ε = 0.1; T0 = 5.0;

%使用符号计算

syms xybc

F = [((epslion ^ 2 + x ^ 2 ) / ( 1 + x ^ 2) ) / (1 + y) - a * x; b / T0 - y / ( T0 * (1 + c * x ^ 2) )]; V = [x, y];

%计算雅可比矩阵

J = 雅可比 (F, V);

%ODE 的符号解:

%分别写方程

S1 = dsolve ('Dx = ((epslion ^ 2 + x ^ 2 ) / ( 1 + x ^ 2) ) / (1 + y) - a * x'); S2 = dsolve ('Dy = b / T0 - y / ( T0 * (1 + c * x ^ 2) )');

BC_cal = [J(1) J(2) S1 S2]; *%%%错误,不能加入S1,因为S1 = solve(sum)****,不能计算?*

fsolve(BC_cal);

0 投票
1 回答
179 浏览

plot - Maple ODE 求解,Graphic 不完整。为什么?

所以我们尝试解决简单的 ODE。我们使用教科书(警告 - 俄语)。这是本书(第 18 页)中作为示例提供的代码:

此代码应绘制:在此处输入图像描述

但是枫为我输出了这个:在此处输入图像描述

1)为什么它只解决四分之一的功能?

2)如何解决让它看起来像书中的样子?

0 投票
3 回答
3518 浏览

python - 使用 Python 绘制 ODE、等倾线

我正在寻找一个 Python 包,它允许我绘制类似于下面看到的 Java 小程序的东西:

http://math.mit.edu/mathlets/mathlets/isoclines/

有谁知道这方面的任何 ODE 绘图包?我可以使用 Numpy、Matplotlib 从头开始​​编写代码,但我想先问问周围的人。

谢谢,

0 投票
1 回答
4626 浏览

c++ - 向量比双倍快*:为什么?

这是我尝试使用std::vector<double>和使用普通 old的循环double*

对于 1000 万个元素,矢量版本始终在该double*版本所用时间的 80% 左右运行;对于 的几乎任何值N,vector 都明显更快。

看看 GCC STL 源代码,我看不出它std::vector做的事情本质上比double*惯用语正在做的事情更精彩(即,用普通的 old 进行分配new[]operator[]取消引用偏移量)。 这个问题也说明了这一点。

任何想法为什么矢量版本更快?

如果我使用 icpc 11.1 或在 Xeon 上运行,结果在质量上是相同的。此外,矢量化器转储表示只有std::vector的构造函数中的填充操作被矢量化。

矢量版:

double*版本:

rkck_params.h

util.h

0 投票
1 回答
2064 浏览

matlab - How to add white noise process term for a couple of ODEs, assuming the Gaussian distribution?

This question has already confused me several days. While I referred to senior students, they also cannot give a reply.

We have ten ODEs, into which each a noise term should be added. The noise is defined as follows. since I always find that I cannot upload a picture, the formula below maybe not very clear. In order to understand, you can either read my explanation or go the this address: Plos one. You could find the description of the equations directly above the Support Information in this address

  1. The white noise term epislon_i(t) is assumed with Gaussian distribution. epislon_i(t) means that for equation i, and at t timepoint, the value of the noise.
  2. the auto-correlation of noise are given:

(EQ.1) eq1

where delta(t) is the Dirac delta function and the diffusion matrix D is defined by

(EQ.2) eq2

Our problem focuses on how to explain the Dirac delta function in the diffusion matrix. Since the property of Dirac delta function is delta(0) = Inf and delta(t) = 0 if t neq 0, we don't know how to calculate the epislonif we try to sqrt of 2D(x, t)delta(t-t'). So we simply assume that delta(0) = 1 and delta(t) = 0 if t neq 0; But we don't know whether or not this is right. Could you please tell me how to use Delta function of diffusion equation in MATLAB?

This question associates with the stochastic process in MATLAB. So we review different stochastic process to inspire our ideas. In MATLAB, the Wienner process is often defined as a = sqrt(dt) * rand(1, N). N is the number of steps, dt is the length of the steps. Correspondingly, the Brownian motion can be defined as: b = cumsum(a); All of these associate with stochastic process. However, they doesn't related to the white noise process which has a constraints on the matrix of auto-correlation, noted by D.

Then we consider that, we may simply use randn(1, 10) to generate a vector representing the noise. However, since the definition of the noise must satisfy the equation (2), this cannot enable noise term in different equation have the predefined partial correlation (D_ij). Then we try to use mvnrnd to generate a multiple variable normal distribution at each time step. Unfortunately, the function mvnrnd in MATLAB return a matrix. But we need to return a vector of length 10.

We are rather confused, so could you please give me just a light? Thanks so much!

0 投票
1 回答
262 浏览

sage - 最大值的 ode 求解器

我下载并安装了 sage,因为我需要一个 ODE 求解器。我认为 Maxima 在该部分相对受限,因为它似乎无法解决几乎基本的 ODE。我感谢为该项目付出的所有努力,但我真的可以使用一个更强大的求解器。还有其他免费的替代品吗?Axiom 包呢?提前致谢。

0 投票
2 回答
14560 浏览

c++ - 是否有用于常微分方程 (ODE) 求解器的 c++ 库?

更具体地说,我对基于 Runge-Kutta 和刚性方程的 8 阶 Dormand-Prince 嵌入式方法感兴趣。

我使用 Numerical Recipes 3,但我经常无法编译他们的库。我想知道替代方案。

0 投票
2 回答
417 浏览

numerical-methods - 什么 ODE 求解器使用步进函数中的计算进行插值?

我对具有不同初始条件的 ODE 的多个解进行平均,因此所有解同时具有值​​很重要;例如,增量为 0.01。

我一直在使用数值配方 3 (nr3) 中的 ODE 例程。他们进行自适应尺寸步长并使用计算值进行相同的插值顺序。我不能使用它们,因为它们与 boost 冲突。还有其他类似的套路吗?

我查看了 GSL,它非常好,但它没有内置插值。我可以做到的一种方法是使用自适应大小求解 ODE,而不是运行 Akima 插值。但似乎 nr3 解决方案会更快、更准确。

0 投票
1 回答
13123 浏览

function - Matlab ode45。如何在调用时更改其中的参数?

我是 Matlab 的新手。我希望你能帮助我。我必须使用 ODE45 函数解决 ODE 系统。这是描述我的方程式的函数。

注意参数 F。

然后,在我的脚本 .m 文件中,我在“for 循环”中调用 ode45 函数。在每次迭代期间,我必须更改参数 F 并将其传递给我的“rateEquations” - 函数。但我不知道如何实现它。

在调用 ODE45 F 之前要更改。

等等 ...

提前致谢。