diff options
| author | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2021-05-25 17:10:49 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2021-05-25 17:10:49 +0200 |
| commit | d6c61d988bfa4255baf9cdae42db59ebee38363f (patch) | |
| tree | 118ff3c2424e735149c145524965a4a337e50beb /src/Homework4/Homework4.ipynb | |
| parent | 46eef66b1e1571c77dc828d7e950b129b4c8bfd0 (diff) | |
| download | mathsoftware-d6c61d988bfa4255baf9cdae42db59ebee38363f.tar.gz mathsoftware-d6c61d988bfa4255baf9cdae42db59ebee38363f.zip | |
Added files
Diffstat (limited to 'src/Homework4/Homework4.ipynb')
| -rw-r--r-- | src/Homework4/Homework4.ipynb | 172 |
1 files changed, 172 insertions, 0 deletions
diff --git a/src/Homework4/Homework4.ipynb b/src/Homework4/Homework4.ipynb new file mode 100644 index 0000000..99481b9 --- /dev/null +++ b/src/Homework4/Homework4.ipynb | |||
| @@ -0,0 +1,172 @@ | |||
| 1 | { | ||
| 2 | "cells": [ | ||
| 3 | { | ||
| 4 | "cell_type": "markdown", | ||
| 5 | "metadata": {}, | ||
| 6 | "source": [ | ||
| 7 | "*For this exercise you should have received this text in .ipynb format. Complete the exercises by modifying this file, and submit the modified version*\n", | ||
| 8 | "\n", | ||
| 9 | "**Deadline:** Sunday, June 6." | ||
| 10 | ] | ||
| 11 | }, | ||
| 12 | { | ||
| 13 | "cell_type": "markdown", | ||
| 14 | "metadata": {}, | ||
| 15 | "source": [ | ||
| 16 | "**Exercise 1 (6 points)**\n", | ||
| 17 | "\n", | ||
| 18 | "Use Sage to find the intersection points *in the real plane* (that is, only those points such that *both* coordinates are real numbers) of the following pairs of geometric objects:\n", | ||
| 19 | "\n", | ||
| 20 | "* The circle of equation $x^2 + y^2 = 4$ and the ellipse of equation $\\left(\\frac x2\\right)^2 + (2y)^2 = 4$.\n", | ||
| 21 | "* The circle of equation $x^2 + y^2 = 4$ and the ellipse of equation $\\left(\\frac x2-2\\right)^2 + (2y)^2 = 4$.\n", | ||
| 22 | "* The curve of equation $y^2 = x^3 -x +1$ and the horizontal line $y=10$.\n", | ||
| 23 | "* The $x$-axis and the graph of the function $f(x)=\\log(x) - e^{-x}$. *Hint: $f(x)$ has only one real zero.*" | ||
| 24 | ] | ||
| 25 | }, | ||
| 26 | { | ||
| 27 | "cell_type": "code", | ||
| 28 | "execution_count": null, | ||
| 29 | "metadata": {}, | ||
| 30 | "outputs": [], | ||
| 31 | "source": [] | ||
| 32 | }, | ||
| 33 | { | ||
| 34 | "cell_type": "markdown", | ||
| 35 | "metadata": {}, | ||
| 36 | "source": [ | ||
| 37 | "**Exercise 2 (6 points)**\n", | ||
| 38 | "\n", | ||
| 39 | "(a) Use Sage to compute\n", | ||
| 40 | "* the derivative\n", | ||
| 41 | "* a primite (i.e. integral)\n", | ||
| 42 | "* the power series expansion around $0$ up to order $4$\n", | ||
| 43 | "\n", | ||
| 44 | "of the following functions:\n", | ||
| 45 | "* $f(x) = e^x$\n", | ||
| 46 | "* $f(x) = \\sin(x)$\n", | ||
| 47 | "* $f(x) = \\cos(x)$\n", | ||
| 48 | "* $f(x) = \\tan(x)$\n", | ||
| 49 | "* $f(x) = \\log(1+x)$\n", | ||
| 50 | "* $f(x) = \\sqrt[3]{1+x}$\n", | ||
| 51 | "\n", | ||
| 52 | "(b) Use Sage to get the Latex code that represents the objects you computed above.\n", | ||
| 53 | "\n", | ||
| 54 | "(c) Arrange the results of the previous points in a table in Latex. The table should have 4 columns (function, derivative, integral, series) and one row for each of the functions above. *Note: when including Latex in a Markdown cell in Jupyter you will not receive any warning if you make mistakes; instead the Latex will simply not be rendered and it will appear as plain text. If you have troubles making this work you can send me a separate .tex (and .pdf) file.*" | ||
| 55 | ] | ||
| 56 | }, | ||
| 57 | { | ||
| 58 | "cell_type": "code", | ||
| 59 | "execution_count": null, | ||
| 60 | "metadata": {}, | ||
| 61 | "outputs": [], | ||
| 62 | "source": [ | ||
| 63 | "# Compute derivatives etc..." | ||
| 64 | ] | ||
| 65 | }, | ||
| 66 | { | ||
| 67 | "cell_type": "code", | ||
| 68 | "execution_count": null, | ||
| 69 | "metadata": {}, | ||
| 70 | "outputs": [], | ||
| 71 | "source": [ | ||
| 72 | "# Compute Latex code" | ||
| 73 | ] | ||
| 74 | }, | ||
| 75 | { | ||
| 76 | "cell_type": "markdown", | ||
| 77 | "metadata": {}, | ||
| 78 | "source": [ | ||
| 79 | "(Write your table here)" | ||
| 80 | ] | ||
| 81 | }, | ||
| 82 | { | ||
| 83 | "cell_type": "markdown", | ||
| 84 | "metadata": {}, | ||
| 85 | "source": [ | ||
| 86 | "**Exercise 3 (4 points)**\n", | ||
| 87 | "\n", | ||
| 88 | "The equation\n", | ||
| 89 | "\\begin{align*}\n", | ||
| 90 | "y^2+x^{16}=1\n", | ||
| 91 | "\\end{align*}\n", | ||
| 92 | "determines a closed curve in $\\mathbb R^2$ that looks like a rounded square. Determine the area of that shape, giving both an exact value (which might depend on some functions that Sage knows, but you don't) and an approximate value." | ||
| 93 | ] | ||
| 94 | }, | ||
| 95 | { | ||
| 96 | "cell_type": "code", | ||
| 97 | "execution_count": null, | ||
| 98 | "metadata": {}, | ||
| 99 | "outputs": [], | ||
| 100 | "source": [] | ||
| 101 | }, | ||
| 102 | { | ||
| 103 | "cell_type": "markdown", | ||
| 104 | "metadata": {}, | ||
| 105 | "source": [ | ||
| 106 | "**Exercise 4 (12 points)**\n", | ||
| 107 | "\n", | ||
| 108 | "A team of biologists is monitoring the population of river shrimps in the Alzette. At first they thought that the size $P(t)$ of their population on day $t$ would satisfy the differential equation $P'(t)=P(t)/10$. However this does not work well with the data they have collected, so they now believe that the population of shrimps follows the formula $P'(t)=P(t)/10-b$ for some value of $b$ between 1 and 100. They need your help here.\n", | ||
| 109 | "\n", | ||
| 110 | "(a) Using Sage, find a solution for the differential equation with initial conditions\n", | ||
| 111 | "\\begin{align*}\n", | ||
| 112 | "\\begin{cases}\n", | ||
| 113 | "P'(t)&=\\frac{P(t)}{10}-b\\\\\n", | ||
| 114 | "P(1)&=1000\n", | ||
| 115 | "\\end{cases}\n", | ||
| 116 | "\\end{align*}\n", | ||
| 117 | "where $b$ is a generic constant.\n", | ||
| 118 | "\n", | ||
| 119 | "(b) The list `data` in the cell below contains the actual number of shrimps that was measured every day from day $1$ (the $0$ at the beginning is meaningless, but it will help to keep it there). Plot in one single picture, possibly using different colors for each:\n", | ||
| 120 | "* The data as a bar chart.\n", | ||
| 121 | "* A curve that interpolates the data, using one of the methods shown in class.\n", | ||
| 122 | "* The solution of the differential equation for $b=0$.\n", | ||
| 123 | "* The solution of the differential equation for a value of $b$ of your choice ($1\\leq b\\leq 100$) that fits the data better than $b=0$. *(For this last point there is no right or wrong choice, just pick one that looks good)*" | ||
| 124 | ] | ||
| 125 | }, | ||
| 126 | { | ||
| 127 | "cell_type": "code", | ||
| 128 | "execution_count": null, | ||
| 129 | "metadata": {}, | ||
| 130 | "outputs": [], | ||
| 131 | "source": [ | ||
| 132 | "data = [0, 1000, 1123, 1223, 1190, 1432, 1553, 1709, 1826, 1980, 2146, 2172, 2383, 2588, 2822, 3401, 3330, 4157, 3994, 4995, 5392, 5910, 6468, 7128, 7325, 7984, 9634, 10473, 11761, 12777]\n" | ||
| 133 | ] | ||
| 134 | }, | ||
| 135 | { | ||
| 136 | "cell_type": "markdown", | ||
| 137 | "metadata": {}, | ||
| 138 | "source": [ | ||
| 139 | "**Grading**\n", | ||
| 140 | "\n", | ||
| 141 | "This homework assignment is worth $28$ ($24+4$) points, distributed as described above.\n", | ||
| 142 | "\n", | ||
| 143 | "Your final grade for the course will be the total of points you obtained (notice that the maximum is $20+20+16+28=84$) divided by $4$, rounded to the nearest integer. More precisely\n", | ||
| 144 | "\n", | ||
| 145 | "\\begin{align*}\n", | ||
| 146 | "\\operatorname{grade} = \\operatorname{min}\\left(20, \\left\\lfloor \\frac{\\operatorname{total}}{4} + 0.5\\right\\rfloor\\right)\n", | ||
| 147 | "\\end{align*}" | ||
| 148 | ] | ||
| 149 | } | ||
| 150 | ], | ||
| 151 | "metadata": { | ||
| 152 | "kernelspec": { | ||
| 153 | "display_name": "SageMath 9.0", | ||
| 154 | "language": "sage", | ||
| 155 | "name": "sagemath" | ||
| 156 | }, | ||
| 157 | "language_info": { | ||
| 158 | "codemirror_mode": { | ||
| 159 | "name": "ipython", | ||
| 160 | "version": 3 | ||
| 161 | }, | ||
| 162 | "file_extension": ".py", | ||
| 163 | "mimetype": "text/x-python", | ||
| 164 | "name": "python", | ||
| 165 | "nbconvert_exporter": "python", | ||
| 166 | "pygments_lexer": "ipython3", | ||
| 167 | "version": "3.8.5" | ||
| 168 | } | ||
| 169 | }, | ||
| 170 | "nbformat": 4, | ||
| 171 | "nbformat_minor": 4 | ||
| 172 | } | ||
