Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: math480-2016
Views: 988
%md # Math 480 - Homework 4: Due 6pm on April 29, 2016

Math 480 - Homework 4: Due 6pm on April 29, 2016

There are several problems and all have equal weights.

Solve each problem using Sage unless otherwise indicated. In particular, if there is some calculus question, which you could easily do by hand or in your head, you should still show exactly how to solve it using Sage if possible. Of course, do think with your brain!

For any part that asks for a symbolic result, use show(...), so the output is easier for us to read.

Problem 1 -- defining and evaluating a function:

  1. Define in Sage f(x)=sinh(x2+x1)+eπx+arcsin(x)+1x3xef(x) = \sinh(x^2+\sqrt{x-1}) + e^{\pi x} + \arcsin(x) + \frac{1}{x^3-x-e}.

  2. Compute f(1/2)f(1/2) symbolically (exactly).

  3. Compute f(1/2)f(1/2) numerically (so a decimal expansion).

  4. Plot f(x)f(x) from 1-1 to 11.

# Solution: # 1. f(x) = x # ... Replace x with the correct function code show(f) ︠40e3cae7-73f6-45b2-9a21-1cbe42eff9e0︠ # 2. f(x) = x # ... Copy from above ︠85cb8522-8dbe-4476-a3e7-a7cde9b6a32e︠ # 3. f(x) ︠e8f7b5aa-b57e-4ccf-a1bb-fbf6cd64b485︠ # 4. f(x) ︠fd260e23-378c-4b97-976a-5e409e0f2308i︠ %md ### Problem 2 -- finding zeros numerically: Let $f(x) = \displaystyle x^2 + \sin(x)$ 1. Draw a plot of $f$ on the interval $[-2,2]$. 1. Differentiate $f$ 1. Integrate $f$ 1. Find **all** the zeros of $f(x)$ numerically.

Problem 2 -- finding zeros numerically:

Let f(x)=x2+sin(x)f(x) = \displaystyle x^2 + \sin(x)

  1. Draw a plot of ff on the interval [2,2][-2,2].

  2. Differentiate ff

  3. Integrate ff

  4. Find all the zeros of f(x)f(x) numerically.

# 1 ︠c487e338-2150-4e57-9f0a-d88e8850d96d︠ # 2 ︠06af5dc4-2032-4b46-9401-2965d218defd︠ # 3 ︠8b4764b7-b90d-4239-b4b8-49966d1558c3︠ #4 ︠56ea4616-31fd-4b50-945c-0e4fd8349d99︠ %md ### Problem 3 (Original Version) -- The Cauchy Distribution Let $\displaystyle\space f(x;\space x_0,\space\gamma) = \frac{1}{\pi\gamma}\left[\frac{\gamma^2}{(x - x_0)^2 + \gamma^2}\right]$ 1. Plot and find the area under the curve of $f([-2, 2])$ for the following values of $x_0$ and $\gamma$ on the interval $x = [-4,4]$ - $x_0 = 0,\hspace{3mm} \gamma = 1$ - $x_0 = 2,\hspace{3mm} \gamma = 2$ - $x_0 = 0,\hspace{3mm} \gamma = 0.5$ 1. Integrate $f$ from $-\infty$ to $x$ using the dummy variable $t$ as in $f(t;\space x_0,\space\gamma)$. 1. Plot the resulting function from 3 for $x_0 = 0,\hspace{3mm} \gamma = 0.5$. All plots should be separate.

Problem 3 -- The Cauchy Distribution

Let  f(x; x0, γ)=1πγ[γ2(xx0)2+γ2]\displaystyle\space f(x;\space x_0,\space\gamma) = \frac{1}{\pi\gamma}\left[\frac{\gamma^2}{(x - x_0)^2 + \gamma^2}\right]

  1. Plot and find the area under the curve of f([2,2])f([-2, 2]) for the following values of x0x_0 and γ\gamma on the interval x=[4,4]x = [-4,4]

  • x0=0,γ=1x_0 = 0,\hspace{3mm} \gamma = 1

  • x0=2,γ=2x_0 = 2,\hspace{3mm} \gamma = 2

  • x0=0,γ=0.5x_0 = 0,\hspace{3mm} \gamma = 0.5

  1. Integrate ff from -\infty to xx using the dummy variable tt as in f(t; x0, γ)f(t;\space x_0,\space\gamma).

  2. Plot the resulting function from 3 for x0=0,γ=0.5x_0 = 0,\hspace{3mm} \gamma = 0.5.

All plots should be separate.

Problem 3 (Rewritten by William Stein) -- The Cauchy Distribution

Let  f(x; x0, γ)=1πγ[γ2(xx0)2+γ2]. \displaystyle\space f(x;\space x_0,\space\gamma) = \frac{1}{\pi\gamma}\left[\frac{\gamma^2}{(x - x_0)^2 + \gamma^2}\right]. Thus for any specific choice of parameters x0,γRx_0, \gamma \in \RR, we obtain a real-valued function of a real variable xx. See https://en.wikipedia.org/wiki/Cauchy_distribution for a discussion of the basic properties of this function.

  1. Illustrate the probability something is between 2-2 and 22: Below we give three choices of parameters x0x_0 and γ\gamma. Each determines a function g(x)=f(x;x0,γ)g(x) = f(x; x_0, \gamma) of a real variable. For each of these functions, (1) draw a plot of gg on the interval [4,4][-4,4], then (2) in that plot from (1) show a grey fill that illustrates the area under gg on the interval [2,2][-2,2], and finally (3) numerically approximate that area (the result should be a positive floating point number). As a double check, make sure that the area you computed in (3) match what it looks like from your plot in (2).

  • x0=0,γ=1x_0 = 0,\hspace{3mm} \gamma = 1

  • x0=2,γ=2x_0 = 2,\hspace{3mm} \gamma = 2

  • x0=0,γ=0.5x_0 = 0,\hspace{3mm} \gamma = 0.5

  1. Compute the cummulative distribution function: Symbolically compute the function F(x;x0,γ)=xf(t;x0,γ)dtF(x; x_0, \gamma) = \int_{-\infty}^{x} f(t; x_0, \gamma) dt. The result will be a function of xx again. Here tt is just a dummy parameter.

  2. Plot the resulting cummulative distribution function F(x;x0,γ)F(x; x_0, \gamma) from part 2 with x0=0,γ=0.5x_0 = 0,\hspace{3mm} \gamma = 0.5.

All plots should be separate.

︠e42f24fd-2f7a-4005-a580-87cd48a21f31︠ ︠bd56ab4c-fffc-4d06-a6ce-8d6344f19451i︠ %md ### Problem 4 -- a function with no elementary antiderivative: Let $f(x) = \sin(x^2) + \exp(1/x)$ 1. Draw a plot of $f$ on the interval $[1/2, 4]$. 1. Differentiate $f$ 1. Integrate $f$

Problem 4 -- a function with no elementary antiderivative:

Let f(x)=sin(x2)+exp(1/x)f(x) = \sin(x^2) + \exp(1/x)

  1. Draw a plot of ff on the interval [1/2,4][1/2, 4].

  2. Differentiate ff

  3. Integrate ff

︠625a9f83-8fc2-467c-a926-1833252da1e9i︠ %md ### Problem 5 -- Limits 1. Compute $\lim_{x\to 0} \sin(x)/x$ 1. Use Sage to verify that strange and amazing fact $\lim_{x\to 0} (\cos x)^{1/x^2} = \frac{1}{\sqrt{e}}$.

Problem 5 -- Limits

  1. Compute limx0sin(x)/x\lim_{x\to 0} \sin(x)/x

  2. Use Sage to verify that strange and amazing fact limx0(cosx)1/x2=1e\lim_{x\to 0} (\cos x)^{1/x^2} = \frac{1}{\sqrt{e}}.

# Solution ︠9d1a61e6-9c5c-4021-9ddf-19f7a1a13aefi︠ %md ### Problem 6 -- Taylor Series Let $f(x) = \sin(x^2)$ 1. Find the 3rd degree taylor series, $p_3(x)$, of $f$ where $x_0 = 2\pi$ 1. Plot on the interval $x=[\pi, 3\pi]$, the 10th degree taylor series $p_{10}(x)$ where $x_0 = 2\pi$ alongside $f$

Problem 6 -- Taylor Series

Let f(x)=sin(x2)f(x) = \sin(x^2)

  1. Find the 3rd degree taylor series, p3(x)p_3(x), of ff where x0=2πx_0 = 2\pi

  2. Plot on the interval x=[π,3π]x=[\pi, 3\pi], the 10th degree taylor series p10(x)p_{10}(x) where x0=2πx_0 = 2\pi alongside ff

︠abd1a807-652a-4ccb-b1da-28bb51571c22︠ %md ### Problem 7 -- Gradient Vector Field: 1. Compute the gradient of $f(x,y) = 3\sin(x) - 2\cos(2y) - x - y$. 2. Plot the 2-dimensional vector field defined by the gradient of $f$ in the rectangle $(-2,-2) \leq (x,y) \leq (2,2)$.

Problem 7 -- Gradient Vector Field:

  1. Compute the gradient of f(x,y)=3sin(x)2cos(2y)xyf(x,y) = 3\sin(x) - 2\cos(2y) - x - y.

  2. Plot the 2-dimensional vector field defined by the gradient of ff in the rectangle (2,2)(x,y)(2,2)(-2,-2) \leq (x,y) \leq (2,2).

︠edc36c3a-5862-4693-8ee8-43ca37e36047i︠ %md ### Problem 8 -- Symbolic Sums: 1. Compute $\sum_{n=1}^{\infty} \frac{(-1)^n}{n}$. 2. Compute $\sum_{n=1}^{\infty} \frac{1}{n^2}$. 3. Compute $\sum_{n=1}^{\infty} \frac{1}{n^3}$ both symbolically (in terms of the Riemann Zeta function) and numerically. 4. Compute $\sum_{n=1}^{\infty} \frac{1}{n^4}$. 5. Compute $\sum_{n=1}^k \sin(n)$.

Problem 8 -- Symbolic Sums:

  1. Compute n=1(1)nn\sum_{n=1}^{\infty} \frac{(-1)^n}{n}.

  2. Compute n=11n2\sum_{n=1}^{\infty} \frac{1}{n^2}.

  3. Compute n=11n3\sum_{n=1}^{\infty} \frac{1}{n^3} both symbolically (in terms of the Riemann Zeta function) and numerically.

  4. Compute n=11n4\sum_{n=1}^{\infty} \frac{1}{n^4}.

  5. Compute n=1ksin(n)\sum_{n=1}^k \sin(n).

# Solution ︠c249004b-e69b-4a3b-af4c-d59358b1003ci︠ %md ### Problem 9 -- Unit Conversion: Use Sage's units functionality (written by a UW undergrad -- David Ackerman!) 1. Convert 68 degrees Fahrenheit to Celcius. Hint: use `68*units.temperature.fahrenheit` to define fahrenheit. 2. Convert 15 milliseconds to hours. 3. Convert 2016 degrees kelvins to degrees Fahrenheit. 4. Convert 9.8 meters per second squared to feet per second squared.

Problem 9 -- Unit Conversion:

Use Sage's units functionality (written by a UW undergrad -- David Ackerman!)

  1. Convert 68 degrees Fahrenheit to Celcius. Hint: use 68*units.temperature.fahrenheit to define fahrenheit.

  2. Convert 15 milliseconds to hours.

  3. Convert 2016 degrees kelvins to degrees Fahrenheit.

  4. Convert 9.8 meters per second squared to feet per second squared.

# Solution: ︠7a5a91ee-a204-45eb-9539-c0cc221c5560i︠ %md ### Problem 10 -- 3d Plotting: 1. Draw a 3d plot of a torus. 1. Draw a single 3d plot containing the five regular polytopes in it: tetrahedron, cube, octahedron, dodecahedron, icosahedron. All five must be visible. 1. Draw a 3d plot of the "Mexican hat function" (see, e.g., https://en.wikipedia.org/wiki/Mexican_hat_wavelet). [Hint: you have to make a choice of parameter $\sigma$ so that it looks like Mexican hat.]

Problem 10 -- 3d Plotting:

  1. Draw a 3d plot of a torus.

  2. Draw a single 3d plot containing the five regular polytopes in it: tetrahedron, cube, octahedron, dodecahedron, icosahedron. All five must be visible.

  3. Draw a 3d plot of the "Mexican hat function" (see, e.g., https://en.wikipedia.org/wiki/Mexican_hat_wavelet). [Hint: you have to make a choice of parameter σ\sigma so that it looks like Mexican hat.]