<

Question: Constructing Matrix from Expression

Dear All

Please see following query:

 

 

 For following Algeraic expression

 

(3*a[1]+5*a[2])*U[1]+(-6*a[1]+2*a[2])*U[2]

 

How one can construct a matrix of the following form:

 

Matrix([[3, 5], [-6, 2]])

Matrix(2, 2, {(1, 1) = 3, (1, 2) = 5, (2, 1) = -6, (2, 2) = 2})

(1)

 

Where first row corresponds to U[1]and second row corresponds to U[2] and the entries of matrix are coefficients of a[1]and a[2]

 

 

Download Constructing_matrix_from_algebraic_expression.mw

Regards

Please Wait...