我确信可以通过数学方法解决所有问题并使用类似的方法\addplot
,但也许有更简单的方法可以做到这一点。
我决定大致绘制一下,以下是我已经完成的:
\begin{tikzpicture}[scale=1.8]
\draw (-3,0) -- (3,0);
\draw (-1.5,-3) parabola[parabola height=2cm] +(3,0);
\draw (1,0) -- (1,-1.888);
\filldraw[black] (0,-2) circle (1pt);
\node at (-0.2,-2) {$F$};
\draw (0,-2) -- (1,-1.888);
\end{tikzpicture}
正如您所见,它不太准确。
有什么聪明的方法可以解决我的问题吗?
提前谢谢您
答案1
这是一个完全与数学相关的解决方案,没有任何硬编码数字。只需更改\f
变量即可转移焦点并\a
选择交点的 X 坐标
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usetikzlibrary{angles}
\usetikzlibrary{quotes}
\begin{document}
\begin{tikzpicture}[
declare function={
parabola(\x) = 1/(-4*\f)*\x^2;
}]
\def\f{3}
\def\a{3}
\begin{axis}
[
every axis plot post/.style={black},
axis lines=none,
samples=50,
no markers,
domain=-10:10
]
%directrix
\addplot (x, \f);
%parabola
\addplot (x, {parabola(x)} );
%focus node
\node[circle,fill,inner sep=1.5pt, "$F$" right] at (0, -\f) {};
%draw equal lines to parabola
\draw (\a,\f) coordinate (A) -- (\a, {parabola(\a)} ) coordinate (B) -- (0,-\f) coordinate (C);
\coordinate (D) at ({-2*\f/(\a)*(\f-parabola(\a))+\a}, \f);
%draw tangent line
\addplot[restrict y to domain=-10:2] (x, {2/(-4*\f)*(\a)*(x-\a)+parabola(\a)} );
%draw angles
\ifnum\a>0
\pic["$\varphi$", draw, angle eccentricity=1.5] {angle=A--B--D};
\pic["$\alpha$", draw, angle eccentricity=1.5, angle radius=10, double] {angle=D--B--C};
\else
\pic["$\varphi$", draw, angle eccentricity=1.5] {angle=D--B--A};
\pic["$\alpha$", draw, angle eccentricity=1.5, angle radius=10, double] {angle=C--B--D};
\fi
\end{axis}
\end{tikzpicture}
\end{document}
答案2
欢迎来到 TeX.SE!!!
我会在这里采用数学方法,也可能采用软件包tkz-euclide
。
但仅使用 Ti钾Z 和抛物线:
\draw (-1.5,-3) parabola[parabola height=2cm] +(3,0);
抛物线经过点(±1.5,-3)
,顶点在中点2cm
上方,即V(0,-1)
。因此很容易得到方程、切线等。
完整的解决方案:
\documentclass[tikz,border=5mm]{standalone}
\usetikzlibrary{angles,quotes}
\begin{document}
\begin{tikzpicture}[line cap=round]
% parabola
\draw[thick] (-1.5,-3) parabola[parabola height=2cm] +(3,0);
\node at (-2,-1.5) {$y=-\frac{8}{9}x^2-1$};
% parabola, equation y=-8/9x^2-1
% \draw[red] plot [domain=-1.5:1.5] (\x,-8/9*\x*\x-1);
% directrix
\draw (-3,-1+9/32) --++ (6,0);
% focus F
\coordinate (F) at (0,-1-9/32);
\fill (F) circle (1pt) node[below] {$F$};
% tantent point T at x=1
\coordinate (T) at (1,-8/9-1);
\coordinate (P) at (1,0);
\draw (P) -- (T) -- (F);
% tangent, equation y=-16/9(x-1)-1-8/9
% \draw[red] plot[domain=-1:2] (\x,{-16/9*(\x-1)-1-8/9});
\coordinate (A) at (-1,5/3);
\coordinate (B) at (2,-33/9);
\draw[teal] (A) -- (B);
% circle, center T, radius \r
\pgfmathsetmacro\r{17/9-23/32}
\draw[orange,dashed] (T) circle (\r);
% angles
\pic[draw,angle radius=7mm,anchor=north east,"$\alpha$"] {angle = A--T--F};
\pic[draw,angle radius=8mm,anchor= west ,"$\alpha$"] {angle = P--T--A};
% coordinates used
\foreach\i in {A,B,P,T}
\fill[red] (\i) circle (1pt) node[right] {$\i$};
\end{tikzpicture}
\end{document}
答案3
我的尝试。虽然不是那么漂亮,但很直观和数学:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}[declare function={para(\t)=(-\t*\t);} ] %% <-----> define your parabola (chage it to any)
\pgfmathsetmacro{\yfocus}{(1-(para(1)-para(-1))*(para(1)-para(-1)))/4*(para(1)+para(-1)-para(0))+para(0)} % <--> y-coordinate of focus of parabola ax^2+bx+c (do not change)
\pgfmathsetmacro{\xfocus}{-(para(1)-para(-1))/2*(para(1)+para(-1)-para(0))} % <--> x-coordinate of focus of parabola ax^2+bx+c (do not change)
\pgfmathsetmacro{\xpara}{1} % <--> x-coord of an arbitrary point on your parabola (change the 1)
%!!!! do not change below !!!
\draw [blue, thick, x=1cm, y=1cm] plot [domain=-2:2, samples=100, smooth] (\x,{para(\x)});
\draw [blue, thick, x=1cm, y=1cm] (\xpara,{para(\xpara)}) node[circle, inner sep=2pt, outer sep=0pt, fill= red] {};
\filldraw[blue, thick, x=1cm, y=1cm] ({\xfocus},{\yfocus}) circle(2pt);
\draw (-2,{-\yfocus}) -- (2,{-\yfocus});
\draw ({\xfocus},{\yfocus}) -- (\xpara,{para(\xpara)}) -- (\xpara,-\yfocus);
\end{tikzpicture}
\end{document}