【问题标题】:How can one interpret the results from a solved system of ODEs using integrate.odeint?如何使用integrate.odeint 解释ODE 求解系统的结果?
【发布时间】:2016-03-01 01:59:05
【问题描述】:

我正在求解洛伦兹方程组(3 个常微分方程),我的代码如下。

from scipy.integrate import odeint
import numpy as np
from numpy import array, arange

def Lorentz(state,t):          #Define the function for the derivatives for each equation
    u = state[0]               
    v = state[1]
    w = state[2]               #Give each differential equation (u, v and w) a state.

    a = 5.0
    b = 0.9
    c = 8.2                    #Define the constants a, b and c.

    du = -a*(u - v)
    dv = c*u - v - u*w
    dw = -b*w + u*v            #Define the differential equations u, v and w.

    return [du, dv, dw]        #Return the set of differential equations that the function defines.

state0 = [0.0, 1.0, 2.0]       #Define the set of inition conditions for u, v and w, respectively.
t = arange(0.0, 10.0, 0.7)     #Solve the equations from t=0 to t=10.

print odeint(Lorentz, state0, t)

当我使用

运行代码时
t = arange(0.0, 10.0, arg)

我得到的结果数量取决于“arg”的值。如果我选择一个较大的值,我会得到少量的结果。对于任何高于 10.0 的值,这都会给出一个数组 [0.0, 1.0, 2.0]。

对于较低的值,数组中的行数会变大,但第一行保持不变。对于像 0.01 这样非常低的值,我会得到一大堆数字,第一行总是 [0.0, 1.0, 2.0]。

数组中的所有数字是多少?确定微分方程组的每个方程只有一个解吗?

【问题讨论】:

    标签: python scipy ode


    【解决方案1】:

    您知道 ODE 积分的结果是一个函数吗?

    k 行(以0 开头)对应于时间t[k] 的函数值。时间t[0] 的第一行包含初始值state0

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-20
      相关资源
      最近更新 更多