diff --git a/ana16.tex b/ana16.tex index 89f2a41..006e48f 100644 --- a/ana16.tex +++ b/ana16.tex @@ -1,5 +1,6 @@ \documentclass{lecture} +\usetikzlibrary{math} \begin{document} \newcommand{\dv}[2]{\frac{\mathrm{d} #1}{\mathrm{d} #2}} \newcommand{\graph}{\operatorname{Graph}} @@ -119,7 +120,7 @@ Notationen: $x' = f(t,x), \dot x = f(t,x), \dv{x}{t} = f(t,x)$ (Dynamischer Proz } ] \addplot3 (x,y,0); - \addlegendentry{$f'(t,x)$} + \addlegendentry{$f(t,x)$} \addplot{(x-0.25)^2+0.15}; \addlegendentry{$y(t)$} \end{axis} @@ -236,45 +237,63 @@ Reminder: \[y^h(t)\coloneqq y_{n-1}^h + (t-t_{n-1})f(t_{n-1},y_{n-1}^h),\quad t\in [t_{n-1},t_n],\quad \forall n\ge 1\] \begin{figure}[h] \centering - \begin{tikzpicture}[declare function={f1(\x) = 0.5*(2)^(\x-1) + 10/(\x+2); - f2(\x) = 0.5*(2)^(\x-1); - f3(\x) = 0.5*(2)^(\x-1) - 10/(\x+2); - f4(\x) = 0.5*(2)^(\x-1) - 20/(\x+2);}] + \begin{tikzpicture}[declare function={ + g(\x) = 0.5*exp(\x-2); % base function for y(t) + f(\x) = 0.5*exp(\x-2); % derivative + %g(\x) = 0.5*(\x-2.7)^3 - 2*(\x-2.7)^2; % base function for y(t) + %f(\x) = 1.5*(\x-2.7)^2 - 4*(\x-2.7); % derivative + }] + \def\h{1} % step length (accuracy of approximation) + \def\torig{2} % y_0 + \def\yorig{1} % t_0 \begin{axis}% [grid=none, - %minor tick num=4, grid style={line width=.1pt, draw=gray!10}, major grid style={line width=.2pt,draw=gray!50}, axis lines=middle, - %enlargelimits={abs=0.2}, ymax=10, ymin=-1.5, + restrict y to domain=-2:12, xmin=-1, xmax=7, xtick={2,3,4,5}, ytick=\empty, xticklabels={$t_0$, $t_1$, $t_2$, $t_3$}, - %yticklabels={$y_0$, $y_1^{h}$, $y_2^{h}$}, xlabel=$t$, - ylabel=$x$, + ylabel=$y$, + legend pos=outer north east ] - \addplot[domain=0:10,samples=50,smooth,green] {f1(x)}; - \addlegendentry{$y(t,t_0,y_0)$}; - \addplot[domain=0:10,samples=50,smooth,blue] {f2(x)}; - \addlegendentry{$y(t, t_1, y_1^{h})$}; - \addplot[domain=0:10,samples=50,smooth,orange] {f3(x)}; - \addlegendentry{$y(t, t_2, y_2^{h})$}; - \addplot[domain=0:10,samples=50,smooth,pink] {f4(x)}; - \addlegendentry{$y(t, t_3, y_3^{h})$}; - \draw (2,{f1(2)}) node[circle,fill,inner sep=0.5pt] {} - -- (3,{f2(3)}) node[circle,fill,inner sep=0.5pt] {} - -- (4, {f3(4)}) node[circle,fill,inner sep=0.5pt] {} - -- (5, {f4(5)}) node[circle,fill,inner sep=0.5pt] {}; - \draw[dashed,green] (2, {f1(2)}) -- (0, {f1(2)}) node[label=left:$y_0$](){}; - \draw[dashed,blue] (3, {f2(3)}) -- (0, {f2(3)}) node[label=left:$y_1$](){}; - \draw[dashed,orange] (4, {f3(4)}) -- (0, {f3(4)}) node[label=left:$y_2$](){}; - \draw[dashed,pink] (5, {f4(5)}) -- (0, {f4(5)}) node[label=left:$y_3$](){}; + \def\d{0} + \def\t{0} + \foreach \i/\colour [remember=\d as \dlast (initially \yorig), + remember=\t as \tlast (initially \torig)] + in {0/green,1/blue,2/orange,3/pink} { + \tikzmath{\t=\tlast+\h;\d=g(\tlast)+\dlast+\h*f(\tlast)-g(\t);} + \colour + \edef\temp{\noexpand + \addplot[domain=0:10,samples=50,smooth,\colour] {g(x) + \dlast - g(\torig)}; + } + \temp + \if\i3 + \edef\temp{\noexpand + \draw[dashed,->] (\tlast,{g(\tlast) + \dlast - g(\torig)}) + -- (\t,{g(\t) + \d - g(\torig)}); + } + \else + \edef\temp{\noexpand + \draw (\tlast,{g(\tlast) + \dlast - g(\torig)}) node[circle,fill,inner sep=0.5pt] {} + -- (\t,{g(\t) + \d - g(\torig)}) node[circle,fill,inner sep=0.5pt] {}; + } + \fi + \temp + \edef\temp{\noexpand + \draw[dashed,\colour] (\tlast, {g(\tlast) + \dlast - g(\torig)}) -- (0, {g(\tlast) + \dlast - g(\torig)}) node[label=left:$y_{\i}$](){}; + } + \temp + \edef\temp{\noexpand\addlegendentry{$y(t,t_{\i},y_{\i})$};} + \temp + } \end{axis} \end{tikzpicture} - \caption{Eulersches Polygonzugverfahren} + \caption{Eulersches Polygonzugverfahren, Steigung der Tangenten ist $f(t,y)$} \end{figure} \begin{enumerate}[1)] \item \textbf{z.Z.} dass dieses Verfahren durchführbar ist, d.h. $\graph(y^h)\subset D$. Sei $(t,y^h(t))\subset D$ für $t_0 \le t\le t_{k-1}$. Dann gilt diff --git a/analysisII.pdf b/analysisII.pdf index c2d6e93..30ecc45 100644 Binary files a/analysisII.pdf and b/analysisII.pdf differ diff --git a/lecture.cls b/lecture.cls index 2c92ec1..108746d 100644 --- a/lecture.cls +++ b/lecture.cls @@ -27,7 +27,7 @@ \RequirePackage{environ} \RequirePackage{stackrel} -\usetikzlibrary{quotes, angles} +\usetikzlibrary{quotes, angles, math} \pgfplotsset{compat=1.15} % or \pgfplotsset{compat=newest} \geometry{