#title: Grafico #author: Irene and JJ #let: x[2] = {[-3..-1,1..3]}; y = {[-2,-1,1,2]}; f f0 = {{1/(x-#x[0]) + 1/(x-#x[1]) + #y}}; f f2 = {{ratsimp(#f0)}}; s f2s = #f2; f x_assin_hor = {{x,solve (1/(x-#x[0]) + 1/(x-#x[1]) + #y =#y)}}; f y0 = {{ratsimp(1/(-#x[0]) + 1/(-#x[1]) + #y)}}; n xx_assin_hor = #x_assin_hor; n yy0 = #y0; #question: \noindent Determine a função $f(x)=\frac{P(x)}{Q(x)},$ onde $P(x)$ e $Q(x)$ são polinómios de grau $\le 2$, corespondente ao seguinte gráfico, sabendo que $f(0)= #y0$ e $f(#x_assin_hor)=#y$; \begin{tikzpicture} \begin{axis}[ restrict y to domain=-7:7, % grid, samples=1000, minor tick num=1, xlabel={$x$}, ylabel={$y$}, xtickmax=6, ytickmax=5, xmin = -7, xmax = 7, ymin = -6, ymax = 6, unbounded coords=jump, axis x line=middle, axis y line=middle] \addplot [color=red,mark=none,domain=-7:7] {#f2s}; \addplot [orange, no markers,dashed] coordinates {(#x[0],-6) (#x[0],6)}; \addplot [orange, no markers,dashed] coordinates {(#x[1],-6) (#x[1],6)}; \addplot [orange, no markers,dashed] coordinates {(-7,#y) (7,#y)}; \addplot [black, mark=*, only marks] coordinates {(0,#yy0) (#xx_assin_hor,#y)}; \node at (axis cs:0,#yy0 ) [anchor=north east] {$A$}; \node at (axis cs:#xx_assin_hor,#y) [anchor=north east] {$B$}; \end{axis} \end{tikzpicture} #sugestion: #resolution: $$ f(x) = #f0 = #f2 $$ #result: #usepackage: \usepackage{pgfplots} \usepackage{tikz}