Homework4.tex (26027B)
1 \documentclass[11pt]{article} 2 3 \usepackage[breakable]{tcolorbox} 4 \usepackage{parskip} % Stop auto-indenting (to mimic markdown behaviour) 5 6 \usepackage{iftex} 7 \ifPDFTeX 8 \usepackage[T1]{fontenc} 9 \usepackage{mathpazo} 10 \else 11 \usepackage{fontspec} 12 \fi 13 14 % Basic figure setup, for now with no caption control since it's done 15 % automatically by Pandoc (which extracts ![](path) syntax from Markdown). 16 \usepackage{graphicx} 17 % Maintain compatibility with old templates. Remove in nbconvert 6.0 18 \let\Oldincludegraphics\includegraphics 19 % Ensure that by default, figures have no caption (until we provide a 20 % proper Figure object with a Caption API and a way to capture that 21 % in the conversion process - todo). 22 \usepackage{caption} 23 \DeclareCaptionFormat{nocaption}{} 24 \captionsetup{format=nocaption,aboveskip=0pt,belowskip=0pt} 25 26 \usepackage[Export]{adjustbox} % Used to constrain images to a maximum size 27 \adjustboxset{max size={0.9\linewidth}{0.9\paperheight}} 28 \usepackage{float} 29 \floatplacement{figure}{H} % forces figures to be placed at the correct location 30 \usepackage{xcolor} % Allow colors to be defined 31 \usepackage{enumerate} % Needed for markdown enumerations to work 32 \usepackage{geometry} % Used to adjust the document margins 33 \usepackage{amsmath} % Equations 34 \usepackage{amssymb} % Equations 35 \usepackage{textcomp} % defines textquotesingle 36 % Hack from http://tex.stackexchange.com/a/47451/13684: 37 \AtBeginDocument{% 38 \def\PYZsq{\textquotesingle}% Upright quotes in Pygmentized code 39 } 40 \usepackage{upquote} % Upright quotes for verbatim code 41 \usepackage{eurosym} % defines \euro 42 \usepackage[mathletters]{ucs} % Extended unicode (utf-8) support 43 \usepackage{fancyvrb} % verbatim replacement that allows latex 44 \usepackage{grffile} % extends the file name processing of package graphics 45 % to support a larger range 46 \makeatletter % fix for grffile with XeLaTeX 47 \def\Gread@@xetex#1{% 48 \IfFileExists{"\Gin@base".bb}% 49 {\Gread@eps{\Gin@base.bb}}% 50 {\Gread@@xetex@aux#1}% 51 } 52 \makeatother 53 54 % The hyperref package gives us a pdf with properly built 55 % internal navigation ('pdf bookmarks' for the table of contents, 56 % internal cross-reference links, web links for URLs, etc.) 57 \usepackage{hyperref} 58 % The default LaTeX title has an obnoxious amount of whitespace. By default, 59 % titling removes some of it. It also provides customization options. 60 \usepackage{titling} 61 \usepackage{longtable} % longtable support required by pandoc >1.10 62 \usepackage{booktabs} % table support for pandoc > 1.12.2 63 \usepackage[inline]{enumitem} % IRkernel/repr support (it uses the enumerate* environment) 64 \usepackage[normalem]{ulem} % ulem is needed to support strikethroughs (\sout) 65 % normalem makes italics be italics, not underlines 66 \usepackage{mathrsfs} 67 68 69 70 % Colors for the hyperref package 71 \definecolor{urlcolor}{rgb}{0,.145,.698} 72 \definecolor{linkcolor}{rgb}{.71,0.21,0.01} 73 \definecolor{citecolor}{rgb}{.12,.54,.11} 74 75 % ANSI colors 76 \definecolor{ansi-black}{HTML}{3E424D} 77 \definecolor{ansi-black-intense}{HTML}{282C36} 78 \definecolor{ansi-red}{HTML}{E75C58} 79 \definecolor{ansi-red-intense}{HTML}{B22B31} 80 \definecolor{ansi-green}{HTML}{00A250} 81 \definecolor{ansi-green-intense}{HTML}{007427} 82 \definecolor{ansi-yellow}{HTML}{DDB62B} 83 \definecolor{ansi-yellow-intense}{HTML}{B27D12} 84 \definecolor{ansi-blue}{HTML}{208FFB} 85 \definecolor{ansi-blue-intense}{HTML}{0065CA} 86 \definecolor{ansi-magenta}{HTML}{D160C4} 87 \definecolor{ansi-magenta-intense}{HTML}{A03196} 88 \definecolor{ansi-cyan}{HTML}{60C6C8} 89 \definecolor{ansi-cyan-intense}{HTML}{258F8F} 90 \definecolor{ansi-white}{HTML}{C5C1B4} 91 \definecolor{ansi-white-intense}{HTML}{A1A6B2} 92 \definecolor{ansi-default-inverse-fg}{HTML}{FFFFFF} 93 \definecolor{ansi-default-inverse-bg}{HTML}{000000} 94 95 % commands and environments needed by pandoc snippets 96 % extracted from the output of `pandoc -s` 97 \providecommand{\tightlist}{% 98 \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} 99 \DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}} 100 % Add ',fontsize=\small' for more characters per line 101 \newenvironment{Shaded}{}{} 102 \newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}} 103 \newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{{#1}}} 104 \newcommand{\DecValTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}} 105 \newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}} 106 \newcommand{\FloatTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}} 107 \newcommand{\CharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} 108 \newcommand{\StringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} 109 \newcommand{\CommentTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textit{{#1}}}} 110 \newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{{#1}}} 111 \newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}} 112 \newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{{#1}}} 113 \newcommand{\RegionMarkerTok}[1]{{#1}} 114 \newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}} 115 \newcommand{\NormalTok}[1]{{#1}} 116 117 % Additional commands for more recent versions of Pandoc 118 \newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.53,0.00,0.00}{{#1}}} 119 \newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} 120 \newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} 121 \newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.73,0.40,0.53}{{#1}}} 122 \newcommand{\ImportTok}[1]{{#1}} 123 \newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.73,0.13,0.13}{\textit{{#1}}}} 124 \newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}} 125 \newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}} 126 \newcommand{\VariableTok}[1]{\textcolor[rgb]{0.10,0.09,0.49}{{#1}}} 127 \newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}} 128 \newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.40,0.40,0.40}{{#1}}} 129 \newcommand{\BuiltInTok}[1]{{#1}} 130 \newcommand{\ExtensionTok}[1]{{#1}} 131 \newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.74,0.48,0.00}{{#1}}} 132 \newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.49,0.56,0.16}{{#1}}} 133 \newcommand{\InformationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}} 134 \newcommand{\WarningTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}} 135 136 137 % Define a nice break command that doesn't care if a line doesn't already 138 % exist. 139 \def\br{\hspace*{\fill} \\* } 140 % Math Jax compatibility definitions 141 \def\gt{>} 142 \def\lt{<} 143 \let\Oldtex\TeX 144 \let\Oldlatex\LaTeX 145 \renewcommand{\TeX}{\textrm{\Oldtex}} 146 \renewcommand{\LaTeX}{\textrm{\Oldlatex}} 147 % Document parameters 148 % Document title 149 \title{Mathematical Software - Homework 4} 150 \date{\textbf{Deadline:} Sunday, June 6} 151 152 153 154 155 156 % Pygments definitions 157 \makeatletter 158 \def\PY@reset{\let\PY@it=\relax \let\PY@bf=\relax% 159 \let\PY@ul=\relax \let\PY@tc=\relax% 160 \let\PY@bc=\relax \let\PY@ff=\relax} 161 \def\PY@tok#1{\csname PY@tok@#1\endcsname} 162 \def\PY@toks#1+{\ifx\relax#1\empty\else% 163 \PY@tok{#1}\expandafter\PY@toks\fi} 164 \def\PY@do#1{\PY@bc{\PY@tc{\PY@ul{% 165 \PY@it{\PY@bf{\PY@ff{#1}}}}}}} 166 \def\PY#1#2{\PY@reset\PY@toks#1+\relax+\PY@do{#2}} 167 168 \expandafter\def\csname PY@tok@w\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.73,0.73}{##1}}} 169 \expandafter\def\csname PY@tok@c\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} 170 \expandafter\def\csname PY@tok@cp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.74,0.48,0.00}{##1}}} 171 \expandafter\def\csname PY@tok@k\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} 172 \expandafter\def\csname PY@tok@kp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} 173 \expandafter\def\csname PY@tok@kt\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.69,0.00,0.25}{##1}}} 174 \expandafter\def\csname PY@tok@o\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} 175 \expandafter\def\csname PY@tok@ow\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}} 176 \expandafter\def\csname PY@tok@nb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} 177 \expandafter\def\csname PY@tok@nf\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}} 178 \expandafter\def\csname PY@tok@nc\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}} 179 \expandafter\def\csname PY@tok@nn\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}} 180 \expandafter\def\csname PY@tok@ne\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.82,0.25,0.23}{##1}}} 181 \expandafter\def\csname PY@tok@nv\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} 182 \expandafter\def\csname PY@tok@no\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.53,0.00,0.00}{##1}}} 183 \expandafter\def\csname PY@tok@nl\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.63,0.63,0.00}{##1}}} 184 \expandafter\def\csname PY@tok@ni\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.60,0.60,0.60}{##1}}} 185 \expandafter\def\csname PY@tok@na\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.49,0.56,0.16}{##1}}} 186 \expandafter\def\csname PY@tok@nt\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} 187 \expandafter\def\csname PY@tok@nd\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}} 188 \expandafter\def\csname PY@tok@s\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} 189 \expandafter\def\csname PY@tok@sd\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} 190 \expandafter\def\csname PY@tok@si\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}} 191 \expandafter\def\csname PY@tok@se\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.13}{##1}}} 192 \expandafter\def\csname PY@tok@sr\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}} 193 \expandafter\def\csname PY@tok@ss\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} 194 \expandafter\def\csname PY@tok@sx\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} 195 \expandafter\def\csname PY@tok@m\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} 196 \expandafter\def\csname PY@tok@gh\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}} 197 \expandafter\def\csname PY@tok@gu\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.50,0.00,0.50}{##1}}} 198 \expandafter\def\csname PY@tok@gd\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.63,0.00,0.00}{##1}}} 199 \expandafter\def\csname PY@tok@gi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.63,0.00}{##1}}} 200 \expandafter\def\csname PY@tok@gr\endcsname{\def\PY@tc##1{\textcolor[rgb]{1.00,0.00,0.00}{##1}}} 201 \expandafter\def\csname PY@tok@ge\endcsname{\let\PY@it=\textit} 202 \expandafter\def\csname PY@tok@gs\endcsname{\let\PY@bf=\textbf} 203 \expandafter\def\csname PY@tok@gp\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}} 204 \expandafter\def\csname PY@tok@go\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.53,0.53,0.53}{##1}}} 205 \expandafter\def\csname PY@tok@gt\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.27,0.87}{##1}}} 206 \expandafter\def\csname PY@tok@err\endcsname{\def\PY@bc##1{\setlength{\fboxsep}{0pt}\fcolorbox[rgb]{1.00,0.00,0.00}{1,1,1}{\strut ##1}}} 207 \expandafter\def\csname PY@tok@kc\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} 208 \expandafter\def\csname PY@tok@kd\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} 209 \expandafter\def\csname PY@tok@kn\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} 210 \expandafter\def\csname PY@tok@kr\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} 211 \expandafter\def\csname PY@tok@bp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} 212 \expandafter\def\csname PY@tok@fm\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}} 213 \expandafter\def\csname PY@tok@vc\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} 214 \expandafter\def\csname PY@tok@vg\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} 215 \expandafter\def\csname PY@tok@vi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} 216 \expandafter\def\csname PY@tok@vm\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} 217 \expandafter\def\csname PY@tok@sa\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} 218 \expandafter\def\csname PY@tok@sb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} 219 \expandafter\def\csname PY@tok@sc\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} 220 \expandafter\def\csname PY@tok@dl\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} 221 \expandafter\def\csname PY@tok@s2\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} 222 \expandafter\def\csname PY@tok@sh\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} 223 \expandafter\def\csname PY@tok@s1\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} 224 \expandafter\def\csname PY@tok@mb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} 225 \expandafter\def\csname PY@tok@mf\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} 226 \expandafter\def\csname PY@tok@mh\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} 227 \expandafter\def\csname PY@tok@mi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} 228 \expandafter\def\csname PY@tok@il\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} 229 \expandafter\def\csname PY@tok@mo\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} 230 \expandafter\def\csname PY@tok@ch\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} 231 \expandafter\def\csname PY@tok@cm\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} 232 \expandafter\def\csname PY@tok@cpf\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} 233 \expandafter\def\csname PY@tok@c1\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} 234 \expandafter\def\csname PY@tok@cs\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} 235 236 \def\PYZbs{\char`\\} 237 \def\PYZus{\char`\_} 238 \def\PYZob{\char`\{} 239 \def\PYZcb{\char`\}} 240 \def\PYZca{\char`\^} 241 \def\PYZam{\char`\&} 242 \def\PYZlt{\char`\<} 243 \def\PYZgt{\char`\>} 244 \def\PYZsh{\char`\#} 245 \def\PYZpc{\char`\%} 246 \def\PYZdl{\char`\$} 247 \def\PYZhy{\char`\-} 248 \def\PYZsq{\char`\'} 249 \def\PYZdq{\char`\"} 250 \def\PYZti{\char`\~} 251 % for compatibility with earlier versions 252 \def\PYZat{@} 253 \def\PYZlb{[} 254 \def\PYZrb{]} 255 \makeatother 256 257 258 % For linebreaks inside Verbatim environment from package fancyvrb. 259 \makeatletter 260 \newbox\Wrappedcontinuationbox 261 \newbox\Wrappedvisiblespacebox 262 \newcommand*\Wrappedvisiblespace {\textcolor{red}{\textvisiblespace}} 263 \newcommand*\Wrappedcontinuationsymbol {\textcolor{red}{\llap{\tiny$\m@th\hookrightarrow$}}} 264 \newcommand*\Wrappedcontinuationindent {3ex } 265 \newcommand*\Wrappedafterbreak {\kern\Wrappedcontinuationindent\copy\Wrappedcontinuationbox} 266 % Take advantage of the already applied Pygments mark-up to insert 267 % potential linebreaks for TeX processing. 268 % {, <, #, %, $, ' and ": go to next line. 269 % _, }, ^, &, >, - and ~: stay at end of broken line. 270 % Use of \textquotesingle for straight quote. 271 \newcommand*\Wrappedbreaksatspecials {% 272 \def\PYGZus{\discretionary{\char`\_}{\Wrappedafterbreak}{\char`\_}}% 273 \def\PYGZob{\discretionary{}{\Wrappedafterbreak\char`\{}{\char`\{}}% 274 \def\PYGZcb{\discretionary{\char`\}}{\Wrappedafterbreak}{\char`\}}}% 275 \def\PYGZca{\discretionary{\char`\^}{\Wrappedafterbreak}{\char`\^}}% 276 \def\PYGZam{\discretionary{\char`\&}{\Wrappedafterbreak}{\char`\&}}% 277 \def\PYGZlt{\discretionary{}{\Wrappedafterbreak\char`\<}{\char`\<}}% 278 \def\PYGZgt{\discretionary{\char`\>}{\Wrappedafterbreak}{\char`\>}}% 279 \def\PYGZsh{\discretionary{}{\Wrappedafterbreak\char`\#}{\char`\#}}% 280 \def\PYGZpc{\discretionary{}{\Wrappedafterbreak\char`\%}{\char`\%}}% 281 \def\PYGZdl{\discretionary{}{\Wrappedafterbreak\char`\$}{\char`\$}}% 282 \def\PYGZhy{\discretionary{\char`\-}{\Wrappedafterbreak}{\char`\-}}% 283 \def\PYGZsq{\discretionary{}{\Wrappedafterbreak\textquotesingle}{\textquotesingle}}% 284 \def\PYGZdq{\discretionary{}{\Wrappedafterbreak\char`\"}{\char`\"}}% 285 \def\PYGZti{\discretionary{\char`\~}{\Wrappedafterbreak}{\char`\~}}% 286 } 287 % Some characters . , ; ? ! / are not pygmentized. 288 % This macro makes them "active" and they will insert potential linebreaks 289 \newcommand*\Wrappedbreaksatpunct {% 290 \lccode`\~`\.\lowercase{\def~}{\discretionary{\hbox{\char`\.}}{\Wrappedafterbreak}{\hbox{\char`\.}}}% 291 \lccode`\~`\,\lowercase{\def~}{\discretionary{\hbox{\char`\,}}{\Wrappedafterbreak}{\hbox{\char`\,}}}% 292 \lccode`\~`\;\lowercase{\def~}{\discretionary{\hbox{\char`\;}}{\Wrappedafterbreak}{\hbox{\char`\;}}}% 293 \lccode`\~`\:\lowercase{\def~}{\discretionary{\hbox{\char`\:}}{\Wrappedafterbreak}{\hbox{\char`\:}}}% 294 \lccode`\~`\?\lowercase{\def~}{\discretionary{\hbox{\char`\?}}{\Wrappedafterbreak}{\hbox{\char`\?}}}% 295 \lccode`\~`\!\lowercase{\def~}{\discretionary{\hbox{\char`\!}}{\Wrappedafterbreak}{\hbox{\char`\!}}}% 296 \lccode`\~`\/\lowercase{\def~}{\discretionary{\hbox{\char`\/}}{\Wrappedafterbreak}{\hbox{\char`\/}}}% 297 \catcode`\.\active 298 \catcode`\,\active 299 \catcode`\;\active 300 \catcode`\:\active 301 \catcode`\?\active 302 \catcode`\!\active 303 \catcode`\/\active 304 \lccode`\~`\~ 305 } 306 \makeatother 307 308 \let\OriginalVerbatim=\Verbatim 309 \makeatletter 310 \renewcommand{\Verbatim}[1][1]{% 311 %\parskip\z@skip 312 \sbox\Wrappedcontinuationbox {\Wrappedcontinuationsymbol}% 313 \sbox\Wrappedvisiblespacebox {\FV@SetupFont\Wrappedvisiblespace}% 314 \def\FancyVerbFormatLine ##1{\hsize\linewidth 315 \vtop{\raggedright\hyphenpenalty\z@\exhyphenpenalty\z@ 316 \doublehyphendemerits\z@\finalhyphendemerits\z@ 317 \strut ##1\strut}% 318 }% 319 % If the linebreak is at a space, the latter will be displayed as visible 320 % space at end of first line, and a continuation symbol starts next line. 321 % Stretch/shrink are however usually zero for typewriter font. 322 \def\FV@Space {% 323 \nobreak\hskip\z@ plus\fontdimen3\font minus\fontdimen4\font 324 \discretionary{\copy\Wrappedvisiblespacebox}{\Wrappedafterbreak} 325 {\kern\fontdimen2\font}% 326 }% 327 328 % Allow breaks at special characters using \PYG... macros. 329 \Wrappedbreaksatspecials 330 % Breaks at punctuation characters . , ; ? ! and / need catcode=\active 331 \OriginalVerbatim[#1,codes*=\Wrappedbreaksatpunct]% 332 } 333 \makeatother 334 335 % Exact colors from NB 336 \definecolor{incolor}{HTML}{303F9F} 337 \definecolor{outcolor}{HTML}{D84315} 338 \definecolor{cellborder}{HTML}{CFCFCF} 339 \definecolor{cellbackground}{HTML}{F7F7F7} 340 341 % prompt 342 \makeatletter 343 \newcommand{\boxspacing}{\kern\kvtcb@left@rule\kern\kvtcb@boxsep} 344 \makeatother 345 \newcommand{\prompt}[4]{ 346 \ttfamily\llap{{\color{#2}[#3]:\hspace{3pt}#4}}\vspace{-\baselineskip} 347 } 348 349 350 351 % Prevent overflowing lines due to hard-to-break entities 352 \sloppy 353 % Setup hyperref package 354 \hypersetup{ 355 breaklinks=true, % so long urls are correctly broken across lines 356 colorlinks=true, 357 urlcolor=urlcolor, 358 linkcolor=linkcolor, 359 citecolor=citecolor, 360 } 361 % Slightly bigger margins than the latex defaults 362 363 \geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in} 364 365 366 367 \begin{document} 368 369 \maketitle 370 371 372 373 374 \emph{For this exercise you should have received this text in .ipynb 375 format. Complete the exercises by modifying this file, and submit the 376 modified version} 377 378 \textbf{Exercise 1 (6 points)} 379 380 Use Sage to find the intersection points \emph{in the real plane} (that 381 is, only those points such that \emph{both} coordinates are real 382 numbers) of the following pairs of geometric objects: 383 384 \begin{itemize} 385 \tightlist 386 \item 387 The circle of equation \(x^2 + y^2 = 4\) and the ellipse of equation 388 \(\left(\frac x2\right)^2 + (2y)^2 = 4\). 389 \item 390 The circle of equation \(x^2 + y^2 = 4\) and the ellipse of equation 391 \(\left(\frac x2-2\right)^2 + (2y)^2 = 4\). 392 \item 393 The curve of equation \(y^2 = x^3 -x +1\) and the horizontal line 394 \(y=10\). 395 \item 396 The \(x\)-axis and the graph of the function 397 \(f(x)=\log(x) - e^{-x}\). \emph{Hint: \(f(x)\) has only one real 398 zero.} 399 \end{itemize} 400 401 402 \vspace{0.5cm} 403 \textbf{Exercise 2 (6 points)} 404 405 \begin{enumerate} 406 \def\labelenumi{(\alph{enumi})} 407 \tightlist 408 \item 409 Use Sage to compute 410 \end{enumerate} 411 412 \begin{itemize} 413 \tightlist 414 \item 415 the derivative 416 \item 417 a primite (i.e.~integral) 418 \item 419 the power series expansion around \(0\) up to order \(4\) 420 \end{itemize} 421 422 of the following functions: 423 \begin{itemize} 424 \item \(f(x) = e^x\) 425 \item \(f(x) = \sin(x)\) 426 \item \(f(x) = \cos(x)\) 427 \item \(f(x) = \tan(x)\) 428 \item \(f(x) = \log(1+x)\) 429 \item \(f(x) = \sqrt[3]{1+x}\) 430 \end{itemize} 431 432 \begin{enumerate} 433 \def\labelenumi{(\alph{enumi})} 434 \setcounter{enumi}{1} 435 \item 436 Use Sage to get the Latex code that represents the objects you 437 computed above. 438 \item 439 Arrange the results of the previous points in a table in Latex. The 440 table should have 4 columns (function, derivative, integral, series) 441 and one row for each of the functions above. \emph{Note: when 442 including Latex in a Markdown cell in Jupyter you will not receive any 443 warning if you make mistakes; instead the Latex will simply not be 444 rendered and it will appear as plain text. If you have troubles making 445 this work you can send me a separate .tex (and .pdf) file.} 446 \end{enumerate} 447 448 449 \vspace{0.5cm} 450 \textbf{Exercise 3 (4 points)} 451 452 The equation \begin{align*} 453 y^2+x^{16}=1 454 \end{align*} determines a closed curve in \(\mathbb R^2\) that looks 455 like a rounded square. Determine the area of that shape, giving both an 456 exact value (which might depend on some functions that Sage knows, but 457 you don't) and an approximate value. 458 459 460 \vspace{0.5cm} 461 \textbf{Exercise 4 (12 points)} 462 463 A team of biologists is monitoring the population of river shrimps in 464 the Alzette. At first they thought that the size \(P(t)\) of their 465 population on day \(t\) would satisfy the differential equation 466 \(P'(t)=P(t)/10\). However this does not work well with the data they 467 have collected, so they now believe that the population of shrimps 468 follows the formula \(P'(t)=P(t)/10-b\) for some value of \(b\) between 469 1 and 100. They need your help here. 470 471 \begin{enumerate} 472 \def\labelenumi{(\alph{enumi})} 473 \item 474 Using Sage, find a solution for the differential equation with initial 475 conditions \begin{align*} 476 \begin{cases} 477 P'(t)&=\frac{P(t)}{10}-b\\ 478 P(1)&=1000 479 \end{cases} 480 \end{align*} where \(b\) is a generic constant. 481 \item 482 The list \texttt{data} in the cell below contains the actual number of 483 shrimps that was measured every day from day \(1\) (the \(0\) at the 484 beginning is meaningless, but it will help to keep it there). Plot in 485 one single picture, possibly using different colors for each: 486 \end{enumerate} 487 488 \begin{itemize} 489 \tightlist 490 \item 491 The data as a bar chart. 492 \item 493 A curve that interpolates the data, using one of the methods shown in 494 class. 495 \item 496 The solution of the differential equation for \(b=0\). 497 \item 498 The solution of the differential equation for a value of \(b\) of your 499 choice (\(1\leq b\leq 100\)) that fits the data better than \(b=0\). 500 \emph{(For this last point there is no right or wrong choice, just 501 pick one that looks good)} 502 \end{itemize} 503 504 \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder] 505 \prompt{In}{incolor}{ }{\boxspacing} 506 \begin{Verbatim}[commandchars=\\\{\}] 507 \PY{n}{data} \PY{o}{=} \PY{p}{[}\PY{l+m+mi}{0}\PY{p}{,} \PY{l+m+mi}{1000}\PY{p}{,} \PY{l+m+mi}{1123}\PY{p}{,} \PY{l+m+mi}{1223}\PY{p}{,} \PY{l+m+mi}{1190}\PY{p}{,} \PY{l+m+mi}{1432}\PY{p}{,} \PY{l+m+mi}{1553}\PY{p}{,} \PY{l+m+mi}{1709}\PY{p}{,} \PY{l+m+mi}{1826}\PY{p}{,} \PY{l+m+mi}{1980}\PY{p}{,} \PY{l+m+mi}{2146}\PY{p}{,} \PY{l+m+mi}{2172}\PY{p}{,} \PY{l+m+mi}{2383}\PY{p}{,} \PY{l+m+mi}{2588}\PY{p}{,} \PY{l+m+mi}{2822}\PY{p}{,} \PY{l+m+mi}{3401}\PY{p}{,} \PY{l+m+mi}{3330}\PY{p}{,} \PY{l+m+mi}{4157}\PY{p}{,} \PY{l+m+mi}{3994}\PY{p}{,} \PY{l+m+mi}{4995}\PY{p}{,} \PY{l+m+mi}{5392}\PY{p}{,} \PY{l+m+mi}{5910}\PY{p}{,} \PY{l+m+mi}{6468}\PY{p}{,} \PY{l+m+mi}{7128}\PY{p}{,} \PY{l+m+mi}{7325}\PY{p}{,} \PY{l+m+mi}{7984}\PY{p}{,} \PY{l+m+mi}{9634}\PY{p}{,} \PY{l+m+mi}{10473}\PY{p}{,} \PY{l+m+mi}{11761}\PY{p}{,} \PY{l+m+mi}{12777}\PY{p}{]} 508 \end{Verbatim} 509 \end{tcolorbox} 510 511 \vspace{0.5cm} 512 \textbf{Grading} 513 514 This homework assignment is worth \(28\) (\(24+4\)) points, distributed 515 as described above. 516 517 Your final grade for the course will be the total of points you obtained 518 (notice that the maximum is \(20+20+16+28=84\)) divided by \(4\), 519 rounded to the nearest integer. More precisely 520 521 \begin{align*} 522 \operatorname{grade} = \operatorname{min}\left(20, \left\lfloor \frac{\operatorname{total}}{4} + 0.5\right\rfloor\right) 523 \end{align*} 524 525 526 % Add a bibliography block to the postdoc 527 528 529 530 \end{document}