1

I have two "matrix" [X] = [X1,X2,...,Xn] and [T](Xi) = [Ti1,Ti2,...,Tim] with Xi and Tij are reals numbers. Xi describe the position of point X (one dimensional), [T](Xi) describe the velocity of Xi.

I want to create a double array A in Python so: A=A[Xi][Tj].

By example:

A[0][i] = [T](X1) = T1j = [T11,T12,...,T1m]

and

A[1][i] = [T](X2) = T2j = [T21,T22,...,T2m]

I tried:

tableA = [X,T]

but that does not work well.

4

2 回答 2

0

你的问题很难理解,但我认为你想要一个矩阵 A,其中 A 的行对应于 T 个向量?

那,你可以像这样创建:

x_vector = [x1, x2, x3, x4, x5, ...]
a_matrix = [t_matrix(X[i]) for i in range(len(X))]

然后,你会看到

>>> a_matrix[0][:]
[t11, t12, t13, ..., t1m]
>>> a_matrix[1][:]
[t21, t22, t23, ..., t2m]

ift_matrix是一个矩阵,其中第xi' 行是 的速度向量xi。现在a_matrix将是一个矩阵,其中i第 1 行是 的速度向量xi

于 2013-10-09T16:29:14.450 回答
0

请原谅我,因为我不确定我是否完全理解您的问题 - 但我得到的要点是您本质上想要 Python 中的二维数组?那么这个问题会有所帮助:

如何在python中定义二维数组

于 2013-10-09T16:15:52.620 回答