%config InlineBackend.figure_format='svg'
from numpy import linspace,exp,sin,dot
from matplotlib.pyplot import figure,subplot,plot,title
from chebPy import *
xx = linspace(-1.0,1.0,200,True)
uu = exp(xx)*sin(5.0*xx)
c = 1; figure(figsize=(10,8))
for N in [10,20]:
D,x = cheb(N); u = exp(x)*sin(5.0*x)
subplot(2,2,c); c += 1
plot(x,u,'o',xx,uu)
title('u(x), N='+str(N))
error = dot(D,u) - exp(x)*(sin(5.0*x)+5.0*cos(5.0*x))
subplot(2,2,c); c += 1
plot(x,error,'o-')
title('error in u\'(x), N='+str(N));