Reputation: 11
I want to use mathematica to solve a matrix equation, and i wrote the following code:
ClearAll
PAII = {{xx, yy, zz, ww}} // MatrixForm
PAII = Transpose[PAII] // MatrixForm
SMatrix = {{p - 1, q, 0, 0}, {p, -1, q, 0}, {0, p, -1, q}, {0, 0, p, q - 1}} // MatrixForm
PAII.SMatrix // MatrixForm
Solve[PAII.SMatrix = PAII, {xx, yy, zz, ww}] // MatrixForm
varibles PAII = {{xx yy zz ww}}
are what i want to solve
equation is PAII.SMatrix = PAII
And it shows the following errors:
It seems that the Transpose and dot product function does not work.
I do not know how to solve this problem. Asking for ur help!
I tried to write the matrix with actual values, and it does not show errors.
Upvotes: 0
Views: 460
Reputation: 3977
MatrixForm
makes a result that is pretty to look at, but cannot be used in calculations. It is possible to use ()
to show your pretty result and still be able to use the actual values for calculations
Mathematica internally handles some row versus column vectors.
Use ==
and not =
inside equations that are given to Solve
Try
(PAII = {xx, yy, zz, ww})//MatrixForm
(PAII = Transpose[PAII])//MatrixForm
(SMatrix = {{p-1,q,0,0},{p,-1,q,0},{0,p,-1,q},{0,0,p,q-1}})//MatrixForm
(PAII.SMatrix)//MatrixForm
(Solve[PAII.SMatrix == PAII, {xx, yy, zz, ww}])//MatrixForm
which returns the solution
{{xx -> 0, yy -> 0, zz -> 0, ww -> 0}}
and see if that provides the solution that you want.
Upvotes: 0