Skip to content

tkz-fn examples

Tangents at zeros and extrema

Tangents at zeros and extrema
View TeX code
% !TEX TS-program = lualatex
% Tangentes aux points d'intersection d'une courbe avec l'axe des abscisses
% (et tangentes horizontales aux extremums) avec tkz-fn 1.02c
\documentclass[border=5mm]{standalone}
\usepackage[svgnames]{xcolor}
\usepackage{tkz-fn}
\usepackage{fourier-otf}

\begin{document}
\begin{tikzpicture}[scale=1.4]
  \tkzFnInit[xmin=0,xmax=7,ymin=-0.75,ymax=1.25,ystep=0.25]
  \tkzFnSetup{format=fr}
  \tkzFnAxes[style=thick]
  \tikzset{tkzfn point/.style={draw=black,fill=black}}

  % f(x) = e^{-x/5} ( sin(1,5x) + 0,6 cos(2,5x) )
  \tkzFnDraw[name=f,domain=0:7,samples=400,thick]
     {exp(-x/5)*(sin(1.5*x)+0.6*cos(2.5*x))}

  % tangentes aux points d'intersection avec l'axe des abscisses
  \tkzFnTangent[at=zeros,draw,red,semithick,kl=.45,kr=.45](f)

  % tangentes horizontales aux extremums
  \tkzFnTangent[at=extrema,draw,teal,semithick,dashed,kl=.5,kr=.5](f)

  \tkzFnText[draw,fill=white](4.6,1.1)
    {$f(x)=\mathrm{e}^{-x/5}\bigl(\sin(1{,}5x)+0{,}6\cos(2{,}5x)\bigr)$}
\end{tikzpicture}
\end{document}