If you create an actual power series element, you can easily write the coefficients to a file:
sage: f = taylor(sin(x), x, 0, 10); f 1/362880*x^9 - 1/5040*x^7 + 1/120*x^5 - 1/6*x^3 + x sage: power_series = RR[['x']](f); power_series 0.000000000000000 + 1.00000000000000*x + 0.000000000000000*x^2 - 0.166666666666667*x^3 + 0.000000000000000*x^4 + 0.00833333333333333*x^5 + 0.000000000000000*x^6 - 0.000198412698412698*x^7 + 0.000000000000000*x^8 + 2.75573192239859e-6*x^9 sage: list(power_series) [0.000000000000000, 1.00000000000000, 0.000000000000000, -0.166666666666667, 0.000000000000000, 0.00833333333333333, 0.000000000000000, -0.000198412698412698, 0.000000000000000, 2.75573192239859e-6] sage: ",".join(str(a) for a in list(power_series)) '0.000000000000000,1.00000000000000,0.000000000000000,-0.166666666666667,0.000000000000000,0.00833333333333333,0.000000000000000,-0.000198412698412698,0.000000000000000,2.75573192239859e-6' sage: open("file.txt", "w").write("\n".join(str(a) for a in list(power_series))) sage: open("file.txt", "w").write("\n".join(str(a) for a in list(power_series))) sage: !cat file.txt 0.000000000000000 1.00000000000000 0.000000000000000 -0.166666666666667 0.000000000000000 0.00833333333333333 0.000000000000000 -0.000198412698412698 0.000000000000000 2.75573192239859e-6 Note that ZZ[[x]], QQ[[x]], RR[[x]] are *much* faster to compute with as well sage: R.<t> = PowerSeriesRing(ZZ, 't', 1000) sage: f = 1/(t+1) sage: f + O(t^10) # this is really O(t^1000), don't want to print it all 1 - t + t^2 - t^3 + t^4 - t^5 + t^6 - t^7 + t^8 - t^9 + O(t^10) sage: timeit("f^100") 25 loops, best of 3: 28.2 ms per loop - Robert On Tue, Dec 6, 2011 at 3:33 AM, Julie <juliewilliams...@googlemail.com> wrote: > Thank you very much to everyone for all your help. > I've now solved the issue I was having trouble with - the reason > finding the coefficients of the y terms didn't give me the required > results was because the generating function was really in terms of one > variable (p), not two, and required values to be substituted in for > y's rather than finding the various coefficients. > > Now I have completed this work, wondered if you knew the best way to > export the outputted coefficients by the internet version of sage to > another package such as Excel? Or indeed, if this is even possible? > > Many thanks, > Julie > > On Dec 3, 8:57 pm, Anton Sherwood <bro...@pobox.com> wrote: >> On 2011-12-02 08:17, Julie wrote:> Unfortunately, having the >> Tayorseriesapproach out, don't think it's >> > really appropriate for my problem afterall, as what I esentially need >> > to do is find the coefficientsof p^0*y^0, p, y, p^2*y etc in the >> > formula >> > (0.030*0.248244^y)y+0.05721*(0.248244^y)p +0.08838*(0.248244^y) >> >> > [...] >> >> Since this is not a polynomial in p and y, what does it mean to obtain >> thecoefficientsof p^j y^k *if not* those of something very similar to >> a Taylorseries? >> >> -- >> Anton Sherwood *\\*www.bendwavy.org*\\*www.zazzle.com/tamfang > > -- > 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 > URL: http://www.sagemath.org -- 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 URL: http://www.sagemath.org