cubic-function-intermediate-value-theorem.tex 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. \documentclass{article}
  2. \usepackage[pdftex,active,tightpage]{preview}
  3. \setlength\PreviewBorder{2mm}
  4. \usepackage{pgfplots}
  5. \usepackage{units}
  6. \pgfplotsset{compat=1.3}% <-- moves axis labels near ticklabels
  7. % (respects tick label widths)
  8. \usepackage{tikz}
  9. \usetikzlibrary{arrows, positioning, calc, intersections, decorations.markings}
  10. \usepackage{xcolor}
  11. \definecolor{horizontalLineColor}{HTML}{008000}
  12. \definecolor{verticalLineColor}{HTML}{FF0000}
  13. \begin{document}
  14. % Define this as a command to ensure that it is same in both cases
  15. \newcommand*{\ShowIntersection}[2]{
  16. \fill
  17. [name intersections={of=#1 and #2, name=i, total=\t}]
  18. [red, opacity=1, every node/.style={above left, black, opacity=1}]
  19. \foreach \s in {1,...,\t}{(i-\s) circle (2pt)
  20. node [above left] {\s}};
  21. }
  22. \begin{preview}
  23. \begin{tikzpicture}
  24. \begin{axis}[
  25. label distance=0mm,
  26. width=8cm, height=7cm, % size of the image
  27. xmin= 40, % start the diagram at this x-coordinate
  28. xmax= 180, % end the diagram at this x-coordinate
  29. ymin=60, % start the diagram at this y-coordinate
  30. ymax=170, % end the diagram at this y-coordinate
  31. ylabel=y,
  32. xlabel=x,
  33. axis lines=left,
  34. tick style={draw=none},
  35. xticklabels={,,},
  36. yticklabels={,,}
  37. ]
  38. \addplot[name path global=a, domain=55:161, dotted, blue,
  39. very thick,samples=500, label=$y=f(x)$]
  40. {113/132078*x*x*x-11865/44026*x*x+1169437/44026*x-93155207/132078};
  41. % ( 55 | 82.7344) and (161 | 156.011) are on the graph
  42. \coordinate (b) at (axis cs: 55,170);
  43. \coordinate (c) at (axis cs:161,170);
  44. \coordinate (d) at (axis cs:161,82.7344);
  45. \coordinate (e) at (axis cs:161,156.011);
  46. \coordinate (a1) at (axis cs:55,111.494);
  47. \coordinate (a2) at (axis cs:161,111.494);
  48. \draw[verticalLineColor, thick, <->](a1) -- (a2);
  49. \draw[verticalLineColor,dashed](b |- 0,0) -- (b);
  50. \draw[verticalLineColor,dashed](c |- 0,0) -- (c);
  51. \draw[horizontalLineColor,dashed, thick](d -| 0,0) -- (d);
  52. \draw[horizontalLineColor,dashed, thick](e -| 0,0) -- (e);
  53. % (100 | 111.494)
  54. \coordinate (f) at (axis cs:100, 111.494);
  55. \draw[red,dashed](f |- 0,0) -- (f);
  56. \end{axis}
  57. \end{tikzpicture}
  58. \end{preview}
  59. \end{document}