On 7/27/07, David Joyner <[EMAIL PROTECTED]> wrote: > On 7/27/07, mak <[EMAIL PROTECTED]> wrote: > > > > 1. What's the most elegant way of writing a matrix into a file in > > pari-readable format? I can make it into a string, open a file, write > > the string, close the file. > > 2. How do I specify the directory where the file is saved? sage > > seems to not understand the path like '~/desiredpath/ > > desireddirectory', so I have to back up '../' 5-6 times from sage's > > default directory ('worksheets/_scratch_/cells/93/' or something like > > that)
Here's an example that saves a SAGE matrix to a pari matrix in the file ~/foo.gp: {{{id=0| m = random_matrix(QQ,5) }}} {{{id=1| home = os.environ['HOME'] open(home + '/mat.gp', 'w').write(m._pari_init_()) }}} {{{id=2| %gp \r /home/was/mat.gp /// [2 2 -1 1/2 2] [-2 0 0 -1/2 -1] [0 -1 -1 1 -2] [-2 1/2 1/2 -1 2] [-1 2 0 0 0] }}} > > > > > The file sage-env in sage*/local/bin shows that names such as > SAGE_ROOT are known to SAGE, so you can use it to help some. > You can also add any directory to that script that you want SAGE to know. > I've never had a problem using absolute paths. Possibly I'm not understanding > your question correctly? > > > > I'm sorry to bother people with basic questions like this, but the > > documentation is far too technical for the casual user, and not easily > > searchable either. > > > > Thanks, > > Mak > > > > > > > > > > > > > -- William Stein Associate Professor of Mathematics University of Washington http://www.williamstein.org --~--~---------~--~----~------------~-------~--~----~ 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/ -~----------~----~----~----~------~----~------~--~---