Programming with Matrices Message #1 Posted by Han on 24 Sept 2013, 1:24 p.m.
Is there an easy way to (within a program) set M1 to the matrix:
[[ 1, 0 , 0], [0, COS(a), -SIN(a)], [0, SIN(a), COS(a)]]
At the top I have:
local a;
a:=30;
I tried using:
[[ 1, 0 , 0], [0, COS(a), -SIN(a)], [0, SIN(a), COS(a)]] -> M1;
which gives me a syntax error. Then I try:
M1:=[[ 1, 0 , 0], [0, COS(a), -SIN(a)], [0, SIN(a), COS(a)]];
and still get a syntax error. So finally I try:
M1:=expr("[[ 1, 0 , 0], [0, COS(a), -SIN(a)], [0, SIN(a), COS(a)]]");
still does not work -- no syntax error, but I get invalid input. What's going on? Is there no way to set M1 equal to a matrix? (Of course, convert "->" to the proper "store" symbol)
Edited: 24 Sept 2013, 1:27 p.m.
|