Ask Your Question
1

Displaying 1000 terms taylor series

asked 2022-11-29 18:09:13 +0200

yuukono gravatar image

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."

edit retag flag offensive close merge delete

Comments

Please 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?

John Palmieri gravatar imageJohn Palmieri ( 2022-11-29 23:28:27 +0200 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2022-11-30 00:08:35 +0200

Emmanuel Charpentier gravatar image

updated 2022-11-30 07:57:25 +0200

A 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,

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2022-11-29 18:09:13 +0200

Seen: 149 times

Last updated: Nov 30 '22