-
Notifications
You must be signed in to change notification settings - Fork 0
/
animation.py
34 lines (28 loc) · 1.01 KB
/
animation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from sympy import Symbol
from integral import Integral
import matplotlib.pyplot as plt
# ------------------------------ Example 1 -------------------------
x = Symbol('x')
expr = 1 / (1 + x**2)
example = Integral(expr, (-0.5, 5.5), (0, 5), x)
ani = example.animation(save=False)
plt.show()
# ------------------------------ Example 2 -------------------------
# from sympy import pi, sin
# x = Symbol('x')
# expr = sin(x)
# example = Integral(expr, (0, pi/2), (0, pi/2), x, 10)
# ani = example.animation(save=False, filename='animation2.gif')
# plt.show()
# ------------------------------ Example 3 -------------------------
# x = Symbol('x')
# expr = 4 / (1 + x**2)
# example = Integral(expr, (0, 1), (0, 1), x, 10)
# ani = example.animation(save=False, filename='animation3.gif')
# plt.show()
# ------------------------------ Example 4 -------------------------
# x = Symbol('x')
# expr = 1 / x
# example = Integral(expr, (1, 2), (1, 2), x, 10)
# ani = example.animation(save=False, filename='animation4.gif')
# plt.show()