aboutsummaryrefslogtreecommitdiff
path: root/src/Homework4/Homework4.ipynb
blob: 99481b95feceda8dde5244ddb4f08449c14db250 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "*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",
    "\n",
    "**Deadline:** Sunday, June 6."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Exercise 1 (6 points)**\n",
    "\n",
    "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",
    "\n",
    "* The circle of equation $x^2 + y^2 = 4$ and the ellipse of equation $\\left(\\frac x2\\right)^2 + (2y)^2 = 4$.\n",
    "* The circle of equation $x^2 + y^2 = 4$ and the ellipse of equation $\\left(\\frac x2-2\\right)^2 + (2y)^2 = 4$.\n",
    "* The curve of equation $y^2 = x^3 -x +1$ and the horizontal line $y=10$.\n",
    "* The $x$-axis and the graph of the function $f(x)=\\log(x) - e^{-x}$. *Hint: $f(x)$ has only one real zero.*"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Exercise 2 (6 points)**\n",
    "\n",
    "(a) Use Sage to compute\n",
    "* the derivative\n",
    "* a primite (i.e. integral)\n",
    "* the power series expansion around $0$ up to order $4$\n",
    "\n",
    "of the following functions:\n",
    "* $f(x) = e^x$\n",
    "* $f(x) = \\sin(x)$\n",
    "* $f(x) = \\cos(x)$\n",
    "* $f(x) = \\tan(x)$\n",
    "* $f(x) = \\log(1+x)$\n",
    "* $f(x) = \\sqrt[3]{1+x}$\n",
    "\n",
    "(b) Use Sage to get the Latex code that represents the objects you computed above.\n",
    "\n",
    "(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.*"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Compute derivatives etc..."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Compute Latex code"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "(Write your table here)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Exercise 3 (4 points)**\n",
    "\n",
    "The equation\n",
    "\\begin{align*}\n",
    "y^2+x^{16}=1\n",
    "\\end{align*}\n",
    "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."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Exercise 4 (12 points)**\n",
    "\n",
    "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",
    "\n",
    "(a) Using Sage, find a solution for the differential equation with initial conditions\n",
    "\\begin{align*}\n",
    "\\begin{cases}\n",
    "P'(t)&=\\frac{P(t)}{10}-b\\\\\n",
    "P(1)&=1000\n",
    "\\end{cases}\n",
    "\\end{align*}\n",
    "where $b$ is a generic constant.\n",
    "\n",
    "(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",
    "* The data as a bar chart.\n",
    "* A curve that interpolates the data, using one of the methods shown in class.\n",
    "* The solution of the differential equation for $b=0$.\n",
    "* 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)*"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "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"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Grading**\n",
    "\n",
    "This homework assignment is worth $28$ ($24+4$) points, distributed as described above.\n",
    "\n",
    "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",
    "\n",
    "\\begin{align*}\n",
    "\\operatorname{grade} = \\operatorname{min}\\left(20, \\left\\lfloor \\frac{\\operatorname{total}}{4} + 0.5\\right\\rfloor\\right)\n",
    "\\end{align*}"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "SageMath 9.0",
   "language": "sage",
   "name": "sagemath"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}

Generated with cgit - Back to sebastiano.tronto.net