Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168734
Image: ubuntu2004
@interact def _(n=int(1)): if n in ZZ and n>=0: A=plot(x^2, 0, 1, fill=0) B=plot(x^2, 0, 1, fill=0) U=float(0) L=float(0) for i in range(n): A+=plot(0, 0, 1, rgbcolor=(1,0,0)) A+=plot(((i+1)/n)^2, i/n, (i+1)/n, rgbcolor=(1,0,0), fill=0, fillcolor='red') A+=line([[i/n,0],[i/n,((i+1)/n)^2]], rgbcolor=(1,0,0)) U+=(1/n)*((i+1)/n)^2 B+=plot(0, 0, 1, rgbcolor=(1,0,0)) B+=plot(((i)/n)^2, i/n, (i+1)/n, rgbcolor=(1,0,0), fill=0, fillcolor='red') B+=line([[i/n,0],[i/n,((i)/n)^2]], rgbcolor=(1,0,0)) L+=(1/n)*((i)/n)^2 A+=line([[1,0],[1,1]], rgbcolor=(1,0,0)) B+=line([[1,0],[1,(1-(1/n))^2]], rgbcolor=(1,0,0)) print "Upper Bound of Area:", U show(A) print "Lower Bound of Area:", L show(B) else: print "n must be a non-negative integer."