taylorpolynom-sin.tex 1.3 KB

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