mathsoftware

A course about LaTeX and SageMath
git clone https://git.tronto.net/mathsoftware
Download | Log | Files | Refs | README | LICENSE

commit 462dca8585cb64bcb032ad8b1b8f3b2a6b02e172
parent e995905df49fefdef231aeb16e7f4afd7994c9fe
Author: Sebastiano Tronto <sebastiano.tronto@gmail.com>
Date:   Wed,  2 Feb 2022 10:23:57 +0100

Changed email address

Diffstat:
AHomework/.ipynb_checkpoints/Homework4-checkpoint.ipynb | 172+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MHomework/Homework4.ipynb | 2+-
AHomework/Retake1.pdf | 0
CLectures/7-SageAlgebra.ipynb -> Lectures/.ipynb_checkpoints/7-SageAlgebra-checkpoint.ipynb | 0
MLectures/7-SageAlgebra.ipynb | 4++--
MREADME.md | 2+-
Asrc/Lecture5/live/.ipynb_checkpoints/7-SageAlgebra-modified+solutions-checkpoint.ipynb | 1099+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Msrc/Lecture5/live/7-SageAlgebra-modified+solutions.ipynb | 4++--
Asrc/Retake/Retake1.aux | 4++++
Asrc/Retake/Retake1.log | 583+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/Retake/Retake1.pdf | 0
Asrc/Retake/Retake1.tex | 208+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/Retake/bc.png | 0
13 files changed, 2072 insertions(+), 6 deletions(-)

diff --git a/Homework/.ipynb_checkpoints/Homework4-checkpoint.ipynb b/Homework/.ipynb_checkpoints/Homework4-checkpoint.ipynb @@ -0,0 +1,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.2", + "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 +} diff --git a/Homework/Homework4.ipynb b/Homework/Homework4.ipynb @@ -150,7 +150,7 @@ ], "metadata": { "kernelspec": { - "display_name": "SageMath 9.0", + "display_name": "SageMath 9.2", "language": "sage", "name": "sagemath" }, diff --git a/Homework/Retake1.pdf b/Homework/Retake1.pdf Binary files differ. diff --git a/Lectures/7-SageAlgebra.ipynb b/Lectures/.ipynb_checkpoints/7-SageAlgebra-checkpoint.ipynb diff --git a/Lectures/7-SageAlgebra.ipynb b/Lectures/7-SageAlgebra.ipynb @@ -1024,7 +1024,7 @@ ], "metadata": { "kernelspec": { - "display_name": "SageMath 9.2", + "display_name": "SageMath 9.0", "language": "sage", "name": "sagemath" }, @@ -1038,7 +1038,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.5" + "version": "3.8.10" } }, "nbformat": 4, diff --git a/README.md b/README.md @@ -76,7 +76,7 @@ the beginning of the course is enough. Moreover, you should remove or replace the university logo and my email address, which you can replace with your own or with my personal address -`sebastiano [dot] tronto [at] gmail [dot] com`. +`sebastiano@tronto.net`. Below you can find some details on how the course was taught. diff --git a/src/Lecture5/live/.ipynb_checkpoints/7-SageAlgebra-modified+solutions-checkpoint.ipynb b/src/Lecture5/live/.ipynb_checkpoints/7-SageAlgebra-modified+solutions-checkpoint.ipynb @@ -0,0 +1,1099 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "This lecture's notes are in a different format: the presentations for the $\\LaTeX$ part were made with $\\LaTeX$, so this one is made with Sage, or rather with the [Jupyter Notebook](https://jupyter.org/).\n", + "\n", + "# The Jupyter Notebook\n", + "**Reference:** [[1](https://jupyter.org/documentation)]\n", + "\n", + "The Jupyter Notebook is one of the default interfaces for SageMath, along with the command line interface. You can access it via web browser, but it is running locally on your device (notice the strange url: `http://localhost:8888/notebooks...`).\n", + "\n", + "You can create a new notebook by clicking on `New > SageMath 9.2`. You can also create a Python 3 notebook to write Python code.\n", + "\n", + "Jupyter saves and reads files in the `.ipynb` format. If you download the file for this lecture you can open it and follow the examples interactively.\n", + "\n", + "## Cells\n", + "\n", + "The notebook contains one or more *interactive cells* that you can run, like this one below:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Exercise: modify this cell to use the print() command\n", + "\n", + "a = 34*102\n", + "\n", + "print(2+2)\n", + "print(\"hello\")\n", + "print(a-1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "If you are reading this from Jupyter rather than from the pdf file, you can edit the cell above and run it again. You can also add more cells by selecting `Insert` from the menu bar.\n", + "\n", + "Notice that only the last statement produces an output. You can force anything to be written as output with the `print()` command, which works like in Python. As an exercise, try to modify the cell above to provide more output!" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "print(a)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "text *hello*\n", + "* this\n", + "* is\n", + "* a list" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Markdown\n", + "\n", + "[Markdown](https://en.wikipedia.org/wiki/Markdown) is a simple markup language - think of LaTeX or html, but much simpler.\n", + "You can add text to your notebook with Markdown cells by selecting `Cell > Cell Type > Markdown`.\n", + "\n", + "You can also include some LaTeX code in Markdown cells, with dollar signs $ or align environments:\n", + "\n", + "\\begin{align*}\n", + "\\frac{(x+y)^2}{x+1} = \\frac{x^2+2xy+y^2}{x+1}\n", + "\\end{align*}\n", + "\n", + "When you are done writing a Markdown cell, you can run it to see the well-formatted text. To edit the text again, double-click on the cell. Try doing it now to fix the formula above!" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Symbolic expressions\n", + "\n", + "**Reference:** [[2](https://doc.sagemath.org/html/en/reference/calculus/sage/symbolic/expression.html)]\n", + "\n", + "Now, let's get started with Sage. One thing you might want to do is manipulating symbolic expressions, like the following:" + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[\n", + "x == -1/2*(I*sqrt(3) + 1)*(1/2*I*sqrt(3) - 1/2)^(1/3) + (1/2*I*sqrt(3) - 1/2)^(2/3) - 1,\n", + "x == (1/2*I*sqrt(3) - 1/2)^(4/3) - 1/2*(I*sqrt(3) + 1)/(1/2*I*sqrt(3) - 1/2)^(1/3) - 1,\n", + "x == (1/2*I*sqrt(3) - 1/2)^(1/3) + 1/(1/2*I*sqrt(3) - 1/2)^(1/3) - 1\n", + "]\n" + ] + } + ], + "source": [ + "f = (x^2 + 2*x - 5 >= 0)\n", + "solve(f,x)\n", + "\n", + "g = x^3 + 3*x^2-1\n", + "print(solve(g==0, x))\n", + "\n", + "h = x^2 +3*x -1" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Notice that the single `=` is part of an assignment, as in Python: we are *assigning* to the variable `f` the value `x^2 + 2*x - 5 >= 0`, which in this case is an equation, so it contains the symbol `==`. Keep in mind the difference between the two!\n", + "\n", + "**Exercise:** change the code above to solve the corresponding inequality $x^2+2x-5\\geq 0$." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Mathematical variables\n", + "\n", + "Last time we saw what *variables* are in Python, and that they are a little bit different from the *Mathematical variables* that you use in Mathematics. In Sage, both concepts are present, but they are still distinct. For example in the cell above `f` is a variable in the sense of computer science, while `x` is a Mathematical variable.\n", + "\n", + "If you want to use Mathematical variables other than `x`, you first need to *declare* them with the `var()` command:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "var('z')\n", + "solve(z^2 + z - 2 == 0, z)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Try removing the first line in the cell above and see what error you get!\n", + "\n", + "Here is another example:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "var('a', 'b')\n", + "f = x^2+a*x+b == 0\n", + "solve(f,a)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Some common constants are [already defined](https://doc.sagemath.org/html/en/reference/calculus/sage/symbolic/expression.html) in Sage:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "e^(pi*I)\n", + "print(N(pi), N(e))\n", + "e = 42\n", + "print(e)\n", + "reset('e')\n", + "print(N(e))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We will study symbolic expressions more in detail next time, in the context of calculus/analysis." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Basic rings and fields\n", + "\n", + "**References:** [[3](https://doc.sagemath.org/html/en/reference/rings_standard/index.html)]\n", + "[[4](https://doc.sagemath.org/html/en/reference/rings_numerical/index.html)]\n", + "[[5](https://doc.sagemath.org/html/en/reference/finite_rings/index.html)]\n", + "\n", + "As you should know, a *field* is a Mathematical structure with two operations, addition and multiplication, which respect certain rules (distributivity, associativity, commutativity...). Some examples of fields are the Rational numbers $\\mathbb Q$, the Real numbers $\\mathbb R$ and the Complex numbers $\\mathbb C$, but there are many more. As you should also know, a *(commutative) ring* is like a field, except not all elements different from $0$ need have a multiplicative inverse. For example the integers $\\mathbb Z = \\{ \\dots, -1, 0, 1, 2, \\dots\\}$ are a ring, but not a field.\n", + "\n", + "These structures are already implemented in Sage. Some of the most common are listed in the following table:\n", + "\n", + "|Mathematical object|Math symbol|Sage name|\n", + "|------------------:|:---------:|:--------|\n", + "|Integers|$\\mathbb Z$|`ZZ`|\n", + "|Rational numbers|$\\mathbb Q$|`QQ`|\n", + "|Real numbers|$\\mathbb R$|`RR`|\n", + "|Complex numbers|$\\mathbb C$|`CC`|\n", + "|Integers modulo $n$|$\\mathbb Z/n\\mathbb Z$|`Integers(n)`|\n", + "|Finite fields|$\\mathbb F_p$|GF(p)|\n", + "|$\\dots$|$\\dots$|$\\dots$|" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "If you write a number or an expression, Sage will figure out where it \"lives\", choosing the most restrictive interpretation possible. For example `3` will be interpreted to be an integer, even if it is also a rational number, a real number and a complex number." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Parents and coercion\n", + "**Reference:** [[6](https://doc.sagemath.org/html/en/tutorial/tour_coercion.html)]\n", + "\n", + "You can check where an object \"lives\" with the `parent()` command. It works more or less like the Python command `type()`, but it gives a more Mathematically inclined answer. Check the reference link [6] above if you want more details." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#Edit this cell to find out the type of other objects that we used\n", + "print(parent(3/5))\n", + "print(QQ)\n", + "print(type(3/5))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Sometimes Sage does not give you the best possible interpretation, so you can force something to be interpreted as living in a smaller ring as follows:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "minus_one = e^(pi*I)\n", + "print(minus_one)\n", + "minus_one_coerced = ZZ(e^(pi*I)) # coercion\n", + "#print(ZZ(1/2))\n", + "print(parent(minus_one))\n", + "print(parent(x^2))\n", + "print(parent(minus_one_coerced))\n", + "print(parent(5.2))\n", + "print(parent(QQ(5.2)))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "**Remark.** Notice that there is a fundamental difference between the rings `RR` and `CC` and all the others in the table above: the real and complex numbers are *approximated*." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "print(QQ(3))\n", + "print(RR(3))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "You can also choose the precision of this approximation using the alternative name `RealField`." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "print(RR)\n", + "print(RealField(prec=1000))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Polynomial rings\n", + "\n", + "**Reference:** [[7](https://doc.sagemath.org/html/en/reference/polynomial_rings/index.html)]\n", + "\n", + "If you want to work with polynomials over a certain ring it is better to use this specific construction, rather than the symbolic expressions introduced above." + ] + }, + { + "cell_type": "code", + "execution_count": 55, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Univariate Polynomial Ring in x over Rational Field\n", + "[]\n", + "[(-2, 2)]\n" + ] + } + ], + "source": [ + "polring.<x> = QQ[] # Alternative: polring.<x,y,z> = PolynomialRing(RR)\n", + "polring\n", + "print(parent(x))\n", + "g = x^3 + 3*x^2-1\n", + "print(g.roots())\n", + "print((x^2+4*x+4).roots())" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "You can use as many variables as you like, and you can replace `RR` with any ring. In the example above `polring` is just the name of the variable (in the computer science sense) associated with this polynomial ring.\n", + "\n", + "## Operations on polynomials\n", + "\n", + "The usual Mathematical operations are available on polynomial rings, including Euclidean division `//` and remainder `%`. There is also the single-slash division `/`, but the result may not be a polynomial anymore.\n", + "\n", + "**Exercise:** use the `parent()` command to find out what the quotient of two polynomials is.\n", + "\n", + "**Question:** what happens if you remove the first line in the cell below? What if we used the variable `y` instead of `x`?" + ] + }, + { + "cell_type": "code", + "execution_count": 60, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x + 1\n", + "-4\n", + "(x^2 + 2*x - 3)/(x + 1)\n", + "Fraction Field of Univariate Polynomial Ring in x over Rational Field\n" + ] + }, + { + "data": { + "text/plain": [ + "x^4 + 2*x^3 - 4*x^2 - 2*x + 3" + ] + }, + "execution_count": 60, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "polring.<x> = QQ[]\n", + "p = x^2 + 2*x - 3 # Don't forget * for multiplication!\n", + "q = p // (x+1)\n", + "r = p % (x+1)\n", + "f = p / (x+1)\n", + "print(q)\n", + "print(r)\n", + "print(f)\n", + "print(parent(f))\n", + "p*(x^2-1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "You can do more complex operations. Try out `roots()` and `factor` in the cell below.\n", + "\n", + "**Remark.** Notice how the result can change substantially if you change the base ring.\n", + "\n", + "**Remark.** [Factorizations](https://doc.sagemath.org/html/en/reference/structure/sage/structure/factorization.html) are a particular object in Sage. They are kinda like a list, but not really. You can get a list of pairs (factor, power) with `list(factor(f))`." + ] + }, + { + "cell_type": "code", + "execution_count": 76, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(t + 1) * (t^2 - 3) * (t^2 + 1)\n", + "[(t + 1, 1), (t^2 - 3, 1), (t^2 + 1, 1)]\n", + "t^5 + t^4 - 2*t^3 - 2*t^2 - 3*t - 3\n", + "t^2 - 1\n", + "[(-1, 1)]\n", + "Multivariate Polynomial Ring in x, y, z over Rational Field\n" + ] + }, + { + "data": { + "text/plain": [ + "Multivariate Polynomial Ring in x, y, z over Rational Field" + ] + }, + "execution_count": 76, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "polring_onevar.<t> = QQ[]\n", + "\n", + "f = t^5 + t^4 - 2*t^3 - 2*t^2 - 3*t - 3\n", + "fact = factor(f)\n", + "print(factor(f))\n", + "print(list(fact))\n", + "print((t + 1) * (t^2 - 3) * (t^2 + 1))\n", + "print((t+1)*(t-1))\n", + "print(f.roots()) # Result: list of pairs (root,multiplicity)\n", + "\n", + "polring_manyvar.<x,y,z> = QQ[]\n", + "factor(x*y+x)\n", + "\n", + "# The following line gives an error, because the polynomial\n", + "# is understood to possibly have many variables:\n", + "print(parent(x))\n", + "(QQ['x'](x^2-1)).roots()\n", + "parent(x)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Matrices and vectors\n", + "\n", + "**References:** [[8](https://doc.sagemath.org/html/en/reference/matrices/index.html)], but in particular the subections [[9](https://doc.sagemath.org/html/en/reference/matrices/sage/matrix/docs.html)] and [[10](https://doc.sagemath.org/html/en/reference/matrices/sage/matrix/matrix2.html)]\n", + "\n", + "In Sage you can easily manipulate matrices and vectors" + ] + }, + { + "cell_type": "code", + "execution_count": 94, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[ 1 2 3]\n", + "[ 0 0 1]\n", + "[ 4 -3 22/7] \n", + "\n", + "[1/2 0 0]\n", + "[ 7 0 0]\n", + "[ 1 1 1] \n", + "\n", + "[1 0]\n", + "[0 1] \n", + "\n", + "(3/2, 21, 6) \n", + "\n", + "[ -7/2 -10 80/7]\n", + "[ 17 -4 15/7]\n", + "[ 241/7 -18/7 869/49] \n", + "\n", + "Rank of A = 3\n", + "Rank of B = 2\n" + ] + }, + { + "data": { + "text/plain": [ + "11" + ] + }, + "execution_count": 94, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "A = matrix([[1,2,3],[0,0,1],[4,-3,22/7]])\n", + "B = matrix([[1/2,0,0],[7,0,0],[1,1,1]])\n", + "C = matrix([[1,0],[0,1]])\n", + "v = vector([3,4,-1])\n", + "\n", + "print(A, \"\\n\") # \\n just means \"newline\"\n", + "print(B, \"\\n\")\n", + "print(C, \"\\n\")\n", + "#print(A*C) Error!\n", + "print(B*v, \"\\n\")\n", + "print(A^2 + 2*B - A*B, \"\\n\")\n", + "\n", + "print(\"Rank of A =\", rank(A)) # You can also use A.rank()\n", + "print(\"Rank of B =\", rank(B))\n", + "A.determinant()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "**Exercise:** in the cell above, compute the determinant, inverse and characteristic polynomial of the matrix `A`. *Hint: look at the reference [10] above (the functions are listed in alphabetic order).*\n", + "\n", + "As for polynomials, you can specify where a matrix or a vector lives" + ] + }, + { + "cell_type": "code", + "execution_count": 97, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Full MatrixSpace of 2 by 2 dense matrices over Complex Field with 53 bits of precision" + ] + }, + "execution_count": 97, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "M = matrix(CC, [[0,1/2],[1,0]])\n", + "parent(M)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "You can also solve linear systems and compute eigenvalues and eigenvectors of a matrix\n", + "\n", + "**Warning.** In linear algebra there are distinct concepts of *left* and *right* eigenvalues (and eigenvector). The one you know is probably that of **right** eigen-{value,vector}, that is an element $\\lambda$ of the base field and a non-zero vector $\\mathbf v$ with $A\\mathbf v=\\lambda\\mathbf v$. The other concept corresponds to the equality $\\mathbf v^TA=\\lambda \\mathbf v$." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "A = Matrix(RR, [[sqrt(59),32],[-1/4,3]])\n", + "v = vector(RR, [3,0])\n", + "A.solve_right(v) # Solve Ax=v. Alternative: A \\ v" + ] + }, + { + "cell_type": "code", + "execution_count": 103, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "<ipython-input-103-d1ccc4990851>:2: UserWarning: Using generic algorithm for an inexact ring, which will probably give incorrect results due to numerical precision issues.\n", + " A.eigenvalues() # Also: A.eigenvalues(), A.eigenvectors_right()\n" + ] + }, + { + "data": { + "text/plain": [ + "[5.37228132326901, -0.372281323269014]" + ] + }, + "execution_count": 103, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "A = Matrix(RR, [[1,2],[3,4]])\n", + "A.eigenvalues() # Also: A.eigenvalues(), A.eigenvectors_right()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We can also extract a specific submatrix by selecting only some rows and columns, with a syntax similar to that of Python's lists. Check out more examples in the reference [9] above, and try them in the cell below." + ] + }, + { + "cell_type": "code", + "execution_count": 105, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[ -3 -25 -5 -3 61 0 -1]\n", + "[ 23 0 -1 1 0 1 -1]\n", + "[286 2 7 0 -21 -1 0]\n", + "[ 2 -1 -2 0 -1 4 0]\n", + "[ 1 -1 1 0 2 -2 7]\n", + "[ 0 15 -1 0 -3 1 -1]\n", + "[ -1 1 -2 0 2 1 1] \n", + "\n", + "[ -1 1 0]\n", + "[ 7 0 -21] \n", + "\n", + "[ -3 -25 -5 -3 61 0 -1] \n", + "\n", + "[ -3 -25 -5 -3 61]\n", + "[ 0 15 -1 0 -3]\n", + "[286 2 7 0 -21]\n", + "-25\n" + ] + } + ], + "source": [ + "A = MatrixSpace(ZZ, 7).random_element()\n", + "print(A, \"\\n\")\n", + "print(A[1:3,2:5], \"\\n\") # Rows from 1 to 3, columns from 2 to 5\n", + "print(A[0,0:], \"\\n\") # First row, all columns\n", + "print(A[[0,5,2],0:5]) # Rows 0, 5 and 2 (in this order) and columns 0 to 5\n", + "print(A[0,1])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "**Exercise:** write a sage function that computes the determinant of an $n\\times n$ matrix $A=(a_{ij})$ using Laplace's rule by the first row, that is \n", + "\\begin{align*}\n", + " \\operatorname{det}A = \\sum_{j=1}^n (-1)^ja_{0j}M_{0j}\n", + "\\end{align*}\n", + "where $M_{0j}$ is the determinant of the $(n-1)\\times(n-1)$ matrix obtained by removing the $0$-th row and the $j$-th column from $A$." + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[ -1 -3 -1 11 2 -1 -5]\n", + "[ 1 0 0 -6 -1 0 1]\n", + "[ 1 0 -1 0 1 -1 0]\n", + "[-24 1 -2 -7 4 0 1]\n", + "[ -3 0 -1 0 6 -1 0]\n", + "[-17 -1 1 0 28 1 0]\n", + "[ 1 -4 1 1 -2 -6 -2]\n", + "Sage determinant: 13578\n", + "my_det: 13578\n" + ] + } + ], + "source": [ + "def my_det(A):\n", + " if not A.is_square():\n", + " print(\"Error: matrix is not square\")\n", + " \n", + " n = A.nrows() # size of the matrix\n", + " \n", + " if n == 1:\n", + " return A[0,0]\n", + " \n", + " my_sum = 0\n", + " for j in range(0,n):\n", + " rows = range(1,n)\n", + " columns = [element for element in range(0,n) if element != j]\n", + " submatrix = A[rows,columns]\n", + " my_sum += (-1)^j * A[0,j] * my_det(submatrix)\n", + " \n", + " return my_sum\n", + "\n", + "A = MatrixSpace(ZZ, 7).random_element()\n", + "print(A)\n", + "print(\"Sage determinant: \", A.determinant())\n", + "print(\"my_det: \", my_det(A))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Number Theory\n", + "\n", + "**Reference:** [[11](https://doc.sagemath.org/html/en/reference/rings_standard/sage/rings/integer.html)]\n", + "\n", + "Sage includes a large library of functions for computing with the integers, see the link above." + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "3^2 * 3607 * 3803\n", + "[(3, 2), (3607, 1), (3803, 1)]\n", + "True\n", + "True\n", + "619703040\n", + "9\n", + "13548070123626141\n" + ] + } + ], + "source": [ + "n = 123456789\n", + "m = 987654321\n", + "p = 3607\n", + "\n", + "print(factor(n))\n", + "print(list(factor(n)))\n", + "print(is_prime(p))\n", + "print(p.divides(n))\n", + "print(euler_phi(m))\n", + "print(gcd(n, m))\n", + "print(lcm(n, m))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Primes\n", + "\n", + "**Reference:** [[12](https://doc.sagemath.org/html/en/reference/sets/sage/sets/primes.html)]\n", + "\n", + "The set of prime numbers is called `Primes()`. It is like an infinite list: for example you can get the one-millionth prime number or you can use this list to create other lists. You can also check what the first prime number larger than a given number is." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Set of all prime numbers: 2, 3, 5, 7, ...\n", + "31 252097800629\n", + "47\n", + "[79, 83, 89, 97]\n" + ] + } + ], + "source": [ + "PP = Primes()\n", + "print(PP)\n", + "print(PP[10], PP[10^10])\n", + "print(PP.next(44))\n", + "\n", + "First_Thousand_Primes = PP[0:1000]\n", + "print([p for p in First_Thousand_Primes if p < 100 and p > 75])\n", + "#print([p for p in PP if p < 100 and p > 75])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## The Chinese remainder theorem (CRT)\n", + "\n", + "We say that two integers $a$ and $b$ are *congruent* modulo another integer $n>0$ if they have the same remainder when divided by $n$. We denote this by $a\\equiv b\\pmod n$, or in Python/Sage syntax `a % n == b % n`.\n", + "\n", + "The Chinese remainder theorem states that if $a,b\\in\\mathbb Z$ and $n,m\\in \\mathbb Z_{>0}$ are such that $\\gcd(n,m)=1$ then the system of congruences\n", + "\n", + "\\begin{align*}\n", + "\\begin{cases}\n", + " x \\equiv a \\pmod n\\\\\n", + " x \\equiv b \\pmod m\n", + "\\end{cases}\n", + "\\end{align*}\n", + "\n", + "\n", + "has exactly one solution modulo $mn$. This means that there is one and only one number $x$ with $0\\leq x<mn$ such that $x\\equiv a\\pmod n$ and $x\\equiv b\\pmod m$.\n", + "\n", + "\n", + "For example:\n", + "\n", + "\\begin{align*}\n", + "\\begin{cases}\n", + " x \\equiv 1 \\pmod 3\\\\\n", + " x \\equiv 2 \\pmod 5\n", + "\\end{cases}\n", + "\\end{align*}\n", + "\n", + "Solution: $x=7$ (any other solution is congruent to $7$ modulo $15$; for example $22=15+7$ is also a solution).\n", + "\n", + "The procedure to find such a number is not too hard to describe (you might see it in an algebra or number theory course), but it can be a bit long. Luckily, Sage can do this for you:" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "74306 2 798\n" + ] + } + ], + "source": [ + "a = 2\n", + "b = -1\n", + "n = 172\n", + "m = 799\n", + "\n", + "if gcd(n,m) != 1:\n", + " print(\"The numbers are not comprime, I can't solve this!\")\n", + "else:\n", + " x = crt(a, b, n, m)\n", + " print(x, x%n, x%m)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "**Exercise.** There is a more general version of the Chinese remainder theorem which says that if $a_0, a_1, \\dots, a_k\\in\\mathbb Z$ and $n_0, n_2, \\dots, n_k\\in\\mathbb Z_{>0}$ are such that $\\gcd(n_i, n_j)=1$ for $i\\neq j$, then the system of congruences\n", + "\n", + "\\begin{align*}\n", + "\\begin{cases}\n", + " x \\equiv a_0 \\pmod {n_0}\\\\\n", + " x \\equiv a_1 \\pmod {n_1}\\\\\n", + " \\dots \\\\\n", + " x \\equiv a_k \\pmod {n_k}\n", + "\\end{cases}\n", + "\\end{align*}\n", + "\n", + "has exactly one solution modulo $\\prod_{i=0}^kn_i$. Use the `crt()` function to find a solution to such a system.\n", + "*Hint: start by running the command `help(crt)`." + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#help(crt)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Cryptography: RSA\n", + "\n", + "[Cryptography](https://en.wikipedia.org/wiki/Cryptography) is the discipline that studies methods to communicate secrets in such a way that any unauthorized listener would not be able to understand the message.\n", + "\n", + "A simple cryptographic protocol could be changing every letter of your text following a fixed scheme (or *cypher*), for example by turning every A into a B, every B into a C and so on. However this is not a very secure method, for many reasons. One of them is that at some point the people who want to communicate need to agree on what method to use, and anyone listening to that conversation would be able to decypher every subsequent conversation. A public-key cryptographic protocol solves this problem.\n", + "\n", + "## Public-key cryptography\n", + "\n", + "Public-key cryptographic protocols, such as RSA, work like this: there are two keys, a *private* key that is only known to person A (traditionally called Alice in every example), and a *public* key that does not need to be secret.\n", + "\n", + "The public key is used to *encrypt* the message (that is to \"lock\" it, or \"hyde\" it), but one needs the private key to *decrypt* it. Imagine having two keys for your door, but one can only be used to lock it, while the other only to open it.\n", + "\n", + "The message exchange works like this: suppose that person B (Bob) wants to send a secret message to Alice. Then Alice secretely generates a private and a public key and sends only the public one to Bob. Now Bob encrypts the message and sends it to Alice, who can use her private key to decrypt it. Even if Eve (short for *eavesdropper*, an unauthorized listener) listens to every message exchanged, she won't be able to decypher the secret: the private key has never left Alice's house!\n", + "\n", + "Notice that such a protocol is *asymmetric*: if Alice wanted to send a secret to Bob in reply, Bob would need to generate a pair of keys of his own.\n", + "\n", + "Let's see how we can do this in practice, using number theory!\n", + "\n", + "## RSA\n", + "\n", + "As many other cryptography protocols, RSA is based on a Mathematical process that is easy to do in one direction, but very hard to invert. In this case the hard process is integer factorization, that is decomposing an integer number as a product of primes." + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "True True False\n" + ] + }, + { + "data": { + "text/plain": [ + "1 loop, best of 1: 9.06 s per loop" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "p = 100003100019100043100057100069\n", + "q = 100144655312449572059845328443\n", + "n = p*q\n", + "print(is_prime(p), is_prime(q), is_prime(p*q))\n", + "\n", + "# Use the command below to see how long it takes\n", + "timeit(\"factor(n)\", number=1, repeat=1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "In order to generate the keys, Alice picks a number $n$ which is the product of two large primes $p$ and $q$ of more or less the same size. Finding such primes is relatively easy compared to factoring the number $n$ she obtained. Then she computes the Euler totient $\\varphi(n)=(p-1)(q-1)$ of $n$, which she can do because she knows that $n=pq$ - it would be impossible otherwise!\n", + "\n", + "Then Alice can compute two integers $(d,e)$ such that $de\\equiv 1\\pmod{\\varphi(n)}$. She will send the numbers $n$ and $d$ to Bob and keep $e$ secret. In this case the public key is the pair $(n,d)$, while $e$ is the private key.\n", + "\n", + "Of course, she does all of this using Sage!" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(338547806707501, 141995674537431, 107165393087271)" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "def two_large_primes():\n", + " p, q = 0, 0\n", + " # We make sure that they are different\n", + " while p == q:\n", + " p = Primes()[randint(10^6, 2*10^6)]\n", + " q = Primes()[randint(10^6, 2*10^6)]\n", + " return p, q\n", + "\n", + "def random_unit_mod(N):\n", + " R = Integers(N)\n", + " d = R(0)\n", + " # We make sure that it is invertible\n", + " while not d.is_unit():\n", + " d = R.random_element()\n", + " return d\n", + "\n", + "def Alice_generate_keys():\n", + " p, q = two_large_primes()\n", + " n = p*q\n", + " phi_n = (p-1)*(q-1) # euler_phi(n) is slow!\n", + " \n", + " d = random_unit_mod(phi_n)\n", + " e = d^-1\n", + " return n, d, e\n", + "\n", + "Alice_generate_keys()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Now, how does Bob encrypt his message? Let's say he wants to send to Alice the number $m$ with $1<m<n$ (In practice he would like to send her some text with emojis, or maybe a voice message; but for computers everything is a number, and there are different ways to translate any sort of information to a number. He just chooses one of the many standard methods that already exist, no cryptography is needed in this step. If the message $m$ is too long, he can split it up in some pieces and repeat the process multiple times.)\n", + "\n", + "Now he computes $m^d\\pmod n$ and sends it back to Alice." + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "177776139844621" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "def Bob_encrypt(m, n, d):\n", + " R = Integers(n)\n", + " return R(m)^d # Assume that n is large enough\n", + " \n", + "message = 42424242\n", + "Bob_encrypt(message, 338547806707501, 141995674537431)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Since $de\\equiv 1\\pmod{\\varphi(n)}$, it follows that $(m^d)^e\\equiv m\\pmod n$ (see [Wikipedia: Euler's theorem](https://en.wikipedia.org/wiki/Euler%27s_theorem)). So for Alice it is very easy to get back the original message:" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "42424242" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "def Alice_decrypt(m_encrypted, n, e):\n", + " R = Integers(n)\n", + " return R(m_encrypted)^e\n", + "\n", + "Alice_decrypt(177776139844621, 338547806707501, 107165393087271)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Another assumption on which RSA relies is that even if one knows $M=m^e$ and $e$, extracting the $e$-th root of $M$ modulo $n$ (and thus obtaining $m$) is very hard. Currently the best known way to do this is by factorizing $n$ first, which is considered to be a very hard problem. However, there is no proof that faster algorithms can't be devised.\n", + "\n", + "Moreover, one day we will overcome the current technological difficulties and quantum computers will be available. Quantum computers are not just \"more powerful\" than classical hardware, but they work based on completely different logical foundations and they make the factorization problem much easier to solve: for example [Shor's algorithm](https://en.wikipedia.org/wiki/Shor%27s_algorithm) takes advantage of this different logic and can factorize numbers quickly, if run on a quantum computer.\n", + "\n", + "To this day the largest number factorized with a quantum computer is $21=3\\times 7$. Nonetheless, quantum-safe cryptography protocols (i.e. based on problems that are hard to solve also with quantum computers) have already been developed." + ] + } + ], + "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.10" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/src/Lecture5/live/7-SageAlgebra-modified+solutions.ipynb b/src/Lecture5/live/7-SageAlgebra-modified+solutions.ipynb @@ -1077,7 +1077,7 @@ ], "metadata": { "kernelspec": { - "display_name": "SageMath 9.2", + "display_name": "SageMath 9.0", "language": "sage", "name": "sagemath" }, @@ -1091,7 +1091,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.5" + "version": "3.8.10" } }, "nbformat": 4, diff --git a/src/Retake/Retake1.aux b/src/Retake/Retake1.aux @@ -0,0 +1,4 @@ +\relax +\newlabel{prop:fta}{{1}{1}} +\newlabel{eq:fubini}{{2}{1}} +\gdef \@abspage@last{4} diff --git a/src/Retake/Retake1.log b/src/Retake/Retake1.log @@ -0,0 +1,583 @@ +This is pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2021/VoidLinux) (preloaded format=pdflatex 2021.12.14) 21 DEC 2021 11:16 +entering extended mode + \write18 enabled. + %&-line parsing enabled. +**Retake1.tex +(./Retake1.tex +LaTeX2e <2020-10-01> patch level 4 +L3 programming layer <2021-02-18> +(/usr/share/texmf-dist/tex/latex/base/article.cls +Document Class: article 2020/04/10 v1.4m Standard LaTeX document class +(/usr/share/texmf-dist/tex/latex/base/size12.clo +File: size12.clo 2020/04/10 v1.4m Standard LaTeX file (size option) +) +\c@part=\count179 +\c@section=\count180 +\c@subsection=\count181 +\c@subsubsection=\count182 +\c@paragraph=\count183 +\c@subparagraph=\count184 +\c@figure=\count185 +\c@table=\count186 +\abovecaptionskip=\skip47 +\belowcaptionskip=\skip48 +\bibindent=\dimen138 +) +(/usr/share/texmf-dist/tex/latex/base/inputenc.sty +Package: inputenc 2020/08/01 v1.3d Input encoding file +\inpenc@prehook=\toks15 +\inpenc@posthook=\toks16 +) +(/usr/share/texmf-dist/tex/latex/amsmath/amsmath.sty +Package: amsmath 2020/09/23 v2.17i AMS math features +\@mathmargin=\skip49 + +For additional information on amsmath, use the `?' option. +(/usr/share/texmf-dist/tex/latex/amsmath/amstext.sty +Package: amstext 2000/06/29 v2.01 AMS text + +(/usr/share/texmf-dist/tex/latex/amsmath/amsgen.sty +File: amsgen.sty 1999/11/30 v2.0 generic functions +\@emptytoks=\toks17 +\ex@=\dimen139 +)) +(/usr/share/texmf-dist/tex/latex/amsmath/amsbsy.sty +Package: amsbsy 1999/11/29 v1.2d Bold Symbols +\pmbraise@=\dimen140 +) +(/usr/share/texmf-dist/tex/latex/amsmath/amsopn.sty +Package: amsopn 2016/03/08 v2.02 operator names +) +\inf@bad=\count187 +LaTeX Info: Redefining \frac on input line 234. +\uproot@=\count188 +\leftroot@=\count189 +LaTeX Info: Redefining \overline on input line 399. +\classnum@=\count190 +\DOTSCASE@=\count191 +LaTeX Info: Redefining \ldots on input line 496. +LaTeX Info: Redefining \dots on input line 499. +LaTeX Info: Redefining \cdots on input line 620. +\Mathstrutbox@=\box47 +\strutbox@=\box48 +\big@size=\dimen141 +LaTeX Font Info: Redeclaring font encoding OML on input line 743. +LaTeX Font Info: Redeclaring font encoding OMS on input line 744. +\macc@depth=\count192 +\c@MaxMatrixCols=\count193 +\dotsspace@=\muskip16 +\c@parentequation=\count194 +\dspbrk@lvl=\count195 +\tag@help=\toks18 +\row@=\count196 +\column@=\count197 +\maxfields@=\count198 +\andhelp@=\toks19 +\eqnshift@=\dimen142 +\alignsep@=\dimen143 +\tagshift@=\dimen144 +\tagwidth@=\dimen145 +\totwidth@=\dimen146 +\lineht@=\dimen147 +\@envbody=\toks20 +\multlinegap=\skip50 +\multlinetaggap=\skip51 +\mathdisplay@stack=\toks21 +LaTeX Info: Redefining \[ on input line 2923. +LaTeX Info: Redefining \] on input line 2924. +) +(/usr/share/texmf-dist/tex/latex/amsfonts/amsfonts.sty +Package: amsfonts 2013/01/14 v3.01 Basic AMSFonts support +\symAMSa=\mathgroup4 +\symAMSb=\mathgroup5 +LaTeX Font Info: Redeclaring math symbol \hbar on input line 98. +LaTeX Font Info: Overwriting math alphabet `\mathfrak' in version `bold' +(Font) U/euf/m/n --> U/euf/b/n on input line 106. +) +(/usr/share/texmf-dist/tex/latex/amsfonts/amssymb.sty +Package: amssymb 2013/01/14 v3.01 AMS font symbols +) +(/usr/share/texmf-dist/tex/latex/amscls/amsthm.sty +Package: amsthm 2020/05/29 v2.20.6 +\thm@style=\toks22 +\thm@bodyfont=\toks23 +\thm@headfont=\toks24 +\thm@notefont=\toks25 +\thm@headpunct=\toks26 +\thm@preskip=\skip52 +\thm@postskip=\skip53 +\thm@headsep=\skip54 +\dth@everypar=\toks27 +) +(/usr/share/texmf-dist/tex/latex/pgf/frontendlayer/tikz.sty +(/usr/share/texmf-dist/tex/latex/pgf/basiclayer/pgf.sty +(/usr/share/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty +(/usr/share/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex +\pgfutil@everybye=\toks28 +\pgfutil@tempdima=\dimen148 +\pgfutil@tempdimb=\dimen149 + +(/usr/share/texmf-dist/tex/generic/pgf/utilities/pgfutil-common-lists.tex)) +(/usr/share/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def +\pgfutil@abb=\box49 +) +(/usr/share/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex +(/usr/share/texmf-dist/tex/generic/pgf/pgf.revision.tex) +Package: pgfrcs 2020/12/27 v3.1.8b (3.1.8b) +)) +Package: pgf 2020/12/27 v3.1.8b (3.1.8b) + +(/usr/share/texmf-dist/tex/latex/pgf/basiclayer/pgfcore.sty +(/usr/share/texmf-dist/tex/latex/graphics/graphicx.sty +Package: graphicx 2020/09/09 v1.2b Enhanced LaTeX Graphics (DPC,SPQR) + +(/usr/share/texmf-dist/tex/latex/graphics/keyval.sty +Package: keyval 2014/10/28 v1.15 key=value parser (DPC) +\KV@toks@=\toks29 +) +(/usr/share/texmf-dist/tex/latex/graphics/graphics.sty +Package: graphics 2020/08/30 v1.4c Standard LaTeX Graphics (DPC,SPQR) + +(/usr/share/texmf-dist/tex/latex/graphics/trig.sty +Package: trig 2016/01/03 v1.10 sin cos tan (DPC) +) +(/usr/share/texmf-dist/tex/latex/graphics-cfg/graphics.cfg +File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration +) +Package graphics Info: Driver file: pdftex.def on input line 105. + +(/usr/share/texmf-dist/tex/latex/graphics-def/pdftex.def +File: pdftex.def 2020/10/05 v1.2a Graphics/color driver for pdftex +)) +\Gin@req@height=\dimen150 +\Gin@req@width=\dimen151 +) +(/usr/share/texmf-dist/tex/latex/pgf/systemlayer/pgfsys.sty +(/usr/share/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex +Package: pgfsys 2020/12/27 v3.1.8b (3.1.8b) + +(/usr/share/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex +\pgfkeys@pathtoks=\toks30 +\pgfkeys@temptoks=\toks31 + +(/usr/share/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.code.tex +\pgfkeys@tmptoks=\toks32 +)) +\pgf@x=\dimen152 +\pgf@y=\dimen153 +\pgf@xa=\dimen154 +\pgf@ya=\dimen155 +\pgf@xb=\dimen156 +\pgf@yb=\dimen157 +\pgf@xc=\dimen158 +\pgf@yc=\dimen159 +\pgf@xd=\dimen160 +\pgf@yd=\dimen161 +\w@pgf@writea=\write3 +\r@pgf@reada=\read2 +\c@pgf@counta=\count199 +\c@pgf@countb=\count266 +\c@pgf@countc=\count267 +\c@pgf@countd=\count268 +\t@pgf@toka=\toks33 +\t@pgf@tokb=\toks34 +\t@pgf@tokc=\toks35 +\pgf@sys@id@count=\count269 + +(/usr/share/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg +File: pgf.cfg 2020/12/27 v3.1.8b (3.1.8b) +) +Driver file for pgf: pgfsys-pdftex.def + +(/usr/share/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def +File: pgfsys-pdftex.def 2020/12/27 v3.1.8b (3.1.8b) + +(/usr/share/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def +File: pgfsys-common-pdf.def 2020/12/27 v3.1.8b (3.1.8b) +))) +(/usr/share/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex +File: pgfsyssoftpath.code.tex 2020/12/27 v3.1.8b (3.1.8b) +\pgfsyssoftpath@smallbuffer@items=\count270 +\pgfsyssoftpath@bigbuffer@items=\count271 +) +(/usr/share/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.code.tex +File: pgfsysprotocol.code.tex 2020/12/27 v3.1.8b (3.1.8b) +)) +(/usr/share/texmf-dist/tex/latex/xcolor/xcolor.sty +Package: xcolor 2016/05/11 v2.12 LaTeX color extensions (UK) + +(/usr/share/texmf-dist/tex/latex/graphics-cfg/color.cfg +File: color.cfg 2016/01/02 v1.6 sample color configuration +) +Package xcolor Info: Driver file: pdftex.def on input line 225. +Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1348. +Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1352. +Package xcolor Info: Model `RGB' extended on input line 1364. +Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1366. +Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1367. +Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1368. +Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1369. +Package xcolor Info: Model `Gray' substituted by `gray' on input line 1370. +Package xcolor Info: Model `wave' substituted by `hsb' on input line 1371. +) +(/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex +Package: pgfcore 2020/12/27 v3.1.8b (3.1.8b) + +(/usr/share/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex +(/usr/share/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex +(/usr/share/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex) +(/usr/share/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex +\pgfmath@dimen=\dimen162 +\pgfmath@count=\count272 +\pgfmath@box=\box50 +\pgfmath@toks=\toks36 +\pgfmath@stack@operand=\toks37 +\pgfmath@stack@operation=\toks38 +) +(/usr/share/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.tex +(/usr/share/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic.code.tex) +(/usr/share/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigonometric.code +.tex) +(/usr/share/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.random.code.tex) +(/usr/share/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.comparison.code.te +x) (/usr/share/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.code.tex) +(/usr/share/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round.code.tex) +(/usr/share/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex) +(/usr/share/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integerarithmetics +.code.tex))) (/usr/share/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex +\c@pgfmathroundto@lastzeros=\count273 +)) (/usr/share/texmf-dist/tex/generic/pgf/math/pgfint.code.tex) +(/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex +File: pgfcorepoints.code.tex 2020/12/27 v3.1.8b (3.1.8b) +\pgf@picminx=\dimen163 +\pgf@picmaxx=\dimen164 +\pgf@picminy=\dimen165 +\pgf@picmaxy=\dimen166 +\pgf@pathminx=\dimen167 +\pgf@pathmaxx=\dimen168 +\pgf@pathminy=\dimen169 +\pgf@pathmaxy=\dimen170 +\pgf@xx=\dimen171 +\pgf@xy=\dimen172 +\pgf@yx=\dimen173 +\pgf@yy=\dimen174 +\pgf@zx=\dimen175 +\pgf@zy=\dimen176 +) +(/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex +File: pgfcorepathconstruct.code.tex 2020/12/27 v3.1.8b (3.1.8b) +\pgf@path@lastx=\dimen177 +\pgf@path@lasty=\dimen178 +) (/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage.code.tex +File: pgfcorepathusage.code.tex 2020/12/27 v3.1.8b (3.1.8b) +\pgf@shorten@end@additional=\dimen179 +\pgf@shorten@start@additional=\dimen180 +) +(/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex +File: pgfcorescopes.code.tex 2020/12/27 v3.1.8b (3.1.8b) +\pgfpic=\box51 +\pgf@hbox=\box52 +\pgf@layerbox@main=\box53 +\pgf@picture@serial@count=\count274 +) +(/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex +File: pgfcoregraphicstate.code.tex 2020/12/27 v3.1.8b (3.1.8b) +\pgflinewidth=\dimen181 +) +(/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.t +ex +File: pgfcoretransformations.code.tex 2020/12/27 v3.1.8b (3.1.8b) +\pgf@pt@x=\dimen182 +\pgf@pt@y=\dimen183 +\pgf@pt@temp=\dimen184 +) (/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.code.tex +File: pgfcorequick.code.tex 2020/12/27 v3.1.8b (3.1.8b) +) +(/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreobjects.code.tex +File: pgfcoreobjects.code.tex 2020/12/27 v3.1.8b (3.1.8b) +) +(/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathprocessing.code.te +x +File: pgfcorepathprocessing.code.tex 2020/12/27 v3.1.8b (3.1.8b) +) (/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex +File: pgfcorearrows.code.tex 2020/12/27 v3.1.8b (3.1.8b) +\pgfarrowsep=\dimen185 +) +(/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex +File: pgfcoreshade.code.tex 2020/12/27 v3.1.8b (3.1.8b) +\pgf@max=\dimen186 +\pgf@sys@shading@range@num=\count275 +\pgf@shadingcount=\count276 +) +(/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreimage.code.tex +File: pgfcoreimage.code.tex 2020/12/27 v3.1.8b (3.1.8b) + +(/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreexternal.code.tex +File: pgfcoreexternal.code.tex 2020/12/27 v3.1.8b (3.1.8b) +\pgfexternal@startupbox=\box54 +)) +(/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcorelayers.code.tex +File: pgfcorelayers.code.tex 2020/12/27 v3.1.8b (3.1.8b) +) +(/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransparency.code.tex +File: pgfcoretransparency.code.tex 2020/12/27 v3.1.8b (3.1.8b) +) (/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepatterns.code.tex +File: pgfcorepatterns.code.tex 2020/12/27 v3.1.8b (3.1.8b) +) +(/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcorerdf.code.tex +File: pgfcorerdf.code.tex 2020/12/27 v3.1.8b (3.1.8b) +))) +(/usr/share/texmf-dist/tex/generic/pgf/modules/pgfmoduleshapes.code.tex +File: pgfmoduleshapes.code.tex 2020/12/27 v3.1.8b (3.1.8b) +\pgfnodeparttextbox=\box55 +) +(/usr/share/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.tex +File: pgfmoduleplot.code.tex 2020/12/27 v3.1.8b (3.1.8b) +) +(/usr/share/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version-0-65.sty +Package: pgfcomp-version-0-65 2020/12/27 v3.1.8b (3.1.8b) +\pgf@nodesepstart=\dimen187 +\pgf@nodesepend=\dimen188 +) +(/usr/share/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version-1-18.sty +Package: pgfcomp-version-1-18 2020/12/27 v3.1.8b (3.1.8b) +)) +(/usr/share/texmf-dist/tex/latex/pgf/utilities/pgffor.sty +(/usr/share/texmf-dist/tex/latex/pgf/utilities/pgfkeys.sty +(/usr/share/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex)) +(/usr/share/texmf-dist/tex/latex/pgf/math/pgfmath.sty +(/usr/share/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex)) +(/usr/share/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex +Package: pgffor 2020/12/27 v3.1.8b (3.1.8b) + +(/usr/share/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex) +\pgffor@iter=\dimen189 +\pgffor@skip=\dimen190 +\pgffor@stack=\toks39 +\pgffor@toks=\toks40 +)) +(/usr/share/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex +Package: tikz 2020/12/27 v3.1.8b (3.1.8b) + +(/usr/share/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.te +x +File: pgflibraryplothandlers.code.tex 2020/12/27 v3.1.8b (3.1.8b) +\pgf@plot@mark@count=\count277 +\pgfplotmarksize=\dimen191 +) +\tikz@lastx=\dimen192 +\tikz@lasty=\dimen193 +\tikz@lastxsaved=\dimen194 +\tikz@lastysaved=\dimen195 +\tikz@lastmovetox=\dimen196 +\tikz@lastmovetoy=\dimen197 +\tikzleveldistance=\dimen198 +\tikzsiblingdistance=\dimen199 +\tikz@figbox=\box56 +\tikz@figbox@bg=\box57 +\tikz@tempbox=\box58 +\tikz@tempbox@bg=\box59 +\tikztreelevel=\count278 +\tikznumberofchildren=\count279 +\tikznumberofcurrentchild=\count280 +\tikz@fig@count=\count281 + (/usr/share/texmf-dist/tex/generic/pgf/modules/pgfmodulematrix.code.tex +File: pgfmodulematrix.code.tex 2020/12/27 v3.1.8b (3.1.8b) +\pgfmatrixcurrentrow=\count282 +\pgfmatrixcurrentcolumn=\count283 +\pgf@matrix@numberofcolumns=\count284 +) +\tikz@expandcount=\count285 + +(/usr/share/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrary +topaths.code.tex +File: tikzlibrarytopaths.code.tex 2020/12/27 v3.1.8b (3.1.8b) +))) (/usr/share/texmf-dist/tex/latex/tikz-cd/tikz-cd.sty +Package: tikz-cd 2018/11/19 v0.9f Commutative diagrams with TikZ + +(/usr/share/texmf-dist/tex/generic/tikz-cd/tikzlibrarycd.code.tex +(/usr/share/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrary +matrix.code.tex +File: tikzlibrarymatrix.code.tex 2020/12/27 v3.1.8b (3.1.8b) +) +(/usr/share/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrary +quotes.code.tex +File: tikzlibraryquotes.code.tex 2020/12/27 v3.1.8b (3.1.8b) +) +(/usr/share/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.meta.code.tex +File: pgflibraryarrows.meta.code.tex 2020/12/27 v3.1.8b (3.1.8b) +\pgfarrowinset=\dimen256 +\pgfarrowlength=\dimen257 +\pgfarrowwidth=\dimen258 +\pgfarrowlinewidth=\dimen259 +))) (/usr/share/texmf-dist/tex/latex/enumitem/enumitem.sty +Package: enumitem 2019/06/20 v3.9 Customized lists +\labelindent=\skip55 +\enit@outerparindent=\dimen260 +\enit@toks=\toks41 +\enit@inbox=\box60 +\enit@count@id=\count286 +\enitdp@description=\count287 +) +(/usr/share/texmf-dist/tex/latex/geometry/geometry.sty +Package: geometry 2020/01/02 v5.9 Page Geometry + +(/usr/share/texmf-dist/tex/generic/iftex/ifvtex.sty +Package: ifvtex 2019/10/25 v1.7 ifvtex legacy package. Use iftex instead. + +(/usr/share/texmf-dist/tex/generic/iftex/iftex.sty +Package: iftex 2020/03/06 v1.0d TeX engine tests +)) +\Gm@cnth=\count288 +\Gm@cntv=\count289 +\c@Gm@tempcnt=\count290 +\Gm@bindingoffset=\dimen261 +\Gm@wd@mp=\dimen262 +\Gm@odd@mp=\dimen263 +\Gm@even@mp=\dimen264 +\Gm@layoutwidth=\dimen265 +\Gm@layoutheight=\dimen266 +\Gm@layouthoffset=\dimen267 +\Gm@layoutvoffset=\dimen268 +\Gm@dimlist=\toks42 +) +\c@prop=\count291 +\c@ex=\count292 +\c@remark=\count293 + +(/usr/share/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def +File: l3backend-pdftex.def 2021-03-18 L3 backend support: PDF output (pdfTeX) +\l__color_backend_stack_int=\count294 +\l__pdf_internal_box=\box61 +) (./Retake1.aux) +\openout1 = `Retake1.aux'. + +LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 23. +LaTeX Font Info: ... okay on input line 23. +LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 23. +LaTeX Font Info: ... okay on input line 23. +LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 23. +LaTeX Font Info: ... okay on input line 23. +LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 23. +LaTeX Font Info: ... okay on input line 23. +LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 23. +LaTeX Font Info: ... okay on input line 23. +LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 23. +LaTeX Font Info: ... okay on input line 23. +LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 23. +LaTeX Font Info: ... okay on input line 23. + (/usr/share/texmf-dist/tex/context/base/mkii/supp-pdf.mkii +[Loading MPS to PDF converter (version 2006.09.02).] +\scratchcounter=\count295 +\scratchdimen=\dimen269 +\scratchbox=\box62 +\nofMPsegments=\count296 +\nofMParguments=\count297 +\everyMPshowfont=\toks43 +\MPscratchCnt=\count298 +\MPscratchDim=\dimen270 +\MPnumerator=\count299 +\makeMPintoPDFobject=\count300 +\everyMPtoPDFconversion=\toks44 +) (/usr/share/texmf-dist/tex/latex/epstopdf-pkg/epstopdf-base.sty +Package: epstopdf-base 2020-01-24 v2.11 Base part for package epstopdf +Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 4 +85. + +(/usr/share/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg +File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv +e +)) +*geometry* driver: auto-detecting +*geometry* detected driver: pdftex +*geometry* verbose mode - [ preamble ] result: +* driver: pdftex +* paper: a4paper +* layout: <same size as paper> +* layoutoffset:(h,v)=(0.0pt,0.0pt) +* modes: +* h-part:(L,W,R)=(56.9055pt, 483.69687pt, 56.9055pt) +* v-part:(T,H,B)=(56.9055pt, 731.23584pt, 56.9055pt) +* \paperwidth=597.50787pt +* \paperheight=845.04684pt +* \textwidth=483.69687pt +* \textheight=731.23584pt +* \oddsidemargin=-15.36449pt +* \evensidemargin=-15.36449pt +* \topmargin=-52.36449pt +* \headheight=12.0pt +* \headsep=25.0pt +* \topskip=12.0pt +* \footskip=30.0pt +* \marginparwidth=35.0pt +* \marginparsep=10.0pt +* \columnsep=10.0pt +* \skip\footins=10.8pt plus 4.0pt minus 2.0pt +* \hoffset=0.0pt +* \voffset=0.0pt +* \mag=1000 +* \@twocolumnfalse +* \@twosidefalse +* \@mparswitchfalse +* \@reversemarginfalse +* (1in=72.27pt=25.4mm, 1cm=28.453pt) + +LaTeX Font Info: Trying to load font information for U+msa on input line 33. + +(/usr/share/texmf-dist/tex/latex/amsfonts/umsa.fd +File: umsa.fd 2013/01/14 v3.01 AMS symbols A +) +LaTeX Font Info: Trying to load font information for U+msb on input line 33. + + +(/usr/share/texmf-dist/tex/latex/amsfonts/umsb.fd +File: umsb.fd 2013/01/14 v3.01 AMS symbols B +) +LaTeX Font Info: Trying to load font information for OMS+cmtt on input line +51. +LaTeX Font Info: No file OMScmtt.fd. on input line 51. + + +LaTeX Font Warning: Font shape `OMS/cmtt/m/n' undefined +(Font) using `OMS/cmsy/m/n' instead +(Font) for symbol `textbackslash' on input line 51. + +[1 + +{/usr/share/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] [2] +<bc.png, id=23, 453.1329pt x 338.2236pt> +File: bc.png Graphic file (type png) +<use bc.png> +Package pdftex.def Info: bc.png used on input line 171. +(pdftex.def) Requested size: 226.56589pt x 169.11139pt. + [3 <./bc.png>] [4] (./Retake1.aux) + +LaTeX Font Warning: Some font shapes were not available, defaults substituted. + + ) +Here is how much of TeX's memory you used: + 14663 strings out of 478994 + 296548 string characters out of 5864718 + 572498 words of memory out of 5000000 + 31890 multiletter control sequences out of 15000+600000 + 411415 words of font info for 56 fonts, out of 8000000 for 9000 + 1141 hyphenation exceptions out of 8191 + 113i,14n,116p,409b,1111s stack positions out of 5000i,500n,10000p,200000b,80000s +{/usr/share/texmf-dist/fonts/enc/dvips/cm-super/cm-super-ts1.enc}</usr/share/ +texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.pfb></usr/share/texmf-dist/fon +ts/type1/public/amsfonts/cm/cmex10.pfb></usr/share/texmf-dist/fonts/type1/publi +c/amsfonts/cm/cmmi12.pfb></usr/share/texmf-dist/fonts/type1/public/amsfonts/cm/ +cmmi8.pfb></usr/share/texmf-dist/fonts/type1/public/amsfonts/cm/cmr12.pfb></usr +/share/texmf-dist/fonts/type1/public/amsfonts/cm/cmr8.pfb></usr/share/texmf-dis +t/fonts/type1/public/amsfonts/cm/cmsy10.pfb></usr/share/texmf-dist/fonts/type1/ +public/amsfonts/cm/cmsy8.pfb></usr/share/texmf-dist/fonts/type1/public/amsfonts +/cm/cmti12.pfb></usr/share/texmf-dist/fonts/type1/public/amsfonts/cm/cmtt12.pfb +></usr/share/texmf-dist/fonts/type1/public/amsfonts/symbols/msbm10.pfb></usr/sh +are/texmf-dist/fonts/type1/public/cm-super/sfrm1200.pfb> +Output written on Retake1.pdf (4 pages, 134096 bytes). +PDF statistics: + 72 PDF objects out of 1000 (max. 8388607) + 51 compressed objects within 1 object stream + 0 named destinations out of 1000 (max. 500000) + 18 words of extra memory for PDF output out of 10000 (max. 10000000) + diff --git a/src/Retake/Retake1.pdf b/src/Retake/Retake1.pdf Binary files differ. diff --git a/src/Retake/Retake1.tex b/src/Retake/Retake1.tex @@ -0,0 +1,208 @@ +\documentclass[12pt,a4paper]{article} +\usepackage[utf8]{inputenc} +\usepackage{amsmath} +\usepackage{amsfonts} +\usepackage{amssymb} +\usepackage{amsthm} +\usepackage{tikz,tikz-cd} +\usepackage{enumitem} +\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry} + +\title{Mathematical software - homework 1} +\author{Sebastiano Tronto} + +\newtheorem*{thm}{Theorem} +\newtheorem{prop}{Proposition} + +\theoremstyle{definition} +\newtheorem{ex}{Exercise} + +\theoremstyle{definition} +\newtheorem{remark}{Remark} + +\begin{document} + +\noindent\hrulefill + +\begin{center} +\Huge{\textbf{Mathematical Software - Retake}} +\end{center} + +\noindent\hrulefill +\begin{center} +\begin{tabular}{lcr} +\texttt{sebastiano.tronto@uni.lu} & \qquad \qquad \qquad \qquad & +\textbf{Deadline: Wednesday, February 9th} +\end{tabular} +\end{center} + +\vspace{0.3cm} + +\begin{center} + \emph{\large For exercises 1 and 2 submit a .tex and a .pdf file. + For exercises 3 and 4 submit your Sage code either in text format (.txt or + .sage) or as a Jupyter Notebook file (.ipynb). + } +\end{center} + + +\section*{Exercise 1} + Write a short Latex document that contains the following theorem-like + environments using the \texttt{\textbackslash newtheorem} command of the + \texttt{amsthm} package (the box around the text is not needed): + \begin{center} + \fbox{\parbox{0.95\textwidth}{ + \begin{prop}[Fundamental Theorem of Algebra] + \label{prop:fta} + Let \(p(x)\) be a non-constant polynomial with coefficients in + $\mathbb C$. Then there is \(z\in\mathbb C\) such that $p(z)=0$. + \end{prop} + + \begin{remark} + Proposition \ref{prop:fta} is not true for polynomials with + coefficients in $\mathbb R$. For example + \begin{align} + p(x) = x^2+1 + \end{align} + does not have real roots. + \end{remark} + + \begin{thm} + If $X$ and $Y$ are $\sigma$-finite measure spaces and $f:X\times Y\to + \mathbb R$ is measurable and such that + \begin{align*} + \int_{X\times Y}|f(x,y)|\mathrm d(x,y) < \infty + \end{align*} + then + \begin{align} + \label{eq:fubini} + \int_X\left(\int_Yf(x,y)\mathrm d y\right)\mathrm d x = + \int_Y\left(\int_Xf(x,y)\mathrm d x\right)\mathrm d y = + \int_{X\times Y} f(x,y)\mathrm d(x,y)\,. + \end{align} + \end{thm} + + \begin{remark} + In practice, equation \eqref{eq:fubini} means that we can switch the + order of integration in a double integral. + \end{remark} + }} + \end{center} + Notice that Propositions, Remarks and some of the equations are numbered, + and some of them are referred to in the Remarks. This numbering should change + accordingly if more numbered Theorems and equations are added before this + part of the text. + +\newpage + +\section*{Exercise 2} +Create a Latex document containing the following pictures: +\begin{enumerate} +\item[(a)] The following commutative diagram: + \begin{center} + \begin{tikzcd} + M \ar[r, "f"] \ar[d,swap,"i",hook] & A \\ + N \ar[ur, swap, "\tilde f", dashed] + \end{tikzcd} + \end{center} +\item[(b)] A triangle with verteces on a grid, as below. + Moreover, the position of the vertex $C$ below must be easy to + change at will: you should use the + \texttt{\textbackslash pgfmathsetmacro} command to set a value + for its coordinates at the beginning, so that changing only + those numbers makes the whole picture change accordingly (sides, + dots, labels). + \begin{center} + \begin{tikzpicture}[scale=1] + \pgfmathsetmacro{\ax}{2} + \pgfmathsetmacro{\ay}{1} + \pgfmathsetmacro{\bx}{8} + \pgfmathsetmacro{\by}{1} + \pgfmathsetmacro{\cx}{9} + \pgfmathsetmacro{\cy}{7} + + \draw[lightgray!30,thin] (0,0) grid (10,10); + \draw[-] (\ax, \ay) -- (\bx, \by) -- (\cx, \cy) -- cycle; + \filldraw[blue] (\ax, \ay) circle[radius=0.1] node[below left] {$A$}; + \filldraw[blue] (\bx, \by) circle[radius=0.1] node[below right] {$B$}; + \filldraw[red] (\cx, \cy) circle[radius=0.1] node[above] {$C$}; + + \end{tikzpicture} + \end{center} + +\end{enumerate} + +\newpage +\section*{Exercise 3} +Use SageMath to solve the following problems: +\begin{enumerate}[label=(\arabic*)] + \item Find the roots of the following polynomial over $\mathbb Q$, + over $\mathbb R$ and over $\mathbb C$: + \[ p(x) = x^6+x^5-2x^4-3x^3-x^2+2x+2 \] + \item Find the determinant, the trace and the characteristic polynomial + of the following matrix: + \[A= + \left(\begin{array}{rrrrr} + 2 & 3 & 0 & 1 & 2 \\ + 1 & 0 & \frac{1}{2} & 1 & -1 \\ + 0 & 0 & -1 & 0 & 0 \\ + 0 & -1 & -1 & 0 & -1 \\ + -1 & -1 & -1 & -1 & 0 + \end{array}\right) + \] + \item Find the solutions of the linear system $A\mathbf x=\mathbf 0$, where + $A$ is the matrix above and $\mathbf 0$ is the zero vector. + \item Find the points of intersection of the circle of equation $x^2+y^2=4$ + ad the ellipse of equation $\left(\frac{x}{2}\right)^2+(2y)^2=4$ + \item Plot the graph of the function $f(x)=\sqrt{1-x^6}$. + \item Find the area between the $x$-axis and the grap of the function of + the previous point. + \item Find the derivative, a primitive (integral) and the Taylor series + expansion up to order 4 of the function $h(x)=\log(1+x+x^2)$. + \item Use Sage to get the Latex code for the objects you computed in + the previous point. + \item Find a solution for the differential equation with initial conditions + \[ + \begin{cases}g'(x)&=\frac{1}{3}g(x) - 7\\g(1)&=30\end{cases} + \] + \item Draw a bar chart of the data set $[0,1,3,7,5,7,2,8,9,3]$, like the foll + following: + \begin{center} + \includegraphics[scale=0.5]{bc.png} + \end{center} +\end{enumerate} + +\newpage +\section*{Grading} + +\vspace{0.3cm} +\textbf{Exercise 1 (5 points).} +\begin{itemize} + \item A correct use of the \texttt{\textbackslash newtheorem} command is + worth 2 out of 5 points. + \item A correct use of the labelling and reference system is worth 2 points. + \item Reproducing correctly the mathematical formulas is worth 1 point. +\end{itemize} + +\vspace{0.3cm} +\textbf{Exercise 2 (5 points).} +\begin{itemize} + \item Part (a) is worth 2 points: 1 point for having the letters + $M$, $N$ and $A$ in the correct position and the arrows + pointing between them and 1 point for the style of the arrows + and the labels $f$, $i$ and $\tilde f$ in the correct position. + \item Part (b) is worth 3 points: 1 point for drawing a triangle, 1 + point for the other decorative elements (colored dots, grid lines + and labels) and 1 point for having the point $C$ correctly set + as a macro so that it can be changed easily. +\end{itemize} + +\vspace{0.3cm} +\textbf{Exercise 3 (10 points).} +\begin{itemize} + \item Each of the 10 parts is worth 1 point. +\end{itemize} + + + +\end{document} diff --git a/src/Retake/bc.png b/src/Retake/bc.png Binary files differ.