#!/usr/bin/env python3from sympy import pprint, symbols, Integral, cos, sin, pi, exp, sqrt
theta = symbols('θ')
r = 1 + 2 * sin(theta)
x = r * cos(theta)
y = r * sin(theta)
I = Integral(r ** 2 / 2, (theta, - pi / 6, 7 * pi / 6))
for o in [I, I.doit()]:
pprint(o.simplify())
print()
p = plot_parametric((x, y, (theta, 0, pi / 2)),
(x, y, (theta, pi / 2, pi)),
(x, y, (theta, pi, 7 * pi / 6)),
(x, y, (theta, 7 * pi / 6, 3 * pi / 2)),
(x, y, (theta, 3 * pi / 2, 11 * pi / 6)),
(x, y, (theta, 11 * pi / 6, 2 * pi)),
show=False)
colors = ['red', 'green', 'blue', 'brown', 'orange', 'pink']
for i, s inenumerate(p):
s.line_color = colors[i]
p.save('sample7.png')
0 コメント:
コメントを投稿