Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168742
Image: ubuntu2004
def ftermSquare(n): return(1/n*sin(n*x*pi/3)) def ftermSawtooth(n): return(1/n*sin(n*x*pi/3)) def ftermParabola(n): return((-1)^n/n^2 * cos(n*x)) def fseriesSquare(n): return(4/pi*sum(ftermSquare(i) for i in range (1,2*n,2))) def fseriesSawtooth(n): return(1/2-1/pi*sum(ftermSawtooth(i) for i in range (1,n))) def fseriesParabola(n): return(pi^2/3 + 4*sum(ftermParabola(i) for i in range(1,n))) @interact def plotFourier(n=slider(1, 30,1,10,'Number of terms') ,plotpoints=('Value of plot_points',[100,500,1000]),Function=['Saw Tooth','Square Wave','Periodic Parabola']): if Function=='Saw Tooth': show(plot(fseriesSawtooth(n),x,-6,6,plot_points=plotpoints)) if Function=='Square Wave': show(plot(fseriesSquare(n),x,-6,6,plot_points=plotpoints)) if Function=='Periodic Parabola': show(plot(fseriesParabola(n),x,-6,6,plot_points=plotpoints))
def ftermSquare(n): return(1/n*sin(n*x*pi/6)) def fseriesSquare(n): return(4/pi*sum(ftermSquare(i) for i in range (1,2*n,2))) plot (fseriesSquare(150), 5.5, 5.999
a = cos(pi*x/2) b = exp(-((x**2)/20)) plot([4, a*b], [-6, 6], axes = false)