Re: Le mie (dis)avventure con TikZ

#96745
lorenzo.pantieri
Partecipante
    Up
    0
    Down
    ::


    Buongiorno a tutti.

    Ho il seguente disegno:
    `\documentclass{article}
    \usepackage{tikz,pgfplots,xcolor}
    \begin{document}

    \begin{tikzpicture}[font=\small]
    \begin{axis} [width=0.8\textwidth,
    axis lines=middle,
    xmin=-0.25,xmax=5,ymin=-1,ymax=10,
    enlargelimits,
    xtick=\empty,
    ytick={2,8},
    yticklabels={$f(a)$,$f(a+h)$},
    xlabel=$x$,
    ylabel=$y$]

    \draw [dashed] (axis cs:1,-1.5) — (axis cs:1,2);
    \draw [dashed] (axis cs:4.75,2) — (axis cs:0,2);

    \draw [dashed] (axis cs:3,-1.5) — (axis cs:3,8);
    \draw [dashed] (axis cs:4.75,8) — (axis cs:0,8);

    \draw [dashed,latex-latex] (axis cs:4,2) — (axis cs:4,8);
    \draw [dashed,latex-latex] (axis cs:1,-1) — (axis cs:3,-1);

    \addplot [domain=-5:5, samples=200, restrict y to domain=-30:30,smooth,very thick] {2^x};

    \addplot [domain=-5:5, samples=200, restrict y to domain=-30:30,smooth] {2*x};
    \addplot [domain=-5:5, samples=200, restrict y to domain=-30:30,smooth,green] {3*x-1};
    \addplot [domain=-5:5, samples=200, restrict y to domain=-30:30,smooth,thick,red] {1.386294361*x+0.613705639};

    \begin{scope}[text height=1ex, text depth=0pt]
    \node [below right] at (axis cs:1,0) {$a$};
    \node [below right] at (axis cs:3,0) {$a+h$};
    \end{scope}

    \node [above=2pt] at (axis cs:1,2) {$P$};
    \node [above left] at (axis cs:3,8) {$Q$};

    \node

    at (axis cs:4,5) {$f(a+h)-f(a)$};
    \node [below] at (axis cs:2,-1) {$h$};

    \node [below] at (axis cs:3,4) {\color{red}retta tangente};
    \node [below] at (axis cs:4.35,10.5) {rette secanti};
    \node [below] at (axis cs:2.85,10.5) {\color{blue}$y=f(x)$};

    \draw (axis cs:1,2) [blue,fill=blue,very thick] circle (2.0pt);
    \draw (axis cs:2,4) [blue,fill=blue,very thick] circle (2.0pt);
    \draw (axis cs:3,8) [blue,fill=blue,very thick] circle (2.0pt);

    %\draw (axis cs:1,2) ++(54.195:40mm) arc (54.195:71.56:40mm);

    \end{axis}
    \end{tikzpicture}

    \end{document}`
    Vorrei aggiungere un bell’arco di circonferenza di centro P(1,2) che colleghi le retta (secante, in verde) $y=3x-1$ con la retta (tangente, in rosso) $y=2\ln 2 x+2-\ln 2$, quest’ultima approssimativamente uguale a $y=1.38x+0.61$. Ho fatto i calcoli e gli angoli dovrebbero essere 54.195 gradi e 71.565 gradi.

    Non ci riesco.

    Qualcuno mi aiuta?

    Grazie anticipate! 🙂

    Go to top