Jorge, vector and matrix objects as described here are Sage constructions. Behind the scenes different packages might do the computations (such as numpy).
I don't know MATLAB, but here's a way to square every entry of a matrix ("process the data"). Might be an easier way that I don't know. sage: a=matrix(2,2,[[1,2],[3,4]]) sage: matrix(2, 2, map(lambda x: x^2, a.list())) [ 1 4] [ 9 16] Rob On Mar 24, 8:05 pm, calcp...@aol.com wrote: > Well, that was easy! So are these SAGE objects that you have to > construct? Its not clear where this code comes from. Is it a python > object, is it from maxima, gap, what? > > Still, these constructs do not preserve the matrix paradigm from > MATLAB. For example, in MATLAB you can pass a matrix as an input > parameter and process all the data in the matrix. I that like a List > object in python? I thought I read somewhere in the SAGE dox that this > was possible. I don't know why I'm thinking its a scipy thing. What > do you use scipy and numpy for? BTW, does SAGE use VPython? > > How about another sample: > OCTAVE INPUT FILE: > #!/usr/bin/octave -q > diary vector2.txt > > %vector2.m MrG 2010.0324 > %purpose: playing with the cross product > > %initialize 2 vectors in R^3 > a=[1 0 5] > b=[-2 1 0] > > %vector cross product > c=cross(a,b) > area=norm(c) > theta1=asin(area/norm(a)/norm(b)) > theta2=theta1*180/pi > > %scalar dot product > d=dot(a,b) > theta3=acos(d/norm(a)/norm(b)) > theta4=theta3*180/pi > > %triple scalar product > e=[1 1 1] > vol=abs(dot(e,c)) > > %vector dilation > f=2*a > g=-3*b > > OCTAVE OUTPUT FILE: > a = > > 1 0 5 > > b = > > -2 1 0 > > c = > > -5 -10 1 > > area = 11.225 > theta1 = 1.3945 > theta2 = 79.897 > d = -2 > theta3 = 1.7471 > theta4 = 100.10 > e = > > 1 1 1 > > vol = 14 > f = > > 2 0 10 > > g = > > 6 -3 -0 > > TIA, > A. Jorge Garciahttp://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 sage-...@googlegroups.com. To unsubscribe from this group, send email to sage-edu+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-edu?hl=en.