123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- \documentclass{article}
- \usepackage[pdftex,active,tightpage]{preview}
- \setlength\PreviewBorder{2mm}
-
- \usepackage{pgfplots}
- \usepackage{tikz}
- \usetikzlibrary{arrows, positioning, calc, intersections}
-
- \begin{document}
- % Define this as a command to ensure that it is same in both cases
- \newcommand*{\ShowIntersection}[2]{
- \fill
- [name intersections={of=#1 and #2, name=i, total=\t}]
- [red, opacity=1, every node/.style={above left, black, opacity=1}]
- \foreach \s in {1,...,\t}{(i-\s) circle (2pt)
- node [above left] {\s}};
- }
- \begin{preview}
- \begin{tikzpicture}
- \begin{axis}[
- axis x line=middle,
- axis y line=middle,
- width=15cm, height=15cm, % size of the image
- grid = major,
- grid style={dashed, gray!30},
- %xmode=log,log basis x=10,
- %ymode=log,log basis y=10,
- xmin=-2, % start the diagram at this x-coordinate
- xmax= 4, % end the diagram at this x-coordinate
- ymin=-7, % start the diagram at this y-coordinate
- ymax= 7, % end the diagram at this y-coordinate
- %/pgfplots/xtick={0,1,...,60}, % make steps of length 5
- %extra x ticks={23},
- %extra y ticks={0.507297},
- axis background/.style={fill=white},
- ylabel=y,
- xlabel=x,
- %xticklabels={,,},
- %yticklabels={,,},
- tick align=outside,
- tension=0.08]
- % plot the stirling-formulae
- \addplot[name path global=a, domain=-2:4, red, thick,samples=500]
- {-x*x*x + 4*x*x-x-4};
- \addplot[name path global=b, domain=0.25:4, blue, thick, dashed] {x-1.2};
- \addplot[name path global=c, domain=0.25:4, blue, thick, dashed] {x+0.42};
- \ShowIntersection{a}{b};
- \end{axis}
- \end{tikzpicture}
- \end{preview}
- \end{document}
|