Easy. sage: M = random_matrix(RDF, 10, 2) # get your data sage: s = M.str().replace('[','').replace(']','') sage: print s # is this what you want? 0.103609743105 -0.00797973769955 -0.96222133551 -0.341208831103 -0.904012926167 -0.42972921542 -0.674427575692 0.338249515207 0.497150438999 -0.988927899669 -0.578398516046 -0.192384884874 0.00861554346264 -0.320551899607 -0.552324001368 -0.913964831699 -0.0933155483849 -0.0751049307458 -0.807644562118 -0.282818538055 sage: open("foo.txt", "w").write(s)
That's it. sage: !cat foo.txt 0.103609743105 -0.00797973769955 -0.96222133551 -0.341208831103 -0.904012926167 -0.42972921542 -0.674427575692 0.338249515207 0.497150438999 -0.988927899669 -0.578398516046 -0.192384884874 0.00861554346264 -0.320551899607 -0.552324001368 -0.913964831699 -0.0933155483849 -0.0751049307458 -0.807644562118 -0.282818538055 On Sep 5, 2009, at 1:36 PM, Afonso Henriques Silva Leite wrote: > I forgot to send you the result: the .dat file!!! > It is attached. One of which I generated with Mathematica. > And the corresponding graphic. > > On Fri, 2009-09-04 at 15:42 -0500, Jason Grout wrote: >> Afonso Henriques Silva Leite wrote: >>> Hi, everyone!!! >>> Does anybody had to generate and export a .dat file to create a >>> graphic >>> in another program like xmgrace, to use a more appropriate >>> program to >>> make graphics? >>> I used to do this in Mathematica: with a "for" loop to generate a >>> matrix >>> with the abscissa and coordinate points as elements, and then >>> printed it >>> as a .dat file. >>> It's possible to do something like this in sage? >> >> >> This is most likely very easy to do. >> >> Can you give a more specific example? Maybe a function and an >> example >> .dat file? (and maybe an example of the graph---maybe it's already >> possible to generate such a graph in Sage). >> >> Thanks, >> >> Jason >> >> >>> > > > > <pifdcaso1q103.dat><prfdcaso1.jpg> --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---