• No results found

Displaying long expressions

N/A
N/A
Protected

Academic year: 2021

Share "Displaying long expressions"

Copied!
1
0
0

Bezig met laden.... (Bekijk nu de volledige tekst)

Hele tekst

(1)

Displaying long expressions

This example uses a simple (though contrived) example of a Taylor series expansion of 1/(1 + x) to demonstrate the problems that can arise when displaying very long expressions.

from sympy import * x = Symbol(’x’)

ans = 1/(1+x) # py (ans.511,ans)

taylor = ans.series(x, 0, 10) # py (ans.512,taylor) taylor = ans.series(x, 0, 20) # py (ans.513,taylor) taylor = ans.series(x, 0, 23) # py (ans.514,taylor)

\begin{dgroup*}[spread={5pt}]

\begin{dmath*} f(x) = \Py*{ans.511} \end{dmath*}

\begin{dmath*} {}= \Py*{ans.512} \end{dmath*}

\begin{dmath*} {}= \Py*{ans.513} \end{dmath*}

\begin{dmath*} {}= \Py*{ans.514} \end{dmath*}

\begin{dmath*} {}= \Py*[\hskip 2cm]{ans.514} \end{dmath*}

\end{dgroup*}

The first four lines of the following output were set using \Py* while the final line used \Py*[\hskip=2cm]. The last pair of lines displays the output for the same tag ans.514 and clearly the formatting of the second last line is not ideal as the text has overlapped the tag. This was corrected in the final line by using the optional argument[\hskip=2cm] in the call to \Py*.

f (x) = 1

x + 1 (ans.511)

= 1 − x + x2− x3+ x4− x5+ x6− x7+ x8− x9+ O x10

(ans.512)

= 1 − x + x2− x3+ x4− x5+ x6− x7+ x8− x9+ x10− x11+ x12− x13+ x14− x15+ x16− x17+ x18− x19+ O x20

(ans.513)

= 1 − x + x2− x3+ x4− x5+ x6− x7+ x8− x9+ x10− x11+ x12− x13+ x14− x15+ x16− x17+ x18− x19+ x20− x21+ x22+ O x23 (ans.514)

= 1 − x + x2− x3+ x4− x5+ x6− x7+ x8− x9+ x10− x11+ x12− x13+ x14− x15+ x16− x17+ x18− x19+ x20− x21+ x22+ O x23

(ans.514)

Referenties

GERELATEERDE DOCUMENTEN

Not only did directly dated Neanderthal remains from layer G1 of the site provide radiocarbon ages postdating the most widely accepted transition time of 40–35,000 radiocarbon years

6 In fact, prospective long-term follow-up is part of both investigator-initiated European- wide trials on fresh decellularized allografts for pulmonary and aortic valve replacement

It is true there were short and fleeting moments, when the fiery eyes of Magua were seen glittering, like the fabled organs of the basilisk through the dusty wreath by which

“[t]oday, memory is widely called upon to legitimate identity because the core meaning of any individual or group identity is seen as sustained by remembering.” 97 Or

General theory tells us that this indeed is the Frobenius of an elliptic curve, see Honda-Tate the- ory [16]; the proof in the general case, using analytic parametrization,

The \balance command should be given for each page that needs balancing, and then turned off at the end of the second column. It might well be that \balance can be left on all the

He made the national assembly in Ankara more disciplined and reliable by uniting his supporters in the Müdafaa-i Hukuk Grubu (Defence of Rights Group) and outside the assembly

The domestic debt of the Netherlands Antilles rose to 31 per cent of GNP in 1991, about half of which consists of debt of the island government of Curacao (BNA 1991, 1992).. The