ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 30 Nov 2022 00:08:35 +0100Displaying 1000 terms taylor serieshttps://ask.sagemath.org/question/65115/displaying-1000-terms-taylor-series/ Hi,
I am trying to print up to 1000 terms of a Taylor series but my output either bleeds together or shows as a continuous line of numbers rather than separate fractions.
f = (x/sqrt(x^2-6*x+13));f
taylor(f,x,4,500)
My output comes out as "fetch additional output" and the result is this:
$\displaystyle \frac{79854682306522793194207787155926275411329758659461959227239100374575221031860704963210424694213147821527965196776756030407420591783729164672959605324317617935505546915704931}{305493636349960468205197939321361769978940274057232666389361390928129162652472045770185723510801522825687515269359046715531785342780428396973513311420091788963072442053377285222203558881953188370081650866793
And it goes on like this. Any tips or pointers?
When I try 1000 terms it just gives me this error: "WARNING: 1 intermediate output message was discarded."Tue, 29 Nov 2022 18:09:13 +0100https://ask.sagemath.org/question/65115/displaying-1000-terms-taylor-series/Comment by John Palmieri for <p>Hi,</p>
<p>I am trying to print up to 1000 terms of a Taylor series but my output either bleeds together or shows as a continuous line of numbers rather than separate fractions.</p>
<p>f = (x/sqrt(x^2-6*x+13));f
taylor(f,x,4,500)</p>
<p>My output comes out as "fetch additional output" and the result is this:
$\displaystyle \frac{79854682306522793194207787155926275411329758659461959227239100374575221031860704963210424694213147821527965196776756030407420591783729164672959605324317617935505546915704931}{305493636349960468205197939321361769978940274057232666389361390928129162652472045770185723510801522825687515269359046715531785342780428396973513311420091788963072442053377285222203558881953188370081650866793</p>
<p>And it goes on like this. Any tips or pointers?
When I try 1000 terms it just gives me this error: "WARNING: 1 intermediate output message was discarded."</p>
https://ask.sagemath.org/question/65115/displaying-1000-terms-taylor-series/?comment=65117#post-id-65117Please provide more information: is this from the command-line, the notebook, CoCalc, SageCell? `taylor(f, x, 4, 1000)` works for me from the command line and the notebook. What are you doing to get LaTeX output?Tue, 29 Nov 2022 23:28:27 +0100https://ask.sagemath.org/question/65115/displaying-1000-terms-taylor-series/?comment=65117#post-id-65117Answer by Emmanuel Charpentier for <p>Hi,</p>
<p>I am trying to print up to 1000 terms of a Taylor series but my output either bleeds together or shows as a continuous line of numbers rather than separate fractions.</p>
<p>f = (x/sqrt(x^2-6*x+13));f
taylor(f,x,4,500)</p>
<p>My output comes out as "fetch additional output" and the result is this:
$\displaystyle \frac{79854682306522793194207787155926275411329758659461959227239100374575221031860704963210424694213147821527965196776756030407420591783729164672959605324317617935505546915704931}{305493636349960468205197939321361769978940274057232666389361390928129162652472045770185723510801522825687515269359046715531785342780428396973513311420091788963072442053377285222203558881953188370081650866793</p>
<p>And it goes on like this. Any tips or pointers?
When I try 1000 terms it just gives me this error: "WARNING: 1 intermediate output message was discarded."</p>
https://ask.sagemath.org/question/65115/displaying-1000-terms-taylor-series/?answer=65118#post-id-65118A trivial, brute-force solution to get a Latex expression of this series :
# The function
sage: f=(x/sqrt(x^2-6*x+13))
Its requested Taylor series
sage: %time s=f.taylor(x,4,1000)
CPU times: user 5.57 s, sys: 11.9 ms, total: 5.58 s
Wall time: 5.29 s
# Latex each ot its terms
sage: %time t=list(map(lambda u:str(latex(u)), reversed(s.operands())))
CPU times: user 59.2 ms, sys: 83 µs, total: 59.3 ms
Wall time: 59.3 ms
# Latex of the series
sage: %time p = " + ".join(t)
CPU times: user 127 µs, sys: 0 ns, total: 127 µs
Wall time: 133 µs
which I won't try to print since it would require about
sage: ceil(len(p)/35/60)
274
274 pages typeset at 60 characters per line on 35 lines per page.
Note that the result you'll get will express the development in terms of powers of $x-4$ ; if you need it in terms of $x$, try the same trick on `se = s.expand()`. This will tell you that the $x^{1000}$ coefficient is about $1.3\cdot10^{-352}$.
What are you trying to do ? Frighten the horses ?
HTH,Wed, 30 Nov 2022 00:08:35 +0100https://ask.sagemath.org/question/65115/displaying-1000-terms-taylor-series/?answer=65118#post-id-65118