mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-18 19:18:21 +02:00
Add function graphs
This commit is contained in:
parent
da41fb9529
commit
6bfa0299bf
24 changed files with 411 additions and 0 deletions
BIN
tikz/exponential-functions-gif/exponential-functions-gif-2.gif
Normal file
BIN
tikz/exponential-functions-gif/exponential-functions-gif-2.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 MiB |
BIN
tikz/exponential-functions-gif/exponential-functions-gif.gif
Normal file
BIN
tikz/exponential-functions-gif/exponential-functions-gif.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 MiB |
31
tikz/exponential-functions/Makefile
Normal file
31
tikz/exponential-functions/Makefile
Normal 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
|
3
tikz/exponential-functions/README.md
Normal file
3
tikz/exponential-functions/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
Compiled example
|
||||
----------------
|
||||

|
BIN
tikz/exponential-functions/exponential-functions.png
Normal file
BIN
tikz/exponential-functions/exponential-functions.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 59 KiB |
40
tikz/exponential-functions/exponential-functions.tex
Normal file
40
tikz/exponential-functions/exponential-functions.tex
Normal 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}
|
33
tikz/inverse-function/Makefile
Normal file
33
tikz/inverse-function/Makefile
Normal 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
|
3
tikz/inverse-function/README.md
Normal file
3
tikz/inverse-function/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
Compiled example
|
||||
----------------
|
||||

|
16
tikz/inverse-function/inverse-function.tex
Normal file
16
tikz/inverse-function/inverse-function.tex
Normal 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}
|
31
tikz/logarithmic-functions/Makefile
Normal file
31
tikz/logarithmic-functions/Makefile
Normal 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
|
3
tikz/logarithmic-functions/README.md
Normal file
3
tikz/logarithmic-functions/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
Compiled example
|
||||
----------------
|
||||

|
BIN
tikz/logarithmic-functions/logarithmic-functions.png
Normal file
BIN
tikz/logarithmic-functions/logarithmic-functions.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 33 KiB |
37
tikz/logarithmic-functions/logarithmic-functions.tex
Normal file
37
tikz/logarithmic-functions/logarithmic-functions.tex
Normal 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}
|
31
tikz/logistic-functions/Makefile
Normal file
31
tikz/logistic-functions/Makefile
Normal 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
|
3
tikz/logistic-functions/README.md
Normal file
3
tikz/logistic-functions/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
Compiled example
|
||||
----------------
|
||||

|
37
tikz/logistic-functions/logistic-functions.tex
Normal file
37
tikz/logistic-functions/logistic-functions.tex
Normal 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}
|
31
tikz/quadratic-functions/Makefile
Normal file
31
tikz/quadratic-functions/Makefile
Normal 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
|
3
tikz/quadratic-functions/README.md
Normal file
3
tikz/quadratic-functions/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
Compiled example
|
||||
----------------
|
||||

|
BIN
tikz/quadratic-functions/quadratic-functions.png
Normal file
BIN
tikz/quadratic-functions/quadratic-functions.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 80 KiB |
37
tikz/quadratic-functions/quadratic-functions.tex
Normal file
37
tikz/quadratic-functions/quadratic-functions.tex
Normal 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}
|
31
tikz/trigonometric-function-graphs/Makefile
Normal file
31
tikz/trigonometric-function-graphs/Makefile
Normal 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
|
3
tikz/trigonometric-function-graphs/README.md
Normal file
3
tikz/trigonometric-function-graphs/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
Compiled example
|
||||
----------------
|
||||

|
Binary file not shown.
After Width: | Height: | Size: 41 KiB |
|
@ -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}
|
Loading…
Add table
Add a link
Reference in a new issue