On Tue, Jan 12, 2010 at 11:48 AM, eliot brenner <[email protected]> wrote:
> I have a matrix "testmatrix" which lies in the following SAGE class:
>
> Full MatrixSpace of 12 by 12 dense matrices over Real Field with 500
> bits of precision
>
> I would like to find the eigenvectors of this matrix using for example
> PARI, with the command  mateigen.
>
> There is documentation in the SAGE tutorial about how to save and load
> PARI objects:
>
> http://www.sagemath.org/doc/tutorial/interactive_shell.html#saving-and-loading-individual-objects
>
> what I want to do is the converse of this: save a SAGE object (this
> matrix "testmatrix") in a format that can easily be read by PARI and
> understood as a matrix.  I am stuck because I don't see an easy way to
> do this.

If you have a matrix testmatrix (or any other object obj in Sage)
convert it to PARI by typing

    gp(testmatrix)

E.g.,

sage: a = random_matrix(RealField(100),3); a
[  0.69538280939260343035341643392  -0.15917547992613870679270647239
-0.24024492894447569239558134356]
[  0.28636565385766215433136676675   0.28325686243324115385618496334
0.79368639187204851074326475353]
[ -0.56616744234393870085017481842 -0.077903730476333193329728478817
-0.90405761680935058322501010659]
sage: gp.set_real_precision(40)  # decimal digits!
57
sage: b = gp(a); b
[0.6953828093926034303534164339189500000000,
-0.1591754799261387067927064723901100000000,
-0.2402449289444756923955813435622100000000;
0.2863656538576621543313667667462100000000,
0.2832568624332411538561849633388800000000,
0.7936863918720485107432647535337900000000;
-0.5661674423439387008501748184195900000000,
-0.07790373047633319332972847881711000000000,
-0.9040576168093505832250101065891200000000]
sage: b.mateigen()
[0.08166534562525296159679408427272359297803,
-1.218911609964693795203609265846138428081,
-2.945346055128633458986509737895989625762;
-0.6926757897038934840813517308920921715033,
-5.306825227219578480366160091782141323350,
-0.1019276424229397172184056763265644879578; 1, 1, 1]

>
> This may be more of a PARI, or general C-programming question, than a
> SAGE question per se.   But maybe there's a better way of
> accomplishing the task (finding the eigenvalues/vectors of a real
> matrix generated in SAGE) than I have thought of, using the resources
> in the SAGE distribution.
>
> I also see that there is a GP interface in SAGE, but from the
> reference manual, I was not able to figure out how to take a stored
> variable in SAGE (such as a SAGE matrix) and get GP to recognize it as
> a valid data type.
>
> Thanks,
> Eliot
>
> --
> 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-support
> URL: http://www.sagemath.org
>
>



-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org
-- 
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-support
URL: http://www.sagemath.org

Reply via email to