mathsoftware

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

Retake1.tex (6911B)


      1 \documentclass[12pt,a4paper]{article}
      2 \usepackage[utf8]{inputenc}
      3 \usepackage{amsmath}
      4 \usepackage{amsfonts}
      5 \usepackage{amssymb}
      6 \usepackage{amsthm}
      7 \usepackage{tikz,tikz-cd}
      8 \usepackage{enumitem}
      9 \usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
     10 
     11 \title{Mathematical software - homework 1}
     12 \author{Sebastiano Tronto}
     13 
     14 \newtheorem*{thm}{Theorem}
     15 \newtheorem{prop}{Proposition}
     16 
     17 \theoremstyle{definition}
     18 \newtheorem{ex}{Exercise}
     19 
     20 \theoremstyle{definition}
     21 \newtheorem{remark}{Remark}
     22 
     23 \begin{document}
     24 
     25 \noindent\hrulefill
     26 
     27 \begin{center}
     28 \Huge{\textbf{Mathematical Software - Retake}}
     29 \end{center}
     30 
     31 \noindent\hrulefill
     32 \begin{center}
     33 \begin{tabular}{lcr}
     34 \texttt{sebastiano.tronto@uni.lu} & \qquad \qquad \qquad \qquad &
     35 \textbf{Deadline: Wednesday, February 9th}
     36 \end{tabular}
     37 \end{center}
     38 
     39 \vspace{0.3cm}
     40 
     41 \begin{center}
     42   \emph{\large For exercises 1 and 2 submit a .tex and a .pdf file.
     43     For exercises 3 and 4 submit your Sage code either in text format (.txt or
     44     .sage) or as a Jupyter Notebook file (.ipynb).
     45   }
     46 \end{center}
     47 
     48 
     49 \section*{Exercise 1}
     50   Write a short Latex document that contains the following theorem-like
     51   environments using the \texttt{\textbackslash newtheorem} command of the
     52   \texttt{amsthm} package (the box around the text is not needed):
     53   \begin{center}
     54     \fbox{\parbox{0.95\textwidth}{
     55       \begin{prop}[Fundamental Theorem of Algebra]
     56         \label{prop:fta}
     57         Let \(p(x)\) be a non-constant polynomial with coefficients in
     58         $\mathbb C$. Then there is \(z\in\mathbb C\) such that $p(z)=0$.
     59       \end{prop}
     60 
     61       \begin{remark}
     62         Proposition \ref{prop:fta} is not true for polynomials with
     63         coefficients in $\mathbb R$. For example
     64         \begin{align}
     65           p(x) = x^2+1
     66         \end{align}
     67         does not have real roots.
     68       \end{remark}
     69 
     70       \begin{thm}
     71         If $X$ and $Y$ are $\sigma$-finite measure spaces and $f:X\times Y\to
     72         \mathbb R$ is measurable and such that
     73         \begin{align*}
     74           \int_{X\times Y}|f(x,y)|\mathrm d(x,y) < \infty
     75         \end{align*}
     76         then
     77         \begin{align}
     78           \label{eq:fubini}
     79           \int_X\left(\int_Yf(x,y)\mathrm d y\right)\mathrm d x =
     80           \int_Y\left(\int_Xf(x,y)\mathrm d x\right)\mathrm d y =
     81           \int_{X\times Y} f(x,y)\mathrm d(x,y)\,.
     82         \end{align}
     83       \end{thm}
     84 
     85       \begin{remark}
     86         In practice, equation \eqref{eq:fubini} means that we can switch the
     87         order of integration in a double integral.
     88       \end{remark}
     89     }}
     90   \end{center}
     91   Notice that Propositions, Remarks and some of the equations are numbered,
     92   and some of them are referred to in the Remarks. This numbering should change
     93   accordingly if more numbered Theorems and equations are added before this
     94   part of the text.
     95 
     96 \newpage
     97 
     98 \section*{Exercise 2}
     99 Create a Latex document containing the following pictures:
    100 \begin{enumerate}
    101 \item[(a)] The following commutative diagram:
    102 	\begin{center}
    103 		\begin{tikzcd}
    104 			M \ar[r, "f"] \ar[d,swap,"i",hook] & A \\
    105 			N \ar[ur, swap, "\tilde f", dashed]
    106 		\end{tikzcd}
    107 	\end{center}
    108 \item[(b)] A triangle with verteces on a grid, as below.
    109 	   Moreover, the position of the vertex $C$ below must be easy to
    110 	   change at will: you should use the
    111 	   \texttt{\textbackslash pgfmathsetmacro} command to set a value
    112 	   for its coordinates at the beginning, so that changing only 
    113            those numbers makes the whole picture change accordingly (sides,
    114 	   dots, labels).
    115       \begin{center}
    116         \begin{tikzpicture}[scale=1]
    117                 \pgfmathsetmacro{\ax}{2}
    118                 \pgfmathsetmacro{\ay}{1}
    119                 \pgfmathsetmacro{\bx}{8}
    120                 \pgfmathsetmacro{\by}{1}
    121                 \pgfmathsetmacro{\cx}{9}
    122                 \pgfmathsetmacro{\cy}{7}
    123 
    124                 \draw[lightgray!30,thin] (0,0) grid (10,10);
    125 		\draw[-] (\ax, \ay) -- (\bx, \by) -- (\cx, \cy) -- cycle;
    126 		\filldraw[blue] (\ax, \ay) circle[radius=0.1] node[below left] {$A$};
    127 		\filldraw[blue] (\bx, \by) circle[radius=0.1] node[below right] {$B$};
    128 		\filldraw[red] (\cx, \cy) circle[radius=0.1] node[above] {$C$};
    129 
    130         \end{tikzpicture}
    131       \end{center}
    132  
    133 \end{enumerate}
    134 
    135 \newpage
    136 \section*{Exercise 3}
    137 Use SageMath to solve the following problems:
    138 \begin{enumerate}[label=(\arabic*)]
    139 	\item Find the roots of the following polynomial over $\mathbb Q$,
    140 		over $\mathbb R$ and over $\mathbb C$:
    141 		\[ p(x) = x^6+x^5-2x^4-3x^3-x^2+2x+2 \]
    142 	\item Find the determinant, the trace and the characteristic polynomial
    143 		   of the following matrix:
    144 		\[A=
    145 		\left(\begin{array}{rrrrr}
    146 		2 & 3 & 0 & 1 & 2 \\
    147 		1 & 0 & \frac{1}{2} & 1 & -1 \\
    148 		0 & 0 & -1 & 0 & 0 \\
    149 		0 & -1 & -1 & 0 & -1 \\
    150 		-1 & -1 & -1 & -1 & 0
    151 		\end{array}\right)
    152 		\]
    153 	\item Find the solutions of the linear system $A\mathbf x=\mathbf 0$, where
    154 		$A$ is the matrix above and $\mathbf 0$ is the zero vector.
    155 	\item Find the points of intersection of the circle of equation $x^2+y^2=4$
    156 		   ad the ellipse of equation $\left(\frac{x}{2}\right)^2+(2y)^2=4$
    157 	\item Plot the graph of the function $f(x)=\sqrt{1-x^6}$.
    158 	\item Find the area between the $x$-axis and the grap of the function of
    159 		   the previous point.
    160 	\item Find the derivative, a primitive (integral) and the Taylor series
    161 	      expansion up to order 4 of the function $h(x)=\log(1+x+x^2)$.
    162 	\item Use Sage to get the Latex code for the objects you computed in
    163 		the previous point.
    164 	\item Find a solution for the differential equation with initial conditions
    165 		   \[
    166 			\begin{cases}g'(x)&=\frac{1}{3}g(x) - 7\\g(1)&=30\end{cases}
    167 		   \]
    168 	\item Draw a bar chart of the data set $[0,1,3,7,5,7,2,8,9,3]$, like the foll
    169 	      following:
    170 		\begin{center}
    171 	      \includegraphics[scale=0.5]{bc.png}
    172 	      \end{center}
    173 \end{enumerate}
    174 
    175 \newpage
    176 \section*{Grading}
    177 
    178 \vspace{0.3cm}
    179 \textbf{Exercise 1 (5 points).}
    180 \begin{itemize}
    181   \item A correct use of the \texttt{\textbackslash newtheorem} command is
    182         worth 2 out of 5 points.
    183   \item A correct use of the labelling and reference system is worth 2 points.
    184   \item Reproducing correctly the mathematical formulas is worth 1 point.
    185 \end{itemize}
    186 
    187 \vspace{0.3cm}
    188 \textbf{Exercise 2 (5 points).}
    189 \begin{itemize}
    190 	\item Part (a) is worth 2 points: 1 point for having the letters
    191 	      $M$, $N$ and $A$ in the correct position and the arrows
    192 	      pointing between them and 1 point for the style of the arrows
    193 	      and the labels $f$, $i$ and $\tilde f$ in the correct position.
    194 	\item Part (b) is worth 3 points: 1 point for drawing a triangle, 1
    195 	      point for the other decorative elements (colored dots, grid lines
    196 	      and labels) and 1 point for having the point $C$ correctly set
    197 	      as a macro so that it can be changed easily.
    198 \end{itemize}
    199 
    200 \vspace{0.3cm}
    201 \textbf{Exercise 3 (10 points).}
    202 \begin{itemize}
    203 	\item Each of the 10 parts is worth 1 point.
    204 \end{itemize}
    205 
    206 
    207 
    208 \end{document}