Wie zeichnet man eine Sekante einer Parabel wie in diesem Bild?

Wie zeichnet man eine Sekante einer Parabel wie in diesem Bild?

Ich möchte diese Grafik zeichnen Bildbeschreibung hier eingeben

Ich habe es mit Geogebra versucht

\documentclass[12pt]{standalone}
\usepackage{fouriernc}
\usepackage{pgf,tikz}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\draw[line width=1.2pt,->,color=black] (-2.5,0.) -- (2.5,0.);
\foreach \x in {-2.,-1.,1.,2.}
\draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt);
\draw[color=black] (2.3,0.031) node [anchor=south west] { $x$};
\draw[line width=1.2pt,->,color=black] (0.,-0.5) -- (0.,5.);
\foreach \y in {,1.,2.,3.,4.}
\draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt);
\draw[color=black] (0.025,4.835) node [anchor=west] {$y$};
\clip(-3.5,-0.5) rectangle (3.5,5.);
\draw[line width=1.2pt,smooth,samples=100,domain=-3.5:3.5] plot(\x,{(\x)^(2.0)});
\draw [domain=-3.5:3.5] plot(\x,{(--2.-3.*\x)/-1.});
\draw [fill=black] (1.,1.) circle (2.0pt);
\draw[color=black] (1.3,0.939) node {$A_0$};
\draw [fill=black] (2.,4.) circle (2.0pt);
\draw[color=black] (2.4,4) node {$A_n$};
\draw [fill=black] (0.667,0.) circle (2.0pt);
\draw[color=black] (1,-0.3) node {$M_n$};
\end{tikzpicture}
\end{document}

Jetzt möchte ich mit zeichnen pgfplots, ich habe versucht

\documentclass{standalone}
\usepackage{pgfplots}
\def\FunctionF(#1){(#1)^2}%
\begin{document}
\begin{tikzpicture}
\begin{axis}[
        axis y line=center,
        axis x line=middle, 
        axis on top=true,
        xmin=-2.5,
        xmax=2.5,
        ymin=-1,
        ymax=4.5,
        height=5.0cm,
        width=5.0cm,
        grid,
        xtick={-2,...,2},
        ytick={-1,0,...,5},
    ]
    \addplot [domain=-5:5, samples=50, mark=none, black] {\FunctionF(x)};
\end{axis}
\end{tikzpicture}
\end{document}

Und ich habe Bildbeschreibung hier eingeben

So zeichnen Sie eine Sekante A_nA_0M_n

Antwort1

Mit pgfplotsder aktuellen Version (1.13):

Bildbeschreibung hier eingeben

\documentclass[border=3mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usetikzlibrary{intersections}

\def\FunctionF(#1){(#1)^2}%

\begin{document}
    \begin{tikzpicture}[
    dot/.style = {red, opacity=0.5, 
                  every node/.style={right=1pt, text=black, opacity=1,
                                     fill=white, inner sep=1pt, 
                                     rounded corners=5pt, font=\footnotesize}
                  }
                    ]
\begin{axis}[
        axis y line=center,
        axis x line=middle,
%        axis on top=true,
        xmin=-2.5,
        xmax=2.8,
        ymin=-1.5,
        ymax=4.5,
        height=5.0cm,
        width=5.0cm,
        grid,
        tick label style={font=\scriptsize},
        xtick={-2,...,2},
        ytick={-1,0,...,5},
    ]
\addplot[domain=-5:5, samples=50, mark=none, black, smooth,
          name path=A] {\FunctionF(x)};
\draw[red,name path=B] (0.5,-0.5) -- (2.16,4.5);
\path[name path=C] (0,0) -- (2,0);
\fill [name intersections={of=A and B, by={a,b}},dot]
      (a) circle (1.2pt) node {$A_0$}
      (b) circle (1.2pt) node {$A_n$};
\fill [name intersections={of=B and C, by=c},dot]
      (c) circle (1.2pt) node {$M_n$};
\end{axis}
    \end{tikzpicture}
\end{document}

verwandte Informationen