How about this?
SAMPLE OCTAVE INPUT FILE:
#!/usr/bin/octave -q
diary matrix1.txt
%matrix1.m MrG 2009.0527
%purpose: practice with matrix arithmetic
%initialize 2 matrices of dimension 2x2
a=[1 5;-1 2]
b=[-2 1;1 1]
%matrix sums
c=a+b
d=b-a
%matrix products
e=a*b
f=b*a
g=a**2
h=b**3
%matrix inverses
i=a**(-1)
j=b**(-1)
%matrix determinants
k=det(a)
l=det(b)
SAMPLE OCTAVE OUTPUT FILE:
a =
1 5
-1 2
b =
-2 1
1 1
c =
-1 6
0 3
d =
-3 -4
2 -1
e =
3 6
4 1
f =
-3 -8
0 7
g =
-4 15
-3 -1
h =
-11 4
4 1
i =
0.28571 -0.71429
0.14286 0.14286
j =
-0.33333 0.33333
0.33333 0.66667
k = 7
l = -3
HTH,
A. Jorge Garcia
http://calcpage.tripod.com
Teacher & Professor
Applied Mathematics, Physics & Computer Science
Baldwin Senior High School & Nassau Community College
--
You received this message because you are subscribed to the Google Groups
"sage-edu" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-edu?hl=en.