[script] solutions of exercises at end of chapters

This commit is contained in:
Jan Benda 2019-12-01 00:21:07 +01:00
parent 50458f7f98
commit 1e3ec8944e
19 changed files with 190 additions and 280 deletions

View File

@ -191,3 +191,7 @@ Estimate the statistical significance of a correlation coefficient.
coefficient computed from the original data. coefficient computed from the original data.
\end{enumerate} \end{enumerate}
\end{exercise} \end{exercise}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\printsolutions

View File

@ -46,7 +46,7 @@ watchchapter :
cleanchapter : cleanpythonplots cleangnuplots cleanchapter : cleanpythonplots cleangnuplots
rm -f *~ rm -f *~
rm -f $(BASENAME).aux $(BASENAME).log rm -f $(BASENAME).aux $(BASENAME).log
rm -f $(BASENAME)-chapter.aux $(BASENAME)-chapter.log $(BASENAME)-chapter.out $(BASENAME)-chapter.idx rm -f $(BASENAME)-chapter.aux $(BASENAME)-chapter.log $(BASENAME)-chapter.out $(BASENAME)-chapter.idx $(BASENAME)-chapter-solutions.tex
cleanallchapter : cleanchapter cleanallchapter : cleanchapter

View File

@ -505,3 +505,6 @@ The debugger offers some more (advanced) features but the
functionality offered by the basic tools is often enough to debug a functionality offered by the basic tools is often enough to debug a
program. program.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\printsolutions

View File

@ -168,3 +168,7 @@ x = randi(6, 100, 1); % Some integer-valued data.
h = h/sum(h); % Normalize to probability. h = h/sum(h); % Normalize to probability.
bar(b, h); % Plot the probabilities. bar(b, h); % Plot the probabilities.
\end{lstlisting} \end{lstlisting}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\printsolutions

View File

@ -285,7 +285,6 @@
\usepackage{mdframed} \usepackage{mdframed}
\usepackage{xstring} \usepackage{xstring}
\newlistof{exercisef}{loe}{\tr{Exercises}{\"Ubungen}} \newlistof{exercisef}{loe}{\tr{Exercises}{\"Ubungen}}
\newcommand{\codepath}{}
\DeclareFloatingEnvironment[ \DeclareFloatingEnvironment[
fileext=loe, fileext=loe,
name={\tr{Exercise}{\"Ubung}}, name={\tr{Exercise}{\"Ubung}},
@ -293,38 +292,44 @@
chapterlistsgaps=on, chapterlistsgaps=on,
]{exercisef} ]{exercisef}
\newboolean{showexercisesolutions} \newboolean{showexercisesolutions}
\setboolean{showexercisesolutions}{false} \setboolean{showexercisesolutions}{true}
\newwrite\solutions % file descriptor for writing solutions
% we need to know the name of the included file as \currentjobname:
\usepackage{xpatch}
\makeatletter
\def\currentjobname{\jobname}%
\xpretocmd{\include}{\def\currentjobname{#1}\immediate\openout\solutions=\currentjobname-solutions}{}{}
\makeatother
\usepackage{needspace}
\newenvironment{exercise}[2]% \newenvironment{exercise}[2]%
{ \newcommand{\exercisesource}{#1}% { \setlength{\fboxsep}{2mm}%
\newcommand{\exercisefile}{\protect\StrSubstitute{#1}{_}{\_}}%
\newcommand{\exerciseoutput}{#2}%
\setlength{\fboxsep}{2mm}%
\newcommand{\saveenumi}{\theenumi}\renewcommand{\labelenumi}{(\alph{enumi})}% \newcommand{\saveenumi}{\theenumi}\renewcommand{\labelenumi}{(\alph{enumi})}%
\captionsetup{singlelinecheck=off,hypcap=false,labelfont={large,sf,it,bf},% \captionsetup{singlelinecheck=off,hypcap=false,labelfont={large,sf,it,bf},%
font={large,sf,it,bf},skip={0.5ex}}% font={large,sf,it,bf},skip={0.5ex}}%
\begin{mdframed}[linewidth=0pt,backgroundcolor=exerciseback]% \begin{mdframed}[linewidth=0pt,backgroundcolor=exerciseback]%
\captionof{exercisef}[\exercisefile]{}% \captionof{exercisef}[\protect\StrSubstitute{#1}{_}{\_}]{}%
\captionsetup{font={normal,sf,it}}% \captionsetup{font={normal,sf,it}}%
\immediate\write\solutions{\unexpanded{%
\subsection}[Exercise \thechapter.\arabic{exercisef}]%
{\unexpanded{\needspace{4\baselineskip}}Exercise \thechapter.\arabic{exercisef}}}%
\immediate\write\solutions{\unexpanded{\label}{solution\arabic{exercisef}}}%
\immediate\write\solutions{\unexpanded{\lstinputlisting[belowskip=0ex,aboveskip=0ex,%
nolol=true, title={\textbf{Source code:} \protect\StrSubstitute{#1}{_}{\_}}]}{#1}}%
\ifthenelse{\equal{#2}{}}{}%
{\immediate\write\solutions{\unexpanded{\lstinputlisting[language={},%
nolol=true, title={\textbf{Output:}}, belowskip=0ex, aboveskip=1ex]}{#2}}}%
\immediate\write\solutions{}%
}% }%
{ \renewcommand{\theenumi}{\saveenumi}% { \ifthenelse{\boolean{showexercisesolutions}}%
\ifthenelse{\boolean{showexercisesolutions}}% {\hspace*{\fill}\hyperref[solution\arabic{exercisef}]{Solution}}{}%
{ \hypersetup{hypertexnames=false}% \renewcommand{\theenumi}{\saveenumi}%
\ifthenelse{\equal{\exercisesource}{}}{}%
{ \addtocounter{lstlisting}{-1}%
\lstinputlisting[belowskip=0pt,aboveskip=1ex,nolol=true,%
title={\textbf{\tr{Solution}{L\"osung}:} \exercisefile}]%
{\codepath\exercisesource}%
\ifthenelse{\equal{\exerciseoutput}{}}{}%
{ \addtocounter{lstlisting}{-1}%
\lstinputlisting[language={},title={\textbf{\tr{Output}{Ausgabe}:}},%
nolol=true,belowskip=0pt]%
{\codepath\exerciseoutput}%
}%
}%
\hypersetup{hypertexnames=true}%
}{}%
\end{mdframed}% \end{mdframed}%
} }
}
\newcommand{\printsolutions}{\immediate\closeout\solutions%
\ifthenelse{\boolean{showexercisesolutions}}{%
\clearpage\section{Solutions to the exercises}%
\input{\currentjobname-solutions}}{}}
\setlength{\cftexercisefindent}{1.2em} \setlength{\cftexercisefindent}{1.2em}
\setlength{\cftexercisefnumwidth}{2.6em} \setlength{\cftexercisefnumwidth}{2.6em}

View File

@ -362,3 +362,7 @@ activity pattern in the population $r_1$, $r_2$, ... $r_n$ is thus
\[ {\cal L}(\phi|r_1, r_2, \ldots r_n) = \sum_{i=1}^n \log p_i(r_i|\phi) \] \[ {\cal L}(\phi|r_1, r_2, \ldots r_n) = \sum_{i=1}^n \log p_i(r_i|\phi) \]
The angle $\phi$ that maximizes this likelihood is then an estimate of The angle $\phi$ that maximizes this likelihood is then an estimate of
the orientation of the edge. the orientation of the edge.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\printsolutions

View File

@ -778,3 +778,7 @@ Key ingredients for a good data plot:
thicker lines help. thicker lines help.
\item Error bars wherever they are appropriate. \item Error bars wherever they are appropriate.
\end{itemize} \end{itemize}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\printsolutions

View File

@ -551,3 +551,7 @@ kernel.
the same size as the original stimulus contained in file the same size as the original stimulus contained in file
\file{sta\_data.mat}. \file{sta\_data.mat}.
\end{exercise} \end{exercise}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\printsolutions

View File

@ -1,7 +1,7 @@
%!PS-Adobe-2.0 EPSF-2.0 %!PS-Adobe-2.0 EPSF-2.0
%%Title: pointprocessscetchA.tex %%Title: pointprocessscetchA.tex
%%Creator: gnuplot 5.0 patchlevel 6 %%Creator: gnuplot 4.6 patchlevel 4
%%CreationDate: Thu Oct 17 14:13:46 2019 %%CreationDate: Sat Nov 30 23:19:23 2019
%%DocumentFonts: %%DocumentFonts:
%%BoundingBox: 50 50 373 135 %%BoundingBox: 50 50 373 135
%%EndComments %%EndComments
@ -18,7 +18,6 @@ gnudict begin
/Dashlength 1 def /Dashlength 1 def
/Landscape false def /Landscape false def
/Level1 false def /Level1 false def
/Level3 false def
/Rounded true def /Rounded true def
/ClipToBoundingBox false def /ClipToBoundingBox false def
/SuppressPDFMark false def /SuppressPDFMark false def
@ -30,11 +29,11 @@ gnudict begin
% %
/vshift -73 def /vshift -73 def
/dl1 { /dl1 {
10.0 Dashlength userlinewidth gnulinewidth div mul mul mul 10.0 Dashlength mul mul
Rounded { currentlinewidth 0.75 mul sub dup 0 le { pop 0.01 } if } if Rounded { currentlinewidth 0.75 mul sub dup 0 le { pop 0.01 } if } if
} def } def
/dl2 { /dl2 {
10.0 Dashlength userlinewidth gnulinewidth div mul mul mul 10.0 Dashlength mul mul
Rounded { currentlinewidth 0.75 mul add } if Rounded { currentlinewidth 0.75 mul add } if
} def } def
/hpt_ 31.5 def /hpt_ 31.5 def
@ -48,7 +47,7 @@ gnudict begin
} if } if
} def } def
% %
% Gnuplot Prolog Version 5.1 (Oct 2015) % Gnuplot Prolog Version 4.6 (September 2012)
% %
%/SuppressPDFMark true def %/SuppressPDFMark true def
% %
@ -65,11 +64,11 @@ gnudict begin
/vpt2 vpt 2 mul def /vpt2 vpt 2 mul def
/hpt2 hpt 2 mul def /hpt2 hpt 2 mul def
/Lshow {currentpoint stroke M 0 vshift R /Lshow {currentpoint stroke M 0 vshift R
Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def Blacktext {gsave 0 setgray show grestore} {show} ifelse} def
/Rshow {currentpoint stroke M dup stringwidth pop neg vshift R /Rshow {currentpoint stroke M dup stringwidth pop neg vshift R
Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def Blacktext {gsave 0 setgray show grestore} {show} ifelse} def
/Cshow {currentpoint stroke M dup stringwidth pop -2 div vshift R /Cshow {currentpoint stroke M dup stringwidth pop -2 div vshift R
Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def Blacktext {gsave 0 setgray show grestore} {show} ifelse} def
/UP {dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def /UP {dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def
/hpt2 hpt 2 mul def /vpt2 vpt 2 mul def} def /hpt2 hpt 2 mul def /vpt2 vpt 2 mul def} def
/DL {Color {setrgbcolor Solid {pop []} if 0 setdash} /DL {Color {setrgbcolor Solid {pop []} if 0 setdash}
@ -83,7 +82,7 @@ gnudict begin
/PL {stroke userlinewidth setlinewidth /PL {stroke userlinewidth setlinewidth
Rounded {1 setlinejoin 1 setlinecap} if} def Rounded {1 setlinejoin 1 setlinecap} if} def
3.8 setmiterlimit 3.8 setmiterlimit
% Classic Line colors (version 5.0) % Default Line colors
/LCw {1 1 1} def /LCw {1 1 1} def
/LCb {0 0 0} def /LCb {0 0 0} def
/LCa {0 0 0} def /LCa {0 0 0} def
@ -96,21 +95,19 @@ gnudict begin
/LC6 {0 0 0} def /LC6 {0 0 0} def
/LC7 {1 0.3 0} def /LC7 {1 0.3 0} def
/LC8 {0.5 0.5 0.5} def /LC8 {0.5 0.5 0.5} def
% Default dash patterns (version 5.0) % Default Line Types
/LTB {BL [] LCb DL} def
/LTw {PL [] 1 setgray} def /LTw {PL [] 1 setgray} def
/LTb {PL [] LCb DL} def /LTb {BL [] LCb DL} def
/LTa {AL [1 udl mul 2 udl mul] 0 setdash LCa setrgbcolor} def /LTa {AL [1 udl mul 2 udl mul] 0 setdash LCa setrgbcolor} def
/LT0 {PL [] LC0 DL} def /LT0 {PL [] LC0 DL} def
/LT1 {PL [2 dl1 3 dl2] LC1 DL} def /LT1 {PL [4 dl1 2 dl2] LC1 DL} def
/LT2 {PL [1 dl1 1.5 dl2] LC2 DL} def /LT2 {PL [2 dl1 3 dl2] LC2 DL} def
/LT3 {PL [6 dl1 2 dl2 1 dl1 2 dl2] LC3 DL} def /LT3 {PL [1 dl1 1.5 dl2] LC3 DL} def
/LT4 {PL [1 dl1 2 dl2 6 dl1 2 dl2 1 dl1 2 dl2] LC4 DL} def /LT4 {PL [6 dl1 2 dl2 1 dl1 2 dl2] LC4 DL} def
/LT5 {PL [4 dl1 2 dl2] LC5 DL} def /LT5 {PL [3 dl1 3 dl2 1 dl1 3 dl2] LC5 DL} def
/LT6 {PL [1.5 dl1 1.5 dl2 1.5 dl1 1.5 dl2 1.5 dl1 6 dl2] LC6 DL} def /LT6 {PL [2 dl1 2 dl2 2 dl1 6 dl2] LC6 DL} def
/LT7 {PL [3 dl1 3 dl2 1 dl1 3 dl2] LC7 DL} def /LT7 {PL [1 dl1 2 dl2 6 dl1 2 dl2 1 dl1 2 dl2] LC7 DL} def
/LT8 {PL [2 dl1 2 dl2 2 dl1 6 dl2] LC8 DL} def /LT8 {PL [2 dl1 2 dl2 2 dl1 2 dl2 2 dl1 2 dl2 2 dl1 4 dl2] LC8 DL} def
/SL {[] 0 setdash} def
/Pnt {stroke [] 0 setdash gsave 1 setlinecap M 0 0 V stroke grestore} def /Pnt {stroke [] 0 setdash gsave 1 setlinecap M 0 0 V stroke grestore} def
/Dia {stroke [] 0 setdash 2 copy vpt add M /Dia {stroke [] 0 setdash 2 copy vpt add M
hpt neg vpt neg V hpt vpt neg V hpt neg vpt neg V hpt vpt neg V
@ -332,14 +329,9 @@ gnudict begin
% %
/languagelevel where /languagelevel where
{pop languagelevel} {1} ifelse {pop languagelevel} {1} ifelse
dup 2 lt 2 lt
{/InterpretLevel1 true def {/InterpretLevel1 true def}
/InterpretLevel3 false def} {/InterpretLevel1 Level1 def}
{/InterpretLevel1 Level1 def
2 gt
{/InterpretLevel3 Level3 def}
{/InterpretLevel3 false def}
ifelse }
ifelse ifelse
% %
% PostScript level 2 pattern fill definitions % PostScript level 2 pattern fill definitions
@ -428,7 +420,6 @@ Level1 {Level1PatternFill} {Level2PatternFill} ifelse
/Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont /Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont
dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall
currentdict end definefont pop currentdict end definefont pop
%
Level1 SuppressPDFMark or Level1 SuppressPDFMark or
{} { {} {
/SDict 10 dict def /SDict 10 dict def
@ -438,42 +429,14 @@ systemdict /pdfmark known not {
SDict begin [ SDict begin [
/Title (pointprocessscetchA.tex) /Title (pointprocessscetchA.tex)
/Subject (gnuplot plot) /Subject (gnuplot plot)
/Creator (gnuplot 5.0 patchlevel 6) /Creator (gnuplot 4.6 patchlevel 4)
/Author (grewe) /Author (jan)
% /Producer (gnuplot) % /Producer (gnuplot)
% /Keywords () % /Keywords ()
/CreationDate (Thu Oct 17 14:13:46 2019) /CreationDate (Sat Nov 30 23:19:23 2019)
/DOCINFO pdfmark /DOCINFO pdfmark
end end
} ifelse } ifelse
%
% Support for boxed text - Ethan A Merritt May 2005
%
/InitTextBox { userdict /TBy2 3 -1 roll put userdict /TBx2 3 -1 roll put
userdict /TBy1 3 -1 roll put userdict /TBx1 3 -1 roll put
/Boxing true def } def
/ExtendTextBox { Boxing
{ gsave dup false charpath pathbbox
dup TBy2 gt {userdict /TBy2 3 -1 roll put} {pop} ifelse
dup TBx2 gt {userdict /TBx2 3 -1 roll put} {pop} ifelse
dup TBy1 lt {userdict /TBy1 3 -1 roll put} {pop} ifelse
dup TBx1 lt {userdict /TBx1 3 -1 roll put} {pop} ifelse
grestore } if } def
/PopTextBox { newpath TBx1 TBxmargin sub TBy1 TBymargin sub M
TBx1 TBxmargin sub TBy2 TBymargin add L
TBx2 TBxmargin add TBy2 TBymargin add L
TBx2 TBxmargin add TBy1 TBymargin sub L closepath } def
/DrawTextBox { PopTextBox stroke /Boxing false def} def
/FillTextBox { gsave PopTextBox 1 1 1 setrgbcolor fill grestore /Boxing false def} def
0 0 0 0 InitTextBox
/TBxmargin 20 def
/TBymargin 20 def
/Boxing false def
/textshow { ExtendTextBox Gshow } def
%
% redundant definitions for compatibility with prologue.ps older than 5.0.2
/LTB {BL [] LCb DL} def
/LTb {PL [] LCb DL} def
end end
%%EndProlog %%EndProlog
%%Page: 1 1 %%Page: 1 1
@ -487,9 +450,10 @@ newpath
2.000 UL 2.000 UL
LTb LTb
LCb setrgbcolor LCb setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 1.000 UP 0.00 0.00 0.00 C 1.000 UP
LTb
LCb setrgbcolor LCb setrgbcolor
LTb
1.000 UL 1.000 UL
LTb LTb
gsave 6208 824 N 0 -32 V 121 32 V -121 32 V 0 -32 V 1 PolyFill gsave 6208 824 N 0 -32 V 121 32 V -121 32 V 0 -32 V 1 PolyFill
@ -503,11 +467,9 @@ gsave 6208 824 N 0 -32 V 121 32 V -121 32 V 0 -32 V 1 PolyFill
stroke stroke
2.000 UL 2.000 UL
LTb LTb
0.00 0.00 0.00 C % Begin plot #1 0.00 0.00 0.00 C 10.000 UL
10.000 UL LT0
LTb LC0 setrgbcolor
LCb setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 910 573 M 0.00 0.00 0.00 C 910 573 M
0 503 V 0 503 V
1412 573 M 1412 573 M
@ -526,16 +488,11 @@ LCb setrgbcolor
0 503 V 0 503 V
5685 573 M 5685 573 M
0 503 V 0 503 V
1.000 UP
stroke stroke
LTw
% End plot #1
2.000 UL 2.000 UL
LTb LTb
LCb setrgbcolor LCb setrgbcolor
[] 0 setdash
1.000 UP
2.000 UL
LTb
0.00 0.00 0.00 C stroke 0.00 0.00 0.00 C stroke
grestore grestore
end end

View File

@ -1,7 +1,7 @@
%!PS-Adobe-2.0 EPSF-2.0 %!PS-Adobe-2.0 EPSF-2.0
%%Title: pointprocessscetchB.tex %%Title: pointprocessscetchB.tex
%%Creator: gnuplot 5.0 patchlevel 6 %%Creator: gnuplot 4.6 patchlevel 4
%%CreationDate: Thu Oct 17 14:13:46 2019 %%CreationDate: Sat Nov 30 23:19:23 2019
%%DocumentFonts: %%DocumentFonts:
%%BoundingBox: 50 50 373 237 %%BoundingBox: 50 50 373 237
%%EndComments %%EndComments
@ -18,7 +18,6 @@ gnudict begin
/Dashlength 1 def /Dashlength 1 def
/Landscape false def /Landscape false def
/Level1 false def /Level1 false def
/Level3 false def
/Rounded true def /Rounded true def
/ClipToBoundingBox false def /ClipToBoundingBox false def
/SuppressPDFMark false def /SuppressPDFMark false def
@ -30,11 +29,11 @@ gnudict begin
% %
/vshift -73 def /vshift -73 def
/dl1 { /dl1 {
10.0 Dashlength userlinewidth gnulinewidth div mul mul mul 10.0 Dashlength mul mul
Rounded { currentlinewidth 0.75 mul sub dup 0 le { pop 0.01 } if } if Rounded { currentlinewidth 0.75 mul sub dup 0 le { pop 0.01 } if } if
} def } def
/dl2 { /dl2 {
10.0 Dashlength userlinewidth gnulinewidth div mul mul mul 10.0 Dashlength mul mul
Rounded { currentlinewidth 0.75 mul add } if Rounded { currentlinewidth 0.75 mul add } if
} def } def
/hpt_ 31.5 def /hpt_ 31.5 def
@ -48,7 +47,7 @@ gnudict begin
} if } if
} def } def
% %
% Gnuplot Prolog Version 5.1 (Oct 2015) % Gnuplot Prolog Version 4.6 (September 2012)
% %
%/SuppressPDFMark true def %/SuppressPDFMark true def
% %
@ -65,11 +64,11 @@ gnudict begin
/vpt2 vpt 2 mul def /vpt2 vpt 2 mul def
/hpt2 hpt 2 mul def /hpt2 hpt 2 mul def
/Lshow {currentpoint stroke M 0 vshift R /Lshow {currentpoint stroke M 0 vshift R
Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def Blacktext {gsave 0 setgray show grestore} {show} ifelse} def
/Rshow {currentpoint stroke M dup stringwidth pop neg vshift R /Rshow {currentpoint stroke M dup stringwidth pop neg vshift R
Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def Blacktext {gsave 0 setgray show grestore} {show} ifelse} def
/Cshow {currentpoint stroke M dup stringwidth pop -2 div vshift R /Cshow {currentpoint stroke M dup stringwidth pop -2 div vshift R
Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def Blacktext {gsave 0 setgray show grestore} {show} ifelse} def
/UP {dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def /UP {dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def
/hpt2 hpt 2 mul def /vpt2 vpt 2 mul def} def /hpt2 hpt 2 mul def /vpt2 vpt 2 mul def} def
/DL {Color {setrgbcolor Solid {pop []} if 0 setdash} /DL {Color {setrgbcolor Solid {pop []} if 0 setdash}
@ -83,7 +82,7 @@ gnudict begin
/PL {stroke userlinewidth setlinewidth /PL {stroke userlinewidth setlinewidth
Rounded {1 setlinejoin 1 setlinecap} if} def Rounded {1 setlinejoin 1 setlinecap} if} def
3.8 setmiterlimit 3.8 setmiterlimit
% Classic Line colors (version 5.0) % Default Line colors
/LCw {1 1 1} def /LCw {1 1 1} def
/LCb {0 0 0} def /LCb {0 0 0} def
/LCa {0 0 0} def /LCa {0 0 0} def
@ -96,21 +95,19 @@ gnudict begin
/LC6 {0 0 0} def /LC6 {0 0 0} def
/LC7 {1 0.3 0} def /LC7 {1 0.3 0} def
/LC8 {0.5 0.5 0.5} def /LC8 {0.5 0.5 0.5} def
% Default dash patterns (version 5.0) % Default Line Types
/LTB {BL [] LCb DL} def
/LTw {PL [] 1 setgray} def /LTw {PL [] 1 setgray} def
/LTb {PL [] LCb DL} def /LTb {BL [] LCb DL} def
/LTa {AL [1 udl mul 2 udl mul] 0 setdash LCa setrgbcolor} def /LTa {AL [1 udl mul 2 udl mul] 0 setdash LCa setrgbcolor} def
/LT0 {PL [] LC0 DL} def /LT0 {PL [] LC0 DL} def
/LT1 {PL [2 dl1 3 dl2] LC1 DL} def /LT1 {PL [4 dl1 2 dl2] LC1 DL} def
/LT2 {PL [1 dl1 1.5 dl2] LC2 DL} def /LT2 {PL [2 dl1 3 dl2] LC2 DL} def
/LT3 {PL [6 dl1 2 dl2 1 dl1 2 dl2] LC3 DL} def /LT3 {PL [1 dl1 1.5 dl2] LC3 DL} def
/LT4 {PL [1 dl1 2 dl2 6 dl1 2 dl2 1 dl1 2 dl2] LC4 DL} def /LT4 {PL [6 dl1 2 dl2 1 dl1 2 dl2] LC4 DL} def
/LT5 {PL [4 dl1 2 dl2] LC5 DL} def /LT5 {PL [3 dl1 3 dl2 1 dl1 3 dl2] LC5 DL} def
/LT6 {PL [1.5 dl1 1.5 dl2 1.5 dl1 1.5 dl2 1.5 dl1 6 dl2] LC6 DL} def /LT6 {PL [2 dl1 2 dl2 2 dl1 6 dl2] LC6 DL} def
/LT7 {PL [3 dl1 3 dl2 1 dl1 3 dl2] LC7 DL} def /LT7 {PL [1 dl1 2 dl2 6 dl1 2 dl2 1 dl1 2 dl2] LC7 DL} def
/LT8 {PL [2 dl1 2 dl2 2 dl1 6 dl2] LC8 DL} def /LT8 {PL [2 dl1 2 dl2 2 dl1 2 dl2 2 dl1 2 dl2 2 dl1 4 dl2] LC8 DL} def
/SL {[] 0 setdash} def
/Pnt {stroke [] 0 setdash gsave 1 setlinecap M 0 0 V stroke grestore} def /Pnt {stroke [] 0 setdash gsave 1 setlinecap M 0 0 V stroke grestore} def
/Dia {stroke [] 0 setdash 2 copy vpt add M /Dia {stroke [] 0 setdash 2 copy vpt add M
hpt neg vpt neg V hpt vpt neg V hpt neg vpt neg V hpt vpt neg V
@ -332,14 +329,9 @@ gnudict begin
% %
/languagelevel where /languagelevel where
{pop languagelevel} {1} ifelse {pop languagelevel} {1} ifelse
dup 2 lt 2 lt
{/InterpretLevel1 true def {/InterpretLevel1 true def}
/InterpretLevel3 false def} {/InterpretLevel1 Level1 def}
{/InterpretLevel1 Level1 def
2 gt
{/InterpretLevel3 Level3 def}
{/InterpretLevel3 false def}
ifelse }
ifelse ifelse
% %
% PostScript level 2 pattern fill definitions % PostScript level 2 pattern fill definitions
@ -428,7 +420,6 @@ Level1 {Level1PatternFill} {Level2PatternFill} ifelse
/Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont /Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont
dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall
currentdict end definefont pop currentdict end definefont pop
%
Level1 SuppressPDFMark or Level1 SuppressPDFMark or
{} { {} {
/SDict 10 dict def /SDict 10 dict def
@ -438,42 +429,14 @@ systemdict /pdfmark known not {
SDict begin [ SDict begin [
/Title (pointprocessscetchB.tex) /Title (pointprocessscetchB.tex)
/Subject (gnuplot plot) /Subject (gnuplot plot)
/Creator (gnuplot 5.0 patchlevel 6) /Creator (gnuplot 4.6 patchlevel 4)
/Author (grewe) /Author (jan)
% /Producer (gnuplot) % /Producer (gnuplot)
% /Keywords () % /Keywords ()
/CreationDate (Thu Oct 17 14:13:46 2019) /CreationDate (Sat Nov 30 23:19:23 2019)
/DOCINFO pdfmark /DOCINFO pdfmark
end end
} ifelse } ifelse
%
% Support for boxed text - Ethan A Merritt May 2005
%
/InitTextBox { userdict /TBy2 3 -1 roll put userdict /TBx2 3 -1 roll put
userdict /TBy1 3 -1 roll put userdict /TBx1 3 -1 roll put
/Boxing true def } def
/ExtendTextBox { Boxing
{ gsave dup false charpath pathbbox
dup TBy2 gt {userdict /TBy2 3 -1 roll put} {pop} ifelse
dup TBx2 gt {userdict /TBx2 3 -1 roll put} {pop} ifelse
dup TBy1 lt {userdict /TBy1 3 -1 roll put} {pop} ifelse
dup TBx1 lt {userdict /TBx1 3 -1 roll put} {pop} ifelse
grestore } if } def
/PopTextBox { newpath TBx1 TBxmargin sub TBy1 TBymargin sub M
TBx1 TBxmargin sub TBy2 TBymargin add L
TBx2 TBxmargin add TBy2 TBymargin add L
TBx2 TBxmargin add TBy1 TBymargin sub L closepath } def
/DrawTextBox { PopTextBox stroke /Boxing false def} def
/FillTextBox { gsave PopTextBox 1 1 1 setrgbcolor fill grestore /Boxing false def} def
0 0 0 0 InitTextBox
/TBxmargin 20 def
/TBymargin 20 def
/Boxing false def
/textshow { ExtendTextBox Gshow } def
%
% redundant definitions for compatibility with prologue.ps older than 5.0.2
/LTB {BL [] LCb DL} def
/LTb {PL [] LCb DL} def
end end
%%EndProlog %%EndProlog
%%Page: 1 1 %%Page: 1 1
@ -487,9 +450,10 @@ newpath
2.000 UL 2.000 UL
LTb LTb
LCb setrgbcolor LCb setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 1.000 UP 0.00 0.00 0.00 C 1.000 UP
LTb
LCb setrgbcolor LCb setrgbcolor
LTb
1.000 UL 1.000 UL
LTb LTb
gsave 6208 3165 N 0 -32 V 121 32 V -121 32 V 0 -32 V 1 PolyFill gsave 6208 3165 N 0 -32 V 121 32 V -121 32 V 0 -32 V 1 PolyFill
@ -503,11 +467,9 @@ gsave 6208 3165 N 0 -32 V 121 32 V -121 32 V 0 -32 V 1 PolyFill
stroke stroke
2.000 UL 2.000 UL
LTb LTb
0.00 0.00 0.00 C % Begin plot #1 0.00 0.00 0.00 C 10.000 UL
10.000 UL LT0
LTb LC0 setrgbcolor
LCb setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 910 3029 M 0.00 0.00 0.00 C 910 3029 M
0 272 V 0 272 V
502 -272 R 502 -272 R
@ -526,22 +488,18 @@ LCb setrgbcolor
0 272 V 0 272 V
5685 3029 M 5685 3029 M
0 272 V 0 272 V
1.000 UP
stroke stroke
LTw
% End plot #1
2.000 UL 2.000 UL
LTb LTb
LCb setrgbcolor LCb setrgbcolor
[] 0 setdash
1.000 UP
2.000 UL
LTb
0.00 0.00 0.00 C 2.000 UL 0.00 0.00 0.00 C 2.000 UL
LTb LTb
LCb setrgbcolor LCb setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 1.000 UP 0.00 0.00 0.00 C 1.000 UP
LTb
LCb setrgbcolor LCb setrgbcolor
LTb
1.000 UL 1.000 UL
LTb LTb
gsave 6208 2043 N 0 -32 V 121 32 V -121 32 V 0 -32 V 1 PolyFill gsave 6208 2043 N 0 -32 V 121 32 V -121 32 V 0 -32 V 1 PolyFill
@ -552,86 +510,76 @@ gsave 6208 2043 N 0 -32 V 121 32 V -121 32 V 0 -32 V 1 PolyFill
0 -32 V 0 -32 V
-5680 0 R -5680 0 R
5680 0 V 5680 0 V
stroke
1291 1929 M 1291 1929 M
121 32 V 121 32 V
-121 32 V -121 32 V
-260 0 R -260 -64 R
910 1961 L -121 32 V
121 -32 V 121 32 V
-121 32 R 910 1961 M
502 0 V 502 0 V
stroke 590 -32 R
2002 1929 M
121 32 V 121 32 V
-121 32 V -121 32 V
-469 0 R -469 -64 R
-121 -32 V -121 32 V
121 -32 V 121 32 V
-121 32 R -121 -32 R
711 0 V 711 0 V
stroke 206 -22 R
2329 1939 M
84 22 V 84 22 V
-84 22 V -84 22 V
-122 0 R -122 -44 R
-84 -22 V -84 22 V
84 -22 V 84 22 V
-84 22 R -84 -22 R
290 0 V 290 0 V
stroke 216 -23 R
2629 1938 M
88 23 V 88 23 V
-88 23 V -88 23 V
-128 0 R -128 -46 R
-88 -23 V -88 23 V
88 -23 V 88 23 V
-88 23 R -88 -23 R
304 0 V 304 0 V
stroke 329 -32 R
3046 1929 M
121 32 V 121 32 V
-121 32 V -121 32 V
-208 0 R -208 -64 R
-121 -32 V -121 32 V
121 -32 V 121 32 V
-121 32 R -121 -32 R
450 0 V 450 0 V
stroke 745 -32 R
3912 1929 M
121 32 V 121 32 V
-121 32 V -121 32 V
-624 0 R -624 -64 R
-121 -32 V -121 32 V
121 -32 V 121 32 V
-121 32 R -121 -32 R
866 0 V 866 0 V
stroke 496 -32 R
4529 1929 M
121 32 V 121 32 V
-121 32 V -121 32 V
-375 0 R -375 -64 R
-121 -32 V -121 32 V
121 -32 V 121 32 V
-121 32 R -121 -32 R
617 0 V 617 0 V
stroke 914 -32 R
5564 1929 M
121 32 V 121 32 V
-121 32 V -121 32 V
-793 0 R -793 -64 R
-121 -32 V -121 32 V
121 -32 V 121 32 V
-121 32 R -121 -32 R
1035 0 V 1035 0 V
stroke stroke
2.000 UL 2.000 UL
LTb LTb
0.00 0.00 0.00 C % Begin plot #1 0.00 0.00 0.00 C 10.000 UL
10.000 UL LT0
LTb LC0 setrgbcolor
LCb setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 910 1907 M 0.00 0.00 0.00 C 910 1907 M
0 272 V 0 272 V
502 -272 R 502 -272 R
@ -650,60 +598,47 @@ LCb setrgbcolor
0 272 V 0 272 V
5685 1907 M 5685 1907 M
0 272 V 0 272 V
1.000 UP
stroke stroke
LTw
% End plot #1
2.000 UL 2.000 UL
LTb LTb
LCb setrgbcolor LCb setrgbcolor
[] 0 setdash
1.000 UP
2.000 UL
LTb
0.00 0.00 0.00 C 2.000 UL 0.00 0.00 0.00 C 2.000 UL
LTb LTb
LCb setrgbcolor LCb setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 528 268 M 0.00 0.00 0.00 C 528 268 M
-63 0 V -63 0 V
stroke stroke
LTb LTb
LCb setrgbcolor LCb setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 528 460 M 0.00 0.00 0.00 C 528 460 M
-63 0 V -63 0 V
stroke stroke
LTb LTb
LCb setrgbcolor LCb setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 528 652 M 0.00 0.00 0.00 C 528 652 M
-63 0 V -63 0 V
stroke stroke
LTb LTb
LCb setrgbcolor LCb setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 528 844 M 0.00 0.00 0.00 C 528 844 M
-63 0 V -63 0 V
stroke stroke
LTb LTb
LCb setrgbcolor LCb setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 528 1036 M 0.00 0.00 0.00 C 528 1036 M
-63 0 V -63 0 V
stroke stroke
LTb LTb
LCb setrgbcolor LCb setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 528 1228 M 0.00 0.00 0.00 C 528 1228 M
-63 0 V -63 0 V
stroke stroke
LTb LTb
LCb setrgbcolor LCb setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 2.000 UL 0.00 0.00 0.00 C 2.000 UL
LTb LTb
LCb setrgbcolor LCb setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 528 1276 M 0.00 0.00 0.00 C 528 1276 M
528 220 L 528 220 L
5801 0 R 5801 0 R
@ -711,7 +646,9 @@ LCb setrgbcolor
-5801 0 R -5801 0 R
1.000 UP 1.000 UP
stroke stroke
LTb
LCb setrgbcolor LCb setrgbcolor
LTb
1.000 UL 1.000 UL
LTb LTb
gsave 6208 268 N 0 -32 V 121 32 V -121 32 V 0 -32 V 1 PolyFill gsave 6208 268 N 0 -32 V 121 32 V -121 32 V 0 -32 V 1 PolyFill
@ -725,11 +662,9 @@ gsave 6208 268 N 0 -32 V 121 32 V -121 32 V 0 -32 V 1 PolyFill
stroke stroke
2.000 UL 2.000 UL
LTb LTb
0.00 0.00 0.00 C % Begin plot #1 0.00 0.00 0.00 C 3.000 UL
3.000 UL LT0
LTb LC0 setrgbcolor
LCb setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 528 268 M 0.00 0.00 0.00 C 528 268 M
382 0 V 382 0 V
0 96 R 0 96 R
@ -750,15 +685,11 @@ LCb setrgbcolor
1035 0 V 1035 0 V
0 96 R 0 96 R
533 0 V 533 0 V
stroke
LTw
% End plot #1
% Begin plot #2
1.500 UP 1.500 UP
stroke
2.000 UL 2.000 UL
LTb LT0
LCb setrgbcolor LC0 setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 910 268 CircleF 0.00 0.00 0.00 C 910 268 CircleF
1412 364 CircleF 1412 364 CircleF
2123 460 CircleF 2123 460 CircleF
@ -768,14 +699,10 @@ LCb setrgbcolor
4033 844 CircleF 4033 844 CircleF
4650 940 CircleF 4650 940 CircleF
5685 1036 CircleF 5685 1036 CircleF
LTw
% End plot #2
% Begin plot #3
1.000 UP 1.000 UP
2.000 UL 2.000 UL
LTb LT0
LCb setrgbcolor LC0 setrgbcolor
[] 0 setdash
1.00 1.00 1.00 C 910 268 CircleF 1.00 1.00 1.00 C 910 268 CircleF
1412 364 CircleF 1412 364 CircleF
2123 460 CircleF 2123 460 CircleF
@ -785,14 +712,10 @@ LCb setrgbcolor
4033 844 CircleF 4033 844 CircleF
4650 940 CircleF 4650 940 CircleF
5685 1036 CircleF 5685 1036 CircleF
LTw
% End plot #3
% Begin plot #4
1.500 UP 1.500 UP
2.000 UL 2.000 UL
LTb LT0
LCb setrgbcolor LC0 setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 910 364 CircleF 0.00 0.00 0.00 C 910 364 CircleF
1412 460 CircleF 1412 460 CircleF
2123 556 CircleF 2123 556 CircleF
@ -802,15 +725,10 @@ LCb setrgbcolor
4033 940 CircleF 4033 940 CircleF
4650 1036 CircleF 4650 1036 CircleF
5685 1132 CircleF 5685 1132 CircleF
LTw
% End plot #4
2.000 UL
LTb
LCb setrgbcolor
[] 0 setdash
1.000 UP 1.000 UP
2.000 UL 2.000 UL
LTb LTb
LCb setrgbcolor
0.00 0.00 0.00 C stroke 0.00 0.00 0.00 C stroke
grestore grestore
end end

View File

@ -1,5 +1,6 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Programming in \matlab}\label{programming} \chapter{Programming in \matlab}
\label{programming}
In this chapter we will cover the basics of programming in In this chapter we will cover the basics of programming in
\matlab{}. Starting with the concept of simple variables and data \matlab{}. Starting with the concept of simple variables and data
@ -1768,3 +1769,7 @@ legend('show')
duplication or it grows too large, it is high time to consider duplication or it grows too large, it is high time to consider
extracting features into separate functions. extracting features into separate functions.
\end{ibox} \end{ibox}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\printsolutions

View File

@ -4,7 +4,6 @@
more months might as well have been written by someone more months might as well have been written by someone
else.}{Eagleson's law} else.}{Eagleson's law}
%\selectlanguage{ngerman}
Cultivating a good code style is not just a matter of good taste but Cultivating a good code style is not just a matter of good taste but
rather is a key ingredient for readability and maintainability of code rather is a key ingredient for readability and maintainability of code
and, in the end, facilitates reproducibility of scientific and, in the end, facilitates reproducibility of scientific
@ -36,7 +35,7 @@ of the program but two questions remain: (i) How to organize the files
on the file system and (ii) how to name them that the controlling on the file system and (ii) how to name them that the controlling
script is easily identified among the other \codeterm{m-files}. script is easily identified among the other \codeterm{m-files}.
Upon installation ``MATLAB'' creates a folder called \file{MATLAB} in Upon installation \matlab{} creates a folder called \file{MATLAB} in
the user space (Windows: My files, Linux: Documents, MacOS: the user space (Windows: My files, Linux: Documents, MacOS:
Documents). Since this folder is already appended to the Matlab search Documents). Since this folder is already appended to the Matlab search
path (Box~\ref{matlabpathbox}), it is easiest to stick to it for the path (Box~\ref{matlabpathbox}), it is easiest to stick to it for the
@ -427,4 +426,5 @@ readability and comprehensibility pays off, even to the author!
Johnson} Johnson}
\selectlanguage{english} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\printsolutions

View File

@ -1,6 +1,5 @@
\chapter{\tr{Optimization and gradient descent}{Optimierung und Gradientenabstieg}} \chapter{\tr{Optimization and gradient descent}{Optimierung und Gradientenabstieg}}
% \selectlanguage{ngerman}
To understand the behaviour of a given system sciences often probe the To understand the behaviour of a given system sciences often probe the
system with input signals and then try to explain the responses system with input signals and then try to explain the responses
through a model. Typically the model has a few parameter that specify through a model. Typically the model has a few parameter that specify
@ -356,7 +355,6 @@ large.
iteration of the algorithm.} \label{gradientdescentfig} iteration of the algorithm.} \label{gradientdescentfig}
\end{figure} \end{figure}
\setboolean{showexercisesolutions}{false}
\begin{exercise}{gradientDescent.m}{} \begin{exercise}{gradientDescent.m}{}
Implement the gradient descent for the problem of the linear Implement the gradient descent for the problem of the linear
equation for the measured data in file \file{lin\_regression.mat}. equation for the measured data in file \file{lin\_regression.mat}.
@ -407,4 +405,6 @@ designed for optimizations in the least square error sense
parameter increases complexity and is computationally expensive. parameter increases complexity and is computationally expensive.
\end{important} \end{important}
\selectlanguage{english}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\printsolutions

View File

@ -368,7 +368,6 @@ Punkte in Abbildung \ref{gradientdescentfig} gro{\ss}.
Optimierungsschritt an.} \label{gradientdescentfig} Optimierungsschritt an.} \label{gradientdescentfig}
\end{figure} \end{figure}
\setboolean{showexercisesolutions}{false}
\begin{exercise}{gradientDescent.m}{} \begin{exercise}{gradientDescent.m}{}
Implementiere den Gradientenabstieg f\"ur das Problem der Implementiere den Gradientenabstieg f\"ur das Problem der
Parameteranpassung der linearen Geradengleichung an die Messdaten in Parameteranpassung der linearen Geradengleichung an die Messdaten in

View File

@ -67,7 +67,6 @@
\lstset{inputpath=regression/code} \lstset{inputpath=regression/code}
\include{regression/lecture/regression} \include{regression/lecture/regression}
\setboolean{showexercisesolutions}{false}
\graphicspath{{likelihood/lecture/}{likelihood/lecture/figures/}} \graphicspath{{likelihood/lecture/}{likelihood/lecture/figures/}}
\lstset{inputpath=likelihood/code} \lstset{inputpath=likelihood/code}
\include{likelihood/lecture/likelihood} \include{likelihood/lecture/likelihood}

View File

@ -15,7 +15,7 @@ gausscdf = np.cumsum(gauss)*dx
# plot: # plot:
plt.xkcd() plt.xkcd()
fig = plt.figure( figsize=(6, 2.6) ) fig = plt.figure( figsize=(6, 2.4) )
ax = fig.add_subplot(1, 1, 1) ax = fig.add_subplot(1, 1, 1)
ax.spines['right'].set_visible(False) ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False) ax.spines['top'].set_visible(False)

View File

@ -500,3 +500,7 @@ insufficiently or not at all detected by the correlation coefficient
coefficients close to zero. $\xi$ denote normally distributed coefficients close to zero. $\xi$ denote normally distributed
random numbers.} random numbers.}
\end{figure} \end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\printsolutions