Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
320 views

Riemann Sums Assignment

Question 0

Watch the lecture video here.

Did you watch the video? [Type yes or no.]

yes

Question 1

Approximate the area under the graph of f(x)=3x29x+5f(x)=3x^2-9x+5 on the interval [5,5][-5,5] using left and right Riemann sums with n=25n=25 and n=50n=50 subintervals.

[The actual area is 300300.]

f(x)=3*x^2-9*x+5 a=-5 b=5 n=25 dx=(b-a)/n %var i LS=sum(f(a+i*dx)*dx,i,0,n-1) print 'the left riemann sum is',N(LS) RS=sum(f(a+i*dx)*dx,i,1,n) print 'the right riemann sum is',N(RS)
the left riemann sum is 318.800000000000 the right riemann sum is 282.800000000000
f(x)=3*x^2-9*x+5 a=-5 b=5 n=50 dx=(b-a)/n %var i LS=sum(f(a+i*dx)*dx,i,0,n-1) print 'the left riemann sum is',N(LS) RS=sum(f(a+i*dx)*dx,i,1,n) print 'the right riemann sum is',N(RS)
the left riemann sum is 309.200000000000 the right riemann sum is 291.200000000000

Question 2

The area under the graph of f(x)=ln(sin(x))f(x)=\ln(\sin(x)) from x=1x=1 to x=2x=2 is approximately 0.0455-0.0455.

To get an idea of how big nn must be to get a good approximation (say correct to four decimal places), find both the left and right Riemann sums with n=100n=100, n=500n=500, and n=1000n=1000.

f(x)=ln(sin(x)) a=1 b=2 n=100 dx=(b-a)/n %var i LS=sum(f(a+i*dx)*dx,i,0,n-1) print 'the left riemann sum is',N(LS) RS=sum(f(a+i*dx)*dx,i,1,n) print 'the right riemann sum is',N(RS)
the left riemann sum is -0.0458989510084293 the right riemann sum is -0.0451237439066900
f(x)=ln(sin(x)) a=1 b=2 n=500 dx=(b-a)/n %var i LS=sum(f(a+i*dx)*dx,i,0,n-1) print 'the left riemann sum is',N(LS) RS=sum(f(a+i*dx)*dx,i,1,n) print 'the right riemann sum is',N(RS)
the left riemann sum is -0.0455800702068700 the right riemann sum is -0.0454250287865221
f(x)=ln(sin(x)) a=1 b=2 n=1000 dx=(b-a)/n %var i LS=sum(f(a+i*dx)*dx,i,0,n-1) print 'the left riemann sum is',N(LS) RS=sum(f(a+i*dx)*dx,i,1,n) print 'the right riemann sum is',N(RS)
the left riemann sum is -0.0455410349143013 the right riemann sum is -0.0454635142041273

Question 3

The graph of x2+y2=25x^2+y^2=25 is a circle of radius 5 centered at the origin. From geometry, we know its area is π5278.54\pi\cdot5^2\approx78.54. We will approximate this area using Riemann sums.

Let f(x)=25x2\displaystyle f(x)=\sqrt{25-x^2} (the top half of the circle). Approximate the area between ff and the x-axis from x=5x=-5 to x=5x=5 using left and right Riemann sums with n=100n=100 subintervals.

Now multiply this area by 2 to get an approximation for the area of the whole circle. How close are you to the correct area?

f(x)=sqrt(25-x^2) a=-5 b=5 n=100 dx=(b-a)/n %var i LS=sum(f(a+i*dx)*dx*2,i,0,n-1) print 'the left riemann sum is',N(LS) RS=sum(f(a+i*dx)*dx*2,i,1,n) print 'the right riemann sum is',N(RS)
the left riemann sum is 78.4567127774625 the right riemann sum is 78.4567127774625

Question 4

Use Sage's sum command to evaluate the following sums.

Part a

i=1501i2\displaystyle\sum_{i=1}^{50}\frac{1}{i^2}

%var i sum(1/i^2,i,1,50)
3121579929551692678469635660835626209661709/1920815367859463099600511526151929560192000

Part b

k=10100k33k25\displaystyle\sum_{k=10}^{100}\frac{k^3-3k^2}{5}

%var k sum(((k^3-3*k^2)/(5)),k,10,100)
4897256

Part c

k=1n((kn)2+kn)1n\displaystyle\sum_{k=1}^{n}\left(\left(\frac{k}{n}\right)^2+\frac{k}{n}\right)\cdot\frac{1}{n}

[Hint: Declare both nn and kk to be variables.]

%var k %var n sum((((k/n)^2+(k/n))*(1/n)),k,1,n)
1/6*(5*n^2 + 6*n + 1)/n^2

Question 5

Calculate the limit as nn\to\infty of your answer from Question 4, Part c.


Note: This limit gives the area between the x-axis and the function f(x)=x2+xf(x)=x^2+x over the interval from x=0x=0 to x=1x=1, because the sum in Question 4, Part c, is the right Riemann sum with nn rectangles for this function. In other words, 01x2+xdx=limnk=1n((kn)2+kn)1n\displaystyle\int_0^1 x^2+x\, dx=\lim_{n\to\infty}\sum_{k=1}^{n}\left(\left(\frac{k}{n}\right)^2+\frac{k}{n}\right)\cdot\frac{1}{n}.

limit(1/6*(5*n^2 + 6*n + 1)/n^2,n=oo)
Error in lines 1-1 Traceback (most recent call last): File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1188, in execute flags=compile_flags) in namespace, locals File "", line 1, in <module> File "sage/rings/integer.pyx", line 2093, in sage.rings.integer.Integer.__pow__ (build/cythonized/sage/rings/integer.c:14305) return left ** int(right) TypeError: unsupported operand type(s) for ** or pow(): 'function' and 'int'
This material was developed by Aaron Tresham at the University of Hawaii at Hilo and is Creative Commons License
licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.