taylorpolynom-sin.tex 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. \documentclass{article}
  2. \usepackage[pdftex,active,tightpage]{preview}
  3. \setlength\PreviewBorder{0mm}
  4. \usepackage{pgfplots}
  5. \pgfplotsset{compat=1.9}
  6. \usepackage{tikz}
  7. \usetikzlibrary{arrows, positioning, calc}
  8. \usepackage{xcolor}
  9. \definecolor{pink}{HTML}{FF0BB7}
  10. \begin{document}
  11. \begin{preview}
  12. \begin{tikzpicture}
  13. \begin{axis}[
  14. axis x line=middle,
  15. axis y line=middle,
  16. enlarge y limits=true,
  17. xmin=-8.5, xmax=8.5, % Positive domain...
  18. width=15cm, height=8cm, % size of the image
  19. grid = major,
  20. grid style={dashed, gray!30},
  21. ymin=-4, % start the diagram at this y-coordinate
  22. ymax= 4, % end the diagram at this y-coordinate
  23. axis background/.style={fill=white},
  24. ylabel=$y$,
  25. xlabel=$x$,
  26. legend style={at={(0.07,0.37)}, anchor=north}
  27. ]
  28. \addplot[domain=-8:8,thick,samples=200,red] {x};
  29. \addplot[domain=-8:8,thick,samples=200,green] {x-x^3/6};
  30. \addplot[domain=-8:8,thick,samples=200,blue] {x-x^3/6+x^5/120};
  31. \addplot[domain=-8:8,thick,samples=200,pink] {x-x^3/6+x^5/120-x^7/(7!)+x^9/(9!)-x^11/(11!)+x^13/(13!)-x^15/(15!)};
  32. \addplot[domain=-8:8,thick,samples=200,black] {sin(deg(x))};
  33. \legend{$T_1$, $T_3$, $T_5$, $T_{15}$, $T_\infty$}
  34. \end{axis}
  35. \end{tikzpicture}
  36. \end{preview}
  37. \end{document}