Week 7: Exercises#

Exercises – Long Day#

1: Computational Rules for Antiderivatives. By Hand#

Find the indefinite integral (5cos(x+1)sin(5x)+2x37)dx for x>3, and explain the rules you have used along the way.

2: Riemann Sum for a Linear Function#

We are given the function f:[0,5]R by the expression f(x)=2x+3.

Question a#

Find a value of the Riemann sum over the interval [0,5] with 30 subintervals using Python, where the left endpoints of the subintervals are used. Then repeat for the right endpoints of the subintervals.

Question b#

Find the exact values of the Riemann sum over the interval [0,5] with n subintervals, where the left endpoints of the subintervals are used. Then repeat for the right endpoints of the subintervals.

Question c#

Provide an exact expression of the maximum and minimum error incurred from using the above Riemann sum to calculate the area under the graph. Both expressions should only depend on n.

Question d#

Argue, in this specific case, that the Riemann sum has the same limit value regardless of the choice of point in the subinterval.

3: Using the Fundamental Theorem of Calculus#

Question a#

Provide an antiderivative of 11+x2. Then calculate the integral 0111+x2dx.

Question b#

Calculate the double-integrals

12(01e2xydx)dy

and

0π2(01ycos(xy)dx)dy.

Question c#

Let f:[5,5]R be given by

f(x)={1for x[0,1]0for x[5,5][0,1].

Calculate:

F(x)=x0xf(y)dyfor x[5,5],

where x0[5,5] is fixed but arbitrary. You can i.e. choose x0=0. Is F continuous? Is F differentiable at all points? Is F an antiderivative of f?

4: Parametrizations in the Plane. By Hand#

Consider the sets UR2 given by

U=B((0,0),2)B((0,0),1),

where B((0,0),r) is an open circular disc with radius r and center (0,0), and B((0,0),r) is the closed circular disc (so, including the boundary).

Make a sketch of the set U. Provide a parametrization p:]1,2[×[0,2π[U of U. The vector function p must be a function of two variables, i.e., (r,θ)]1,2[×[0,2π[, and the image set of p must be U.

5: The Trapezoidal Method and Rieman Sums#

There are many integrals that cannot be calculated exactly, often because the antiderivative cannot be expressed by a “known” function. In this exercise, we wish to calculate an approximate value for:

03sin(x2)exp(3x)dx.

The SciPy package in Python can compute (approximations of) integrals using so-called numerical integration. Here, we will compare SciPy’s quad command with both the Riemann sum we know from the book and the so-called trapezoidal method.

By the trapezoidal method we mean the approximation to the integral over a small interval [xj1,xj] given by

xj1xjf(x)dx=12(xjxj1)(f(xj1)+f(xj)),

while we by mid-sums of the Riemann integral with the choice ξj:=xj+xj12 have

xj1xjf(x)dxf(ξj)(xjxj1).

If you want to approximate an integral over a larger interval [a,b], you can subdivide it into several smaller intervals Qj=[xj1,xj], j=1,,J, and approximate them individually, after which you can sum them all together – just like with Riemann sums.

Question a#

Argue that sin(x2)exp(3x) has an antiderivative and that the integral 03sin(x2)exp(3x)dx is well-defined. Try (in SymPy) to find the exact value of

03sin(x2)exp(3x)dx.

Use .evalf() to get an approximate value of the integral.

Question b#

Calculate the integral using quad from scipy.integrate. You must import from scipy.integrate import quad and define:

def f(x):
    return sin(x**2)*exp(3*x)

Question c#

We would like to compare this with the Riemann integral we have worked with earlier. We use Riemann sums, where [a,b] is divided into J equal subintervals. Can you implement a function in Python that calculates this for you? It should have the following form:

def riemann_sum(f,a,b,J):

where f is a continuous function, a and b are the inteval endpoints, and J is the number of subdivisions of the integral. When you have written your Python function, you can test it on the same integral as above with J=20.

Question d#

With the trapezoidal method we no longer approximate the area under a graph with rectangles. Can you figure out what the shape looks like based on the formula above?

Question e#

Now implement the trapezoidal method:

def trapez_sum(f,a,b,J):

where f is a continuous function, a and b are the interval endpoints, and J is the number of subdivisions of the integral. Once you’ve written your code, you can test it on the same integral as above with J=20.

Question f#

It doesn’t immediately seem like we get the same value of the integral. Compare your results from questions a, b, c and e. Which method is the best? Why do you think so? Also, try both with more and fewer subdivisions of the interval.

6: An Indefinite Integral. By Hand#

Question a#

The following is not a Rieman integral:

011xdx.

Why not?

Question b#

Calculate 011xdx as lima0a11xdx.

Question c#

Find in a similar fashion the integral 11xdx (if possible).

7: Change of Variables for Integrals in 2D#

Determine the integral

0118yx+xydxdy

using change of variables.

Exercises – Short Day#

1: Indefinite and Definite Integrals. By Hand#

Question a#

Determine an antiderivative of each of the functions

x3,1x3andsin(3xπ2).

Question b#

Calculate the following Riemann integrals:

01x3dx,121x3dxandπ20sin(3xπ2)dx.

2: Partial Integration. By Hand#

Question a#

We will first prove the formula for partial integration. Begin by differentiating the expression on the right-hand side of

f(x)g(x)dx=F(x)g(x)F(x)g(x)dx.

Now finish the proof.

Question b#

Determine an antiderivative of the function xcos(x), and check that it is correct.

Question c#

Find an antiderivative of ln(x) using partial integration.

3: Integration by Substitution. By Hand#

For the questions in this exercise we will use the method known as integration by substitution:

f(g(x))g(x)dx=f(t)dtwhere t=g(x).

Question a#

Determine an antiderivative of xex2.

Question b#

Find the indefinite integral xx2+1dx.

Question c#

Find an antiderivative of sin(x)3cos(x), and then calculate 0πsin(x)3cos(x)dx.

4: Sequences. By Hand#

In this and the following exercises, we are given samples of an important building block for integral calculus: sequences and their potential convergence. From Den Store Danske (Gyldendal dictionaries), translated:

Convergence, a concept of fundamental importance in mathematical analysis, especially in the theory of infinite series. A sequence of real numbers x1,x2, is called convergent if there exists a number x such that the number xn is arbitrarily close to x, as long as n is sufficiently large (). The number x is called the limit (or limit value) of the sequence, which is said to converge to x. If the sequence is not convergent, it is called divergent.

More precisely, a sequence x1,x2, is said to be convergent if there exists a number x with the following property:

ϵ>0NN:nN|xnx|<ϵ.

Four sequences (an)n=1, (bn)n=1, (cn)n=1 and (dn)n=1 are given by

an=1n,bn=n12n,cn=n1000anddn=4n2+1683n2

for nN. A sequence is written in short as (an) for (a1,a2,) and can be considered an infinite ordered list.

Determine which of the four sequences are convergent. Specify the limit of those that are convergent.

Note

The concept of convergence is not only important in mathematical analysis. It is also the precise description of “engineering statements” such as:

Our algorithm/method/etc. converges if we simply include enough measurement points/data points/samples/etc.

5: Integrals via Left-Sums. By Hand#

We will calculate the Riemann integral 01f(x)dx of the function

f(x)=x,x[0,1]

directly from the definition (so, do not find an antiderivative F(x)=x2/2 and then use it to calculate F(1)F(0)=1/20=1/2).

We subdivide the interval [0,1] into n equally large pieces, i.e., xj=j/n for j=0,1,2,,n. The Riemann sum Sn is called a left sum Vn if we always evaluate f at the left endpoint of each subinterval, that is, ξj=xj1 for ξj[xj1,xj] for j=1,2,,n.

Use this to determine the value of 01xdx=limnVn.