Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/315.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Odeintw Python的矩阵ODE_Python_Matrix_Ode - Fatal编程技术网

使用Odeintw Python的矩阵ODE

使用Odeintw Python的矩阵ODE,python,matrix,ode,Python,Matrix,Ode,我们得到的示例如下: def asys(a, t, c): return c.dot(a) c = np.array([[-0.5, -1.25], [ 0.5, -0.25]]) t = np.linspace(0, 10, 201) # a0 is the initial condition. a0 = np.array([[0.0, 2.0], [2.0, 3.0]]) # Call `odeintw`. sol = odei

我们得到的示例如下:

def asys(a, t, c):
return c.dot(a)

c = np.array([[-0.5, -1.25],
              [ 0.5, -0.25]])
t = np.linspace(0, 10, 201)

# a0 is the initial condition.
a0 = np.array([[0.0, 2.0],
               [2.0, 3.0]])

# Call `odeintw`.
sol = odeintw(asys, a0, t, args=(c,))
但是我想知道是否有可能解决一个与时间相关的
c
问题。对于它,编写如下(示例):


我想为每个
t
对应的
c
编写一个odeintw能够理解的函数。有人能帮我吗?

需要注意的主要一点是,ODE解算器将以任意值
t
计算函数
asys
。因此,您需要为
c
插入函数表。您必须检查现有插值函数是否可以处理多维数组。您可能需要一个变通方法或包装器,就像
odeintw
odeint
提供的那样


对于所展示的测试示例,这将非常糟糕(如果有的话)。随机数组将给出一个非常跳跃的函数表,而ODE解算器依赖于平滑的微分方程。非平滑行为会导致非常小的步长,从而导致非常多的函数求值。

随机数组只是一种示例
c = np.random.rand(201,2,2)