# 10.6: Exercises

$$\newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} }$$ $$\newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}}$$$$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\kernel}{\mathrm{null}\,}$$ $$\newcommand{\range}{\mathrm{range}\,}$$ $$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$ $$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}[1]{\| #1 \|}$$ $$\newcommand{\inner}[2]{\langle #1, #2 \rangle}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\kernel}{\mathrm{null}\,}$$ $$\newcommand{\range}{\mathrm{range}\,}$$ $$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$ $$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}[1]{\| #1 \|}$$ $$\newcommand{\inner}[2]{\langle #1, #2 \rangle}$$ $$\newcommand{\Span}{\mathrm{span}}$$$$\newcommand{\AA}{\unicode[.8,0]{x212B}}$$

Before you go on, you might want to work on the following exercises.

##### Exercise 7.1
1. Write a function called cheby6 that evaluates the sixth Chebyshev polynomial. It should take an input variable, $$x$$, and return

$32 x^6 - 48 x^4 + 18 x^2 - 1 \notag$

2. Use ezplot to display a graph of this function in the interval from $$-1$$ to $$1$$. Estimate the location of any zeros in this range.
3. Use fzero to find as many different roots as you can. Does fzero always find the root that is closest to the initial value?
##### Exercise 7.2

When a duck is floating on water, how much of its body is submerged?1

To estimate a solution to this problem, we’ll assume that the submerged part of a duck is well approximated by a section of a sphere. If a sphere with radius $$r$$ is submerged in water to a depth $$d$$, the volume of the sphere below the water line is

$V = \frac{\pi}{3} (3r d^2 - d^3) \quad \mbox{as long as} \quad d < 2 r \notag$

We’ll also assume that the density of a duck is $$\rho = 0.3$$ g/cm$$^3$$ (0.3 times the density of water) and that its mass is $$\frac{4}{3} \pi r^3 \rho$$ g.

Finally, according to the law of buoyancy, an object floats at the level where the weight of the displaced water equals the total weight of the object.

Here are some suggestions for how to proceed:

1. Write an equation relating $$\rho$$, $$d$$, and $$r$$.
2. Rearrange the equation so the right-hand side is zero. Our goal is to find values of $$d$$ that are roots of this equation.
3. Write a MATLAB function that evaluates this function. Test it, then make it a quiet function.
4. Make a guess about the value of $$d_0$$ to use as an initial value.
5. Use fzero to find a root near $$d_0$$.
6. Check to make sure the result makes sense. In particular, check that $$d < 2 r$$, because otherwise the volume equation doesn’t work!
7. Try different values of $$\rho$$ and $$r$$ and see if you get the effect you expect. What happens as $$\rho$$ increases? Goes to infinity? Goes to zero? What happens as $$r$$ increases? Goes to infinity? Goes to zero?

1 This exercise is adapted from C. F. Gerald and P. O. Wheatley, Applied Numerical Analysis, 4th edition (Boston: Addison-Wesley, 1989).

This page titled 10.6: Exercises is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by Allen B. Downey (Green Tea Press) via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.