Exercises 5.4 Homework
1.
(No programming involved.) Prove that the following inequality holds for every positive integer \(n\text{:}\)
How does this explain the observation in Example 5.3.1?
Multiply the sum of sines by \(\sin(1/2)\) and use the formula
to make the sum “telescope”.
2.
Write an anonymous function f = @(x, y) ...
which implements the mathematical function
in such a way that the input variables x, y are allowed to be vectors. Then plot the values of \(f\) along the parametric curve
as follows.
t = linspace(-1, 1, 500); plot(t, f(t.^2, sin(t)))
As \(t\) approaches 0, what value does \(f\) appear to approach?
3.
Write a named function function y = cositer(x, n)
that takes two arguments x and n and returns the n-th iteration of the mathematical function \(x\mapsto 2\cos x\text{.}\) For example, if n = 4
, the result should be
Use this function to plot several of these iterates on the interval \([0, 2]\) as shown below.
x = linspace(0, 2, 2000); hold on for n = [4 5 30 31] plot(x, cositer(x, n)) end hold off function y = cositer(x, n) (your function goes here) end
Remark: the command hold on
refers to displaying several functions on the same plot. Normally, Matlab replaces each plot with next one. With hold on
, it keeps the previous plot and draws next one over it, using a different color (unless you specify a color). At the end, hold off
is used to restore the normal behavior.