diff --git a/tikz/half-space/Makefile b/tikz/half-space/Makefile new file mode 100644 index 0000000..78eb323 --- /dev/null +++ b/tikz/half-space/Makefile @@ -0,0 +1,31 @@ +SOURCE = half-space +DELAY = 80 +DENSITY = 300 +WIDTH = 500 + +make: + pdflatex $(SOURCE).tex -output-format=pdf + make clean + +clean: + rm -rf $(TARGET) *.class *.html *.log *.aux + +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 diff --git a/tikz/half-space/half-space.tex b/tikz/half-space/half-space.tex new file mode 100644 index 0000000..dd353aa --- /dev/null +++ b/tikz/half-space/half-space.tex @@ -0,0 +1,50 @@ +\documentclass{article} +\usepackage[pdftex,active,tightpage]{preview} +\setlength\PreviewBorder{2mm} +\usepackage{tikz} +\usetikzlibrary{patterns} + +\begin{document} +\begin{preview} +\begin{tikzpicture} + \pgfdeclarepatternformonly{north east lines wide}% + {\pgfqpoint{-1pt}{-1pt}}% + {\pgfqpoint{10pt}{10pt}}% + {\pgfqpoint{9pt}{9pt}}% + { + \pgfsetlinewidth{0.7pt} + \pgfpathmoveto{\pgfqpoint{0pt}{0pt}} + \pgfpathlineto{\pgfqpoint{9.1pt}{9.1pt}} + \pgfusepath{stroke} + } + + \pgfdeclarepatternformonly{north west lines wide} + {\pgfqpoint{-1pt}{-1pt}}% + {\pgfqpoint{7pt}{7pt}}% + {\pgfqpoint{6pt}{6pt}}% + { + \pgfsetlinewidth{0.7pt} + \pgfpathmoveto{\pgfqpoint{0pt}{6pt}} + \pgfpathlineto{\pgfqpoint{6.1pt}{-0.1pt}} + \pgfusepath{stroke} + } + + % Draw two intersecting lines + \draw[thick, red] (-1,-1) coordinate (a) -- (2,-1) coordinate (b); + \draw[thick, green] ( 1,-1) coordinate (c) -- (1, 2) coordinate (d); + + \fill[pattern=north east lines wide, pattern color=red!50] (a) -- (b) -- (2,2) -- (-1,2) -- (a); + \fill[pattern=north west lines wide, pattern color=green!50] (a) -- (1,-1) -- (1,2) -- (-1,2) -- (a); + + \draw[thick, green] (c) -- (d); + \draw[thick, red] (a) -- (b); + + + % Draw axes + \draw [<->,thick] (0,2.5) node (yaxis) [above] {$x_2$} + |- (2.5,0) node (xaxis) [right] {$x_1$}; + \node[red] at (1.5,2.8) {$H_2^+(-1)$}; + \node[green] at (1.5,2.3) {$H_1^-(1)$}; +\end{tikzpicture} +\end{preview} +\end{document} diff --git a/tikz/multidimensional-intervall/Makefile b/tikz/multidimensional-intervall/Makefile new file mode 100644 index 0000000..a05fa3e --- /dev/null +++ b/tikz/multidimensional-intervall/Makefile @@ -0,0 +1,31 @@ +SOURCE = multidimensional-intervall +DELAY = 80 +DENSITY = 300 +WIDTH = 500 + +make: + pdflatex $(SOURCE).tex -output-format=pdf + make clean + +clean: + rm -rf $(TARGET) *.class *.html *.log *.aux + +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 diff --git a/tikz/multidimensional-intervall/multidimensional-intervall.tex b/tikz/multidimensional-intervall/multidimensional-intervall.tex new file mode 100644 index 0000000..068e82e --- /dev/null +++ b/tikz/multidimensional-intervall/multidimensional-intervall.tex @@ -0,0 +1,30 @@ +\documentclass{article} +\usepackage[pdftex,active,tightpage]{preview} +\setlength\PreviewBorder{2mm} +\usepackage{tikz} + +\begin{document} +\begin{preview} +\begin{tikzpicture} + % Draw axes + \draw [<->,thick] (0,2.5) node (yaxis) [above] {$x_2$} + |- (2.5,0) node (xaxis) [right] {$x_1$}; + + % Draw two intersecting lines + \draw[thick, dashed] (1,1) coordinate (a) -- (2,1) coordinate (b); + \draw[thick, dashed] (a) -- (1,2) coordinate (d); + \draw[thick] (d) -- (2,2) coordinate (c); + \draw[thick] (b) -- (2,2); + + \fill[green!15] (a) -- (b) -- (c) -- (d) -- (a); + + % Draw lines indicating intersection with y and x axis. Here we + % use the perpendicular coordinate system + \draw[dotted] (yaxis |- a) node[left] {$a_2$} + -| (xaxis -| a) node[below] {$a_1$}; + + \draw[dotted] (yaxis |- c) node[left] {$b_2$} + -| (xaxis -| c) node[below] {$b_1$}; +\end{tikzpicture} +\end{preview} +\end{document} diff --git a/tikz/riemann-sum/Makefile b/tikz/riemann-sum/Makefile new file mode 100644 index 0000000..4da7778 --- /dev/null +++ b/tikz/riemann-sum/Makefile @@ -0,0 +1,31 @@ +SOURCE = riemann-sum +DELAY = 80 +DENSITY = 300 +WIDTH = 512 + +make: + pdflatex $(SOURCE).tex -output-format=pdf + make clean + +clean: + rm -rf $(TARGET) *.class *.html *.log *.aux + +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 diff --git a/tikz/riemann-sum/riemann-sum.tex b/tikz/riemann-sum/riemann-sum.tex new file mode 100644 index 0000000..3b1a655 --- /dev/null +++ b/tikz/riemann-sum/riemann-sum.tex @@ -0,0 +1,35 @@ +% Thanks to http://tex.stackexchange.com/a/30782/5645 for this +% example! +\documentclass{article} +\usepackage[pdftex,active,tightpage]{preview} +\setlength\PreviewBorder{2mm} +\usepackage{pgfplots} +\pgfplotsset{ + integral segments/.code={\pgfmathsetmacro\integralsegments{#1}}, + integral segments=3, + integral/.style args={#1:#2}{ + ybar interval, + domain=#1+((#2-#1)/\integralsegments)/2:#2+((#2-#1)/\integralsegments)/2, + samples=\integralsegments+1, + x filter/.code=\pgfmathparse{\pgfmathresult-((#2-#1)/\integralsegments)/2} + } +} + +\begin{document} +\begin{preview} + \begin{tikzpicture}[/pgf/declare function={f=-15*(x-5)+(x-5)^3+50;}] + \begin{axis}[ + domain=0:10, + samples=100, + axis lines=middle + ] + \addplot [ + red, + fill=red!50, + integral=2:6 + ] {f}; + \addplot [thick] {f}; + \end{axis} + \end{tikzpicture} +\end{preview} +\end{document}