Week 7: Exercises#
Exercises – Long Day#
1: Computational Rules for Antiderivatives. By Hand#
Find the indefinite integral
Answer
where
2: Riemann Sum for a Linear Function#
We are given the function
Question a#
Find a value of the Riemann sum over the interval
Question b#
Find the exact values of the Riemann sum over the interval
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
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
Hint
If you can’t remember an antiderivative of
Answer
An antiderivative is
Question b#
Calculate the double-integrals
and
Hint
First calculate the inner integral while you treat
Answer
Question c#
Let
Calculate:
where
Hint
Use SymPy for help if you get stuck.
4: Parametrizations in the Plane. By Hand#
Consider the sets
where
Make a sketch of the set
Hint
Use polar coordinates as you remember from Mathematics 1a.
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:
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
while we by mid-sums of the Riemann integral with the choice
If you want to approximate an integral over a larger interval
Question a#
Argue that
Use .evalf()
to get an approximate value of the integral.
Answer
Solution in SymPy:
You can (probably) get SymPy (as well as other mathematical software such as Maple) to provide an antiderivative, but it will be expressed in terms of a function
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)
Hint
from scipy.integrate import quad
def f(x):
return sin(x**2)*exp(3*x)
quad(f,0,3)
Answer
Question c#
We would like to compare this with the Riemann integral we have worked with earlier. We use Riemann sums, where
def riemann_sum(f,a,b,J):
where
Hint
It could have a structure as follows:
def riemann(f,a,b,J):
w = (b - a)/J
x_v = a
result = 0
for i in range(J):
x_h = x_v + w
result += ???
x_v = x_h
result *= w
return result
You decide how you want to choose
Answer
It can look as follows:
def riemann(f,a,b,J):
w = (b - a)/J
x_v = a
result = 0
for i in range(J):
x_h = x_v + w
result += f((x_h+x_v)/2)
x_v = x_h
result *= w
return result
Answer
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?
Hint
See the figures on https://en.wikipedia.org/wiki/Trapezoidal_rule.
Question e#
Now implement the trapezoidal method:
def trapez_sum(f,a,b,J):
where
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:
Why not?
Answer
The integral is not (at first glance) well-defined since
Question b#
Calculate
Hint
Find the integral
Answer
Question c#
Find in a similar fashion the integral
Hint
Find the integral
Answer
The integral does not converge:
7: Change of Variables for Integrals in 2D#
Determine the integral
using change of variables.
Hint
Factorize
Answer
Hint
You might want to change variables as this:
Hint
After the variable change, the indefinite integral can be written as
Answer
Exercises – Short Day#
1: Indefinite and Definite Integrals. By Hand#
Question a#
Determine an antiderivative of each of the functions
Hint
Note that the first example was treated in exercise I: Antiderivatives for Memorization.
Hint
Function no. 2: use the rewriting
Answer
Question b#
Calculate the following Riemann integrals:
Answer
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
Hint
Remember how we differentiate the product of two functions. This is known as the product rule.
Hint
Remember that if we differentiate
Now finish the proof.
Question b#
Determine an antiderivative of the function
Hint
Use partial integration, where you let
Hint
See examples in the book.
Answer
Question c#
Find an antiderivative of
Hint
You can always multiply
Hint
Rewrite
3: Integration by Substitution. By Hand#
For the questions in this exercise we will use the method known as integration by substitution:
Question a#
Determine an antiderivative of
Hint
Can you identify an inner function
Hint
If we let
Answer
Question b#
Find the indefinite integral
Hint
Can you identify an inner function
Hint
If we let
Answer
Question c#
Find an antiderivative of
Hint
Set
Answer
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
is called convergent if there exists a number such that the number is arbitrarily close to , as long as is sufficiently large ( ). The number is called the limit (or limit value) of the sequence, which is said to converge to . If the sequence is not convergent, it is called divergent.
More precisely, a sequence
Four sequences
for
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.
Hint
If you can’t prove it from the definition, try using Python to experiment with it. You can quickly calculate the first 100 or 1000 numbers in the sequence.
Answer
5: Integrals via Left-Sums. By Hand#
We will calculate the Riemann integral
directly from the definition (so, do not find an antiderivative
We subdivide the interval
Use this to determine the value of
Hint
We must first find
Hint
The rectangles have areas
Hint
Assume that
Hint
Each sum of two terms has the value
Answer
So, we have