-1

我需要为未知数u4, f1, f2,f3和特定f5问题求解这个矩阵系统。我已经用我的输入生成了包含数字的矩阵,需要为这些已知数求解。f6FEA

  • 代码应如下所示:

    0 + 0 + 0 + 150*1000*u4 + 0 + 0 = −1732

所以,u4=-0.01154

  • 所以其他未知数可以找到如下:

    0 + 0 + 0 + (43:4)(−0:0115) 1000 + 0 + 0 = f1

因此f1=-500 等等....

我是初学者,熟悉 numpy 和 python OOP 的基础知识。请帮我为此设置一个代码。

待解矩阵

4

2 回答 2

1
In [0]: import numpy as np    

In [1]: A = np.random.rand(6,6)

In [2]: a4 = A[3,:]

In [3]: u4 = -1732/a4[3]

In [4]: f = a4*u4

In [5]: f
Out[5]: 
array([ -246.6101995 ,  -589.6732277 ,  -574.67690895, -1732.        ,
       -2592.99948033, -2383.52077134])

用您的数据替换A或至少第四列a4...

于 2013-04-06T09:12:20.293 回答
1

这里是:

from __future__ import division
from numpy import asarray as ar,sum as sums

A = ar([[25,-43.3,-25,43.3,0,0],
        [-43.3,75,43.3,-75,0,0],
        [-25,43.3,50,0,-25,-43.3],
        [43.3,-75,0,150,-43.3,-75],
        [0,0,-25,-43.3,25,43.3],
        [0,0,-43.3,-75,43.3,75]])*1e3
u4 = -0.01154
B = ar([0,0,0,u4,0,0])
F = sums(A*B,axis=1)

所以你将拥有:

>>> F
array([ -499.682,   865.5  ,     0.   , -1731.   ,   499.682,   865.5  ])
于 2013-04-06T10:37:16.373 回答