On 7/11/07, David Joyner <[EMAIL PROTECTED]> wrote:
> I'm trying to use sage to do some linear algebra (specifically,
> finding the equation to a plane, given 3 points in the plane).
>
> M=MatrixSpace(RR,3,1)
> N=MatrixSpace(RR,5,3)
>
> #Coordinates of the 3 points
> P1=M([[67.3,134.6,-10]])
> P2=M([[246.8,145.3,0.0]])
> P3=M([[189.0,34.4,15]])
>
> alpha=P2-P1
> beta=P3-P1
>
> x=M([[1.0,0.0,0.0]])
> y=M([[0.0,1.0,0.0]])
> z=M([[0.0,0.0,1.0]])
>
> # This should broduce a matrix of 5 rows x 3 columns (I think)
> mat=N([[x.transpose(),y.transpose(),z.transpose(),alpha.transpose(),beta.transpose()]])
>
> Exception (click to the left for traceback):
> ...
> TypeError: entries has the wrong length
>
> If someone could explain where I' going wrong, I'd be most grateful.

You could create mat using the following two commands:

v = sum([list(k.transpose()) for k in [x,y,z,alpha, beta]], [])
mat = N(v)

I've illustrated this here:

https://sage.math.washington.edu:8103/home/pub/1462/

By the way, you might want to use RDF instead of RR in this
case, since it's probably much faster and you likely don't need
arbitrary precision reals.   RDF is standard double precision
real number arithmetic.

 -- William

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to