98
epr/epr_rep_folien_jonas/beamerthemeoxfordmaths.sty
Normal file
|
@ -0,0 +1,98 @@
|
|||
%% Mathematical Institute, University of Oxford
|
||||
%% LaTeX Beamer Presentation Theme
|
||||
%%
|
||||
%% v1.0 Original theme: Tim Hosgood 2015 (based on department PowerPoint Template)
|
||||
%% v2.0 Reimplementation: Karl Welzel May 2024 (reimplementation from a standard theme)
|
||||
%% v2.1 Further adjustments and tweaks: Keith Gillow May 2024
|
||||
|
||||
% Use infolines as base
|
||||
\useoutertheme{infolines}
|
||||
|
||||
% tweak colours for Oxford Blue
|
||||
\definecolor{oxfordblue}{RGB}{0,33,71}
|
||||
\usecolortheme[named=oxfordblue]{structure}
|
||||
|
||||
%turn off the navigation symbols
|
||||
\setbeamertemplate{navigation symbols}{}
|
||||
|
||||
% define useful layout lengths
|
||||
\newlength{\textmargin}
|
||||
\setlength{\textmargin}{10mm} % Left and right margin for main content
|
||||
\setbeamersize{text margin left=\textmargin,text margin right=\textmargin}
|
||||
\newlength{\titlehmargin}
|
||||
\setlength{\titlehmargin}{5mm} % Left and right margin for title and footline
|
||||
\newlength{\titlevmargin}
|
||||
\setlength{\titlevmargin}{1mm} % Top and bottom margin for title and footline
|
||||
\newlength{\fullpagewidth}
|
||||
\setlength{\fullpagewidth}{\dimexpr\textwidth+\textmargin+\textmargin\relax}
|
||||
|
||||
% Calculate widths from heights for the logos
|
||||
\newlength{\oxfordlogowidth}
|
||||
\setlength{\oxfordlogowidth}{\dimexpr 10mm * 214 / 311 \relax}
|
||||
\newlength{\mathslogowidth}
|
||||
\setlength{\mathslogowidth}{\dimexpr 3mm * 347 / 105 \relax}
|
||||
|
||||
%% Title slide formatting %%
|
||||
\setbeamertemplate{title page}{
|
||||
\begin{picture}(0,0)
|
||||
\put(-\textmargin, \dimexpr -\paperheight*6/10 \relax){%
|
||||
\ifdim\paperwidth>400pt
|
||||
\includegraphics[width=\paperwidth]{title-slide-background-wide.png}
|
||||
\else
|
||||
\includegraphics[width=\paperwidth]{title-slide-background.png}
|
||||
\fi
|
||||
}
|
||||
\put(-\textmargin +7mm, -55pt){%
|
||||
\begin{minipage}[b][4.5cm][t]{0.7\textwidth}
|
||||
\raggedright
|
||||
\color{white}
|
||||
\usebeamerfont{title}
|
||||
{\inserttitle\\[0.9cm]}
|
||||
\usebeamerfont{subtitle}
|
||||
{\sc\insertauthor\\[0.1cm]}
|
||||
{\it\insertinstitute\\[0.3cm]}
|
||||
{\insertdate}
|
||||
\end{minipage}
|
||||
}
|
||||
\end{picture}
|
||||
}
|
||||
|
||||
%% General slide header %%
|
||||
\setbeamertemplate{frametitle}{%
|
||||
\rlap{%
|
||||
\begin{beamercolorbox}[sep=\titlevmargin,left,wd=\dimexpr\fullpagewidth-\titlehmargin*2+\titlevmargin*2\relax]{frametitle}%
|
||||
\begin{minipage}{\dimexpr\fullpagewidth-\oxfordlogowidth-\titlehmargin*3-0.1cm\relax}%
|
||||
\strut\insertframetitle\strut\par%
|
||||
\end{minipage}%
|
||||
\hspace{\titlehmargin}%
|
||||
\begin{minipage}{\dimexpr\oxfordlogowidth+1mm\relax}%
|
||||
\hfill
|
||||
\vspace*{-4mm}
|
||||
\includegraphics[width=\oxfordlogowidth]{oxford-logo.png}%
|
||||
\end{minipage}%
|
||||
\end{beamercolorbox}%
|
||||
}%
|
||||
\vspace{\dimexpr-\baselineskip+1ex\relax}%
|
||||
\noindent\rlap{\hspace{-\textmargin}\hspace{\titlehmargin}\rule{\dimexpr\fullpagewidth-\titlehmargin*2\relax}{0.4pt}}%
|
||||
\vspace{-0.6ex}%
|
||||
}
|
||||
|
||||
%% General slide footer %%
|
||||
\setbeamertemplate{footline}{%
|
||||
\noindent\hspace{\titlehmargin}\rule{\dimexpr\fullpagewidth-\titlehmargin*2\relax}{0.4pt}\par%
|
||||
\vspace{\titlevmargin}%
|
||||
\leavevmode%
|
||||
\noindent\hspace{\dimexpr\titlehmargin-\titlevmargin\relax}%
|
||||
\begin{beamercolorbox}[sep=\titlevmargin,wd=\dimexpr\fullpagewidth-\titlehmargin*2+\titlevmargin*2\relax]{footline}%
|
||||
\begin{minipage}{\dimexpr\mathslogowidth+1pt\relax}%
|
||||
\includegraphics[width=\mathslogowidth]{mathematics-logo.png}%
|
||||
\end{minipage}%
|
||||
\hfill%
|
||||
{\usebeamercolor[fg]{title in head/foot}\usebeamerfont{title in head/foot}\insertshorttitle}%
|
||||
\hfill%
|
||||
{\usebeamercolor[fg]{date in head/foot}\usebeamerfont{date in head/foot}\insertshortdate{}}%
|
||||
\hfill%
|
||||
{\usebeamercolor[fg]{page number in head/foot}\usebeamerfont{page number in head/foot}\usebeamertemplate{page number in head/foot}}%
|
||||
\end{beamercolorbox}
|
||||
\vspace{\titlevmargin}%
|
||||
}
|
After Width: | Height: | Size: 5.5 KiB |
BIN
epr/epr_rep_folien_jonas/images/azyklisch_zusammenhaengend.png
Normal file
After Width: | Height: | Size: 6.5 KiB |
BIN
epr/epr_rep_folien_jonas/images/code_adjazenzliste.png
Normal file
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 36 KiB |
BIN
epr/epr_rep_folien_jonas/images/code_helloworldfunction.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
epr/epr_rep_folien_jonas/images/code_inputandreturnfunction.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
epr/epr_rep_folien_jonas/images/code_iterationexamplesimple.png
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
epr/epr_rep_folien_jonas/images/code_iterationsumnumbers.png
Normal file
After Width: | Height: | Size: 37 KiB |
BIN
epr/epr_rep_folien_jonas/images/code_lambdafunction.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
epr/epr_rep_folien_jonas/images/code_matplotlibexample.png
Normal file
After Width: | Height: | Size: 78 KiB |
BIN
epr/epr_rep_folien_jonas/images/code_matplotlibpandas.png
Normal file
After Width: | Height: | Size: 90 KiB |
After Width: | Height: | Size: 45 KiB |
BIN
epr/epr_rep_folien_jonas/images/code_numpylistcreation.png
Normal file
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 32 KiB |
BIN
epr/epr_rep_folien_jonas/images/code_numpyothercommands.png
Normal file
After Width: | Height: | Size: 89 KiB |
BIN
epr/epr_rep_folien_jonas/images/code_numpyscalarproduct.png
Normal file
After Width: | Height: | Size: 45 KiB |
BIN
epr/epr_rep_folien_jonas/images/code_numpyusefulfunctions.png
Normal file
After Width: | Height: | Size: 118 KiB |
BIN
epr/epr_rep_folien_jonas/images/code_pandascreatedataframes.png
Normal file
After Width: | Height: | Size: 93 KiB |
BIN
epr/epr_rep_folien_jonas/images/code_pandasdatasetcsv.png
Normal file
After Width: | Height: | Size: 56 KiB |
BIN
epr/epr_rep_folien_jonas/images/code_pandasfiltercolumn.png
Normal file
After Width: | Height: | Size: 84 KiB |
BIN
epr/epr_rep_folien_jonas/images/code_pandasfilterdata.png
Normal file
After Width: | Height: | Size: 92 KiB |
BIN
epr/epr_rep_folien_jonas/images/code_pandasgroupadata.png
Normal file
After Width: | Height: | Size: 93 KiB |
BIN
epr/epr_rep_folien_jonas/images/code_recursionfacultyexample.png
Normal file
After Width: | Height: | Size: 50 KiB |
BIN
epr/epr_rep_folien_jonas/images/code_recursionfibonacci.png
Normal file
After Width: | Height: | Size: 51 KiB |
BIN
epr/epr_rep_folien_jonas/images/code_wechselrecursion.png
Normal file
After Width: | Height: | Size: 64 KiB |
BIN
epr/epr_rep_folien_jonas/images/graph_beispiel_knoten-kanten.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
epr/epr_rep_folien_jonas/images/graph_gerichtet.png
Normal file
After Width: | Height: | Size: 6.9 KiB |
BIN
epr/epr_rep_folien_jonas/images/graph_matplotlibexample.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
epr/epr_rep_folien_jonas/images/graph_matplotlibpandas.png
Normal file
After Width: | Height: | Size: 9.8 KiB |
BIN
epr/epr_rep_folien_jonas/images/graph_ungerichtet.png
Normal file
After Width: | Height: | Size: 6.2 KiB |
After Width: | Height: | Size: 6.6 KiB |
BIN
epr/epr_rep_folien_jonas/images/zyklisch_zusammenhaengend.png
Normal file
After Width: | Height: | Size: 8 KiB |
1470
epr/epr_rep_folien_jonas/main.tex
Normal file
BIN
epr/epr_rep_folien_jonas/mathematics-logo.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
epr/epr_rep_folien_jonas/oxford-logo.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
epr/epr_rep_folien_jonas/title-slide-background-wide.png
Normal file
After Width: | Height: | Size: 440 KiB |
BIN
epr/epr_rep_folien_jonas/title-slide-background.png
Normal file
After Width: | Height: | Size: 396 KiB |
108
epr/epr_rep_uebungen_jonas/main.tex
Normal file
|
@ -0,0 +1,108 @@
|
|||
\documentclass{article}
|
||||
\usepackage{amsmath}
|
||||
\usepackage{listings}
|
||||
\usepackage{xcolor}
|
||||
|
||||
\definecolor{codegray}{rgb}{0.9,0.9,0.9}
|
||||
\lstdefinestyle{pythonstyle}{
|
||||
backgroundcolor=\color{codegray},
|
||||
basicstyle=\ttfamily\footnotesize,
|
||||
language=Python,
|
||||
frame=single,
|
||||
keywordstyle=\color{blue},
|
||||
commentstyle=\color{gray},
|
||||
stringstyle=\color{red}
|
||||
}
|
||||
|
||||
\begin{document}
|
||||
|
||||
\title{Python Übungsaufgaben: Funktionen, Iteration und Rekursion}
|
||||
\date{28. Februar, 2025}
|
||||
\maketitle
|
||||
|
||||
\section*{Aufgabe 1: Einfache Funktionen}
|
||||
|
||||
\subsection*{Quadrat einer Zahl}
|
||||
Schreibe eine Funktion, die das Quadrat einer Zahl berechnet.
|
||||
|
||||
\begin{lstlisting}[style=pythonstyle]
|
||||
def square(n):
|
||||
return n*n
|
||||
\end{lstlisting}
|
||||
|
||||
\subsection*{Maximalwert zweier Zahlen}
|
||||
Schreibe eine Funktion, die den größeren von zwei gegebenen Zahlen zurückgibt.
|
||||
|
||||
\begin{lstlisting}[style=pythonstyle]
|
||||
def min_value(a,b)
|
||||
return min(a,b)
|
||||
\end{lstlisting}
|
||||
|
||||
\subsection*{Umwandlung von Celsius in Fahrenheit}
|
||||
Schreibe eine Funktion, die eine Temperatur in Celsius in Fahrenheit umwandelt.
|
||||
|
||||
\begin{lstlisting}[style=pythonstyle]
|
||||
def convert_c_to_f(n):
|
||||
return n*(9/5)+32
|
||||
\end{lstlisting}
|
||||
|
||||
\subsection*{Summation einer Liste}
|
||||
Schreibe eine Funktion, die die Summe aller Elemente in einer Liste berechnet.
|
||||
|
||||
\begin{lstlisting}[style=pythonstyle]
|
||||
def convert_c_to_f(n):
|
||||
sum = 0
|
||||
for item in b:
|
||||
sum += item
|
||||
return sum
|
||||
\end{lstlisting}
|
||||
|
||||
\section*{Aufgabe 2: Fakultät mit Iteration und Rekursion}
|
||||
Berechne die Fakultät einer Zahl $n$ sowohl iterativ als auch rekursiv.
|
||||
|
||||
\subsection*{Iterative Lösung}
|
||||
Schreibe eine iterative Funktion zur Berechnung der Fakultät.
|
||||
|
||||
\begin{lstlisting}[style=pythonstyle]
|
||||
def fakultaet_iterativ(n):
|
||||
ergebnis = 1
|
||||
for i in range(1, n + 1):
|
||||
ergebnis *= i
|
||||
return ergebnis
|
||||
\end{lstlisting}
|
||||
|
||||
\subsection*{Rekursive Lösung}
|
||||
Schreibe eine rekursive Funktion zur Berechnung der Fakultät.
|
||||
|
||||
\begin{lstlisting}[style=pythonstyle]
|
||||
def fakultaet_rekursiv(n):
|
||||
if n == 0:
|
||||
return 1
|
||||
return n * fakultaet_rekursiv(n - 1)
|
||||
\end{lstlisting}
|
||||
|
||||
\section*{Aufgabe 3: Fibonacci-Zahlen}
|
||||
Berechne die Fibonacci-Zahlen $F(n)$ mit $F(0) = 0$, $F(1) = 1$ und $F(n) = F(n-1) + F(n-2)$ für $n \geq 2$.
|
||||
|
||||
\subsection*{Iterative Lösung}
|
||||
Schreibe eine iterative Funktion zur Berechnung der Fibonacci-Zahlen.
|
||||
|
||||
\begin{lstlisting}[style=pythonstyle]
|
||||
def fakultaet_rekursiv(n):
|
||||
a, b = 0, 1
|
||||
for _ in range(n):
|
||||
a, b = b, a + b
|
||||
return a
|
||||
\end{lstlisting}
|
||||
|
||||
\subsection*{Rekursive Lösung}
|
||||
Schreibe eine rekursive Funktion zur Berechnung der Fibonacci-Zahlen.
|
||||
|
||||
\begin{lstlisting}[style=pythonstyle]
|
||||
def fibonacci_rekursiv(n):
|
||||
if n <= 1:
|
||||
return n
|
||||
return fibonacci_rekursiv(n - 1) + fibonacci_rekursiv(n - 2)
|
||||
\end{lstlisting}
|
||||
|
||||
\end{document}
|