2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-19 11:38:05 +02:00

Add function graphs

This commit is contained in:
Martin Thoma 2021-01-14 13:16:30 +01:00
parent da41fb9529
commit 6bfa0299bf
No known key found for this signature in database
GPG key ID: CDBDEC5C1C911F05
24 changed files with 411 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

View file

@ -0,0 +1,31 @@
SOURCE = exponential-functions
DELAY = 80
DENSITY = 300
WIDTH = 1000
make:
pdflatex $(SOURCE).tex -output-format=pdf
make clean
clean:
rm -rf $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot
gif:
pdfcrop $(SOURCE).pdf
convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
make clean
png:
make
make svg
inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png
transparentGif:
convert $(SOURCE).pdf -transparent white result.gif
make clean
svg:
#inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
pdf2svg $(SOURCE).pdf $(SOURCE).svg
# Necessary, as pdf2svg does not always create valid svgs:
inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg

View file

@ -0,0 +1,3 @@
Compiled example
----------------
![Example](exponential-functions.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

View file

@ -0,0 +1,40 @@
\documentclass[varwidth=false, border=2pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\usepackage{tikz}
\usepackage{nicefrac}
\pgfplotsset{every axis legend/.append style={
at={(0,0)},
anchor=north east}}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis x line=middle,
axis y line=middle,
grid = major,
width=16cm,
height=8cm,
grid style={dashed, gray!30},
xmin=-2.1, % start the diagram at this x-coordinate
xmax= 4.1, % end the diagram at this x-coordinate
ymin= 0, % start the diagram at this y-coordinate
ymax= 17, % end the diagram at this y-coordinate
xlabel=$x$,
ylabel=$y$,
ytick={0,2,3,4,8,9,12,16},
yticklabels={0,2,3,4,8,9,12,16},
legend cell align=left,
legend pos=south east,
legend style={draw=none},
tick align=outside,
enlargelimits=false]
% plot the function
\addplot[domain=-2:4, red, ultra thick,samples=500] {2^x};
\addplot[domain=-2:4, green!50!black, ultra thick,dashed,samples=500] {3^x};
\addplot[domain=-2:4, blue, ultra thick,dotted,samples=500] {4^x};
\legend{$2^x$,$3^x$,$4^{x}$}
\end{axis}
\end{tikzpicture}
\end{document}

View file

@ -0,0 +1,33 @@
SOURCE = inverse-function
DELAY = 80
DENSITY = 300
WIDTH = 512
make:
pdflatex $(SOURCE).tex -output-format=pdf
make clean
clean:
rm -rf $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot
gif:
pdfcrop $(SOURCE).pdf
convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
make clean
png:
make
make svg
inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png
transparentGif:
convert $(SOURCE).pdf -transparent white result.gif
make clean
svg:
#inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
pdf2svg $(SOURCE).pdf $(SOURCE).svg
# Necessary, as pdf2svg does not always create valid svgs:
inkscape $(SOURCE).svg --export-width=$(WIDTH) --export-plain-svg=$(SOURCE)1.svg
rsvg-convert -a -w 720 -f svg $(SOURCE)1.svg -o $(SOURCE).svg
rm $(SOURCE)1.svg

View file

@ -0,0 +1,3 @@
Compiled example
----------------
![Example](inverse-function.png)

View file

@ -0,0 +1,16 @@
\documentclass[varwidth=true, border=2pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes,snakes,shapes.geometric,positioning,decorations.text}
\begin{document}
\tikzstyle{arrow}=[bend left,->,very thick, line cap=round]
\begin{tikzpicture}[node distance=2cm]
\node[ellipse,draw,minimum width=80pt,minimum height=20pt,fill=gray!5] (a) {1\\2\\3};
\node[ellipse,draw,minimum width=80pt,minimum height=20pt,fill=gray!5,below of=a] (u) {a\\b\\c};
% Arrows
\draw[arrow,postaction={decorate,decoration={text along path,raise=0.08cm,text align=center,text={Aktion {$a_k$}}}}] (a.east) to node {} (u.east);
\draw[arrow,postaction={decorate,decoration={text along path,raise=0.08cm,text align=center,text={Zustand {$x_k$}}}}] (u.west) to node {} (a.west);
\end{tikzpicture}
\end{document}

View file

@ -0,0 +1,31 @@
SOURCE = logarithmic-functions
DELAY = 80
DENSITY = 300
WIDTH = 500
make:
pdflatex $(SOURCE).tex -output-format=pdf
make clean
clean:
rm -rf $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot
gif:
pdfcrop $(SOURCE).pdf
convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
make clean
png:
make
make svg
inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png
transparentGif:
convert $(SOURCE).pdf -transparent white result.gif
make clean
svg:
#inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
pdf2svg $(SOURCE).pdf $(SOURCE).svg
# Necessary, as pdf2svg does not always create valid svgs:
inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg

View file

@ -0,0 +1,3 @@
Compiled example
----------------
![Example](logarithmic-functions.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View file

@ -0,0 +1,37 @@
\documentclass[varwidth=false, border=2pt]{standalone}
\usepackage{pgfplots}
\usepackage{tikz}
\usepackage{nicefrac}
\pgfplotsset{every axis legend/.append style={
at={(0,0)},
anchor=north east}}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis x line=middle,
axis y line=middle,
grid = major,
width=8cm,
height=8cm,
grid style={dashed, gray!30},
xmin= 0, % start the diagram at this x-coordinate
xmax=10, % end the diagram at this x-coordinate
ymin=-5, % start the diagram at this y-coordinate
ymax= 5, % end the diagram at this y-coordinate
xlabel=$x$,
ylabel=$y$,
legend cell align=left,
legend pos=south east,
legend style={draw=none},
tick align=outside,
enlargelimits=false]
% plot the function
\addplot[domain=0:10, red, ultra thick,samples=500] {log2(x)};
\addplot[domain=0:10, green!50!black,dashed,ultra thick,samples=500] {log2(0.5*x)};
\addplot[domain=0:10, blue,dotted, ultra thick,samples=500] {log10(x)};
\legend{$\log_2(x)$,$\log_2(\nicefrac{x}{2})$,$\log_{10}(x)$}
\end{axis}
\end{tikzpicture}
\end{document}

View file

@ -0,0 +1,31 @@
SOURCE = logistic-functions
DELAY = 80
DENSITY = 300
WIDTH = 1000
make:
pdflatex $(SOURCE).tex -output-format=pdf
make clean
clean:
rm -rf $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot
gif:
pdfcrop $(SOURCE).pdf
convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
make clean
png:
make
make svg
inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png
transparentGif:
convert $(SOURCE).pdf -transparent white result.gif
make clean
svg:
#inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
pdf2svg $(SOURCE).pdf $(SOURCE).svg
# Necessary, as pdf2svg does not always create valid svgs:
inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg

View file

@ -0,0 +1,3 @@
Compiled example
----------------
![Example](logistic-functions.png)

View file

@ -0,0 +1,37 @@
\documentclass[varwidth=false, border=2pt]{standalone}
\usepackage{pgfplots}
\usepackage{tikz}
\usepackage{nicefrac}
\pgfplotsset{every axis legend/.append style={
at={(0,0)},
anchor=north east}}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis x line=middle,
axis y line=middle,
grid = major,
width=16cm,
height=8cm,
grid style={dashed, gray!30},
xmin=-5, % start the diagram at this x-coordinate
xmax= 5, % end the diagram at this x-coordinate
ymin= 0, % start the diagram at this y-coordinate
ymax= 1.1, % end the diagram at this y-coordinate
xlabel=$x$,
ylabel=$y$,
legend cell align=left,
legend pos=south east,
legend style={draw=none},
tick align=outside,
enlargelimits=false]
% plot the function
\addplot[domain=-5:5, red, ultra thick,samples=500] {1/(1+exp(-1*(x - 0)))};
\addplot[domain=-5:5, blue, ultra thick,dotted,samples=500] {1/(1+exp(-2*(x - 0)))};
\addplot[domain=-5:5, green!50!black, ultra thick,dashed,samples=500] {1/(1+exp(-1*(x - 1)))};
\legend{$\frac{1}{1 + e^{-x}}$,$\frac{1}{1 + e^{-2 \cdot x}}$,$\frac{1}{1 + e^{-(x-1)}}$}
\end{axis}
\end{tikzpicture}
\end{document}

View file

@ -0,0 +1,31 @@
SOURCE = quadratic-functions
DELAY = 80
DENSITY = 300
WIDTH = 1000
make:
pdflatex $(SOURCE).tex -output-format=pdf
make clean
clean:
rm -rf $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot
gif:
pdfcrop $(SOURCE).pdf
convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
make clean
png:
make
make svg
inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png
transparentGif:
convert $(SOURCE).pdf -transparent white result.gif
make clean
svg:
#inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
pdf2svg $(SOURCE).pdf $(SOURCE).svg
# Necessary, as pdf2svg does not always create valid svgs:
inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg

View file

@ -0,0 +1,3 @@
Compiled example
----------------
![Example](linear-functions.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

View file

@ -0,0 +1,37 @@
\documentclass[varwidth=false, border=2pt]{standalone}
\usepackage{pgfplots}
\usepackage{tikz}
\usepackage{nicefrac}
\pgfplotsset{every axis legend/.append style={
at={(0,0)},
anchor=north east}}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis x line=middle,
axis y line=middle,
grid = major,
width=8cm,
height=8cm,
grid style={dashed, gray!30},
xmin=-5, % start the diagram at this x-coordinate
xmax= 5, % end the diagram at this x-coordinate
ymin=-1.1, % start the diagram at this y-coordinate
ymax= 9, % end the diagram at this y-coordinate
xlabel=$x$,
ylabel=$y$,
legend cell align=left,
legend pos=north west,
legend style={draw=none},
tick align=outside,
enlargelimits=false]
% plot the function
\addplot[domain=-5:5, red, ultra thick,samples=500] {x^2};
\addplot[domain=-5:5, green!50!black, ultra thick,dashed,samples=500] {x^2+2*x};
\addplot[domain=-5:5, blue, ultra thick,dotted,samples=500] {x^2-x};
\legend{$x^2$,$x^2 + 2x$,$x^2-x$}
\end{axis}
\end{tikzpicture}
\end{document}

View file

@ -0,0 +1,31 @@
SOURCE = trigonometric-function-graphs
DELAY = 80
DENSITY = 300
WIDTH = 1000
make:
pdflatex $(SOURCE).tex -output-format=pdf
make clean
clean:
rm -rf $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot
gif:
pdfcrop $(SOURCE).pdf
convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
make clean
png:
make
make svg
inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png
transparentGif:
convert $(SOURCE).pdf -transparent white result.gif
make clean
svg:
#inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
pdf2svg $(SOURCE).pdf $(SOURCE).svg
# Necessary, as pdf2svg does not always create valid svgs:
inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg

View file

@ -0,0 +1,3 @@
Compiled example
----------------
![Example](trigonometric-function-graphs.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View file

@ -0,0 +1,38 @@
\documentclass[varwidth=false, border=2pt]{standalone}
\usepackage{pgfplots}
\usepackage{tikz}
\usepackage{nicefrac}
\pgfplotsset{every axis legend/.append style={
at={(0,0)},
anchor=north east}}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis x line=middle,
axis y line=middle,
grid = major,
width=16cm,
height=8cm,
grid style={dashed, gray!30},
xmin= 0, % start the diagram at this x-coordinate
xmax= 7, % end the diagram at this x-coordinate
ymin=-1.1, % start the diagram at this y-coordinate
ymax= 1.1, % end the diagram at this y-coordinate
xlabel=$x$,
ylabel=$y$,
xtick={0,pi/2,pi,1.5*pi,2*pi},
xticklabels={0,$\frac{\pi}{2}$,$\pi$,$\frac{3 \cdot \pi}{2}$,$2 \pi$},
legend cell align=left,
legend pos=south east,
legend style={draw=none},
tick align=outside,
enlargelimits=false]
% plot the function
\addplot[domain=0:7, red, ultra thick,samples=1000] {sin(deg(x))};
\addplot[domain=0:7, blue, ultra thick,dotted,samples=1000] {cos(deg(x))};
\legend{$\sin(x)$, $\cos(x)$}
\end{axis}
\end{tikzpicture}
\end{document}