In [1]:
%pylab inline
Populating the interactive namespace from numpy and matplotlib
In [2]:
pylab.figure(figsize=(16,12))
pylab.xlim(-4,4)
pylab.ylim(-2,4)
circle1 = plt.Circle((0,1), 2, color='r', fill=False, linewidth=3)
fig = plt.gcf()
ax = fig.gca()
l = plt.Line2D([-4,4],[-1,-1], linewidth=3)
ax.add_artist(circle1)
ax.add_artist(l)
Out[2]:
<matplotlib.lines.Line2D at 0x7fb2c7fec390>
In [1]:
from sympy import *
In [75]:
var('x', real=True)
var('a', real=True)
# a = Symbol('x', real=True, positive=True)
def phi(n):
    return sqrt(2/a)*sin(n*pi*x/a)
formula = integrate(phi(1)*phi(1),(x,0,a))*a/2
formula
Out[75]:
Piecewise((0, pi/a == 0), (a/2, True))
In [77]:
refine(formula, Q.is_true(a>0))
Out[77]:
Piecewise((0, pi/a == 0), (a/2, True))