cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Matrix Multiplication

LA_10815809
2-Explorer

Matrix Multiplication

J and Big Omega are 3x3 matrices. Little omega is a 3x1. Mathcad will not solve this with the matrices defined and gets the wrong answer with them undefined. Nu should be equal to (Omega)*J*(Little Omega). Any idea why this is happening?

(Mathcad Prime 9.0)

 

 

 

 

 

 

 

 

2 REPLIES 2
ttokoro
20-Turquoise
(To:LA_10815809)

image.png

Werner_E
25-Diamond I
(To:LA_10815809)


@LA_10815809 wrote:

J and Big Omega are 3x3 matrices. Little omega is a 3x1. Mathcad will not solve this with the matrices defined and gets the wrong answer with them undefined. Nu should be equal to (Omega)*J*(Little Omega). Any idea why this is happening?

 

 

 

 

 

 

 

 


Yes.

The symbolics unfortunately is not made for solving for vectors and matrices.

 

In the first two symbolic expressions your pic shows all used variables are treated and interpreted as scalars. J^-1 is seen as 1/J, not as the inverse of a matrix. The symbolic can't know that vectors and matrices are meant!

The result obtained just happens to be correct for matrices and vectors as well.

You can't rely on the results if you have matrices and vectors in mind instead of scalars!!
For example:

Werner_E_1-1697022418817.png

The given result is wrong twice if J and Omega are 3x3 matrices and omega is a 3x1 vector.

First the order of the result is wrong as we can't multiply a 3x1 vector with a 3x3 matrix, omega would have to be placed at the end to be the last factor.
And second we can't simplify J*Omega*J to Omega*J^2 because matrix multiplication is not commutative.

So its just by chance that the result given for your equation happens to be correct for the matrices as well.

 

In your last expression the same applies, but just concerning eta. eta is seen as a scalar variable and therefore  Primes symbolics throws the error about not matching array dimensions -> if eta would be a scalar, the first summand would be a 3x3 matrix but the second a 3x1 matrix/vector.
Here, a "more intelligent" symbolic engine could well conclude on its own that eta must be a 3x1 vector and give the corresponding solution.
But Prime needs the user's help here by clearly specifying a corresponding vector instead of eta.

And because Primes symbolics always outputs the result in rows  when solving for several variables, you also have to transpose the result yourself 😞

Werner_E_0-1697021783573.png

 

You could also use a numeric solve block instead of the symbolic "solve". Here you must provide a guess value for eta and so its of course also clear that a 3x1 vector is meant:

Werner_E_0-1697023256774.png

 

 

 

Announcements

Top Tags