examples with Sympy
fluxion
fluxion at monocles.de
Sat Nov 7 18:08:39 GMT 2020
I thought it could be nice to show some examples rendered
with Sympy.
With unicode:
pprint(Integral(sqrt((1+x)/(x**2+3)),x)+Sum(1/j**2,(j,1,n)))
n
____
⌠ ╲
⎮ ________ ╲ 1
⎮ ╱ x + 1 ╲ ──
⎮ ╱ ────── dx + ╱ 2
⎮ ╱ 2 ╱ j
⎮ ╲╱ x + 3 ╱
⌡ ‾‾‾‾
j = 1
With ascii:
pprint(Integral(sqrt((1+x)/(x**2+3)),x)+Sum(1/j**2,(j,1,n)), use_unicode=False)
n
/ ____
| \ `
| ________ \ 1
| / x + 1 \ --
| / ------ dx + / 2
| / 2 / j
| \/ x + 3 /___,
| j = 1
/
By comparison, the LaTeX text could be
\int{\sqrt{\frac{x+1}{x^2+3}}dx+\sum_{j=1}^n\frac{1}{j^2}
which I don't have a problem reading it, but... for non-LaTeX users...
Finally, an example of a graphic:
plot(sin(x),(x,-2*pi,2*pi))
0.99830 | ... ...
| / \ / \
| / . / .
| . .
| . .
| . .
| . .
| . .
0.05872 | -------------.--------------------------.--------------
| . . . . /
| . .
| . .
| . .
| . .
| . .
| . / . /
| \ / \ /
-0.9983 | ... ...
-6.28319 0 6.28319
In this case we seem to get the same result with ascii and unicode,
or maybe Sympy does not distinguish for plotting, although both
pprint(plot(sin(x),(x,-2*pi,2*pi)),use_unicode=False)
and
pprint(plot(sin(x),(x,-2*pi,2*pi)))
seem to be accepted by Sympy.
Is this enough for math & data? What do you think?
More information about the Gemini
mailing list