Exemplos
library(rootSolve)
x0 <- 1
y0 <- 2
a <- 3
b <- 4
m <- round((b/a), digits = 2)
c <- sqrt((a^2)+(b^2))
fx <- function(x){
(b^2)*((x^2)/(a^2) - 1)
}
raiz <- multiroot(f = fx, start = c(-10,10))
limInf <- raiz$root[1]
limSup <- raiz$root[2]
x_left <- seq(-10, limInf, by = 0.001)
x_right <- seq(limSup, 10, 0.001)
y.upper_left <- sqrt((b^2)*((x_left^2)/(a^2) - 1))
y.upper_right <- sqrt((b^2)*((x_right^2)/(a^2) - 1))
y.lower_left <- -sqrt((b^2)*((x_left^2)/(a^2) - 1))
y.lower_right <- -sqrt((b^2)*((x_right^2)/(a^2) - 1))
y.max <- max(y.upper_left)
y.min <- min(y.lower_left)
plot(c(-10, 10), c(y.min, y.max), type = "n", xlab = "x", ylab = "y")
lines(x_left, y.upper_left, col = "red", lwd = 2)
lines(x_right, y.upper_right, col = "red", lwd = 2)
lines(x_left, y.lower_left, col = "red", lwd = 2)
lines(x_right, y.lower_right, col = "red", lwd = 2)
abline(0, m, col = "blue")
abline(0, -m, col = "blue")
points(c, 0, pch = 20)
points(-c,0, pch = 20)
text(c/2, 1, paste0("Foco (",round(c, digits = 2),",0)"), pos=4)
text(-c-c/2, 1, paste0("Foco (",round(-c, digits = 2),",0)"), pos=4)
text(c, y.max, bquote("Assintota" ~ .(m)*x), pos = 2)
title(bquote("Hipérbole "~(x^2)/(.(a))^2 - (y^{2})/(.(b))^2==1))

Parábolas
#Caso 1
#O eixo da parabola eh o eixo y
#Nesse caso F(0,P/2) e o vertice passa pela origem do eixo y
#P eh um ponto qq da parabola
v=0
p <- 2
if(p<0){
curve(((x^2)/(2*p)),
from = -8,
to = 8,
col = "black",
lty = 1,
lwd = 2,
ylab = "y",
ylim=c(10*p,-10*p),
xlim = c(-10,10))
}else{
curve(((x^2)/(2*p)),
from = -8,
to = 8,
col = "black",
lty = 1,
lwd = 2,
ylab = "y",
ylim=c(-10*p,10*p),
xlim = c(-10,10))
}
abline(h=-(p/2),
lwd = 2,
lty = 2)
abline(h=0,
lwd = 2,
lty = 3)
points(x = 0, y = p/2, pch = 16,
col = "black")
text("F", x=0, y=((p/2)+2))
text("V", x=5, y=1)
grid(nx = NULL, ny = NULL,
lty = 2, # Grid line type
col = "gray", # Grid line color
lwd = 1) # Grid line width)

h <- 2
k <- -1
p <- 8
y <- function(x){
return((((x-h)^2)/(2*p))+k)
}
limInf <- h-5
limSup <- h+5
if(p<0){
curve(y,
from = limInf,
to = limSup,
col = "black",
lty = 1,
lwd = 2,
ylab = "y",
ylim=c(y(limSup)-3,y(h)+3),
xlim = c((h-6),(h+6)))
}else{
curve(y,
from = limInf,
to = limSup,
col = "black",
lty = 1,
lwd = 2,
ylab = "y",
ylim=c((y(h)-3),y(limSup)+3),
xlim = c((h-6),(h+6)))
}
abline(h=k,
lwd = 2,
lty = 2)
abline(h=0,
lwd = 2,
lty = 3)
points(x = h, y = ((p/2)+k), pch = 16,
col = "black")
text("F", x=h, y=(((p/2)+k)+0.1))
text("V", x=5, y=1)
grid(nx = NULL, ny = NULL,
lty = 2, # Grid line type
col = "gray", # Grid line color
lwd = 1) # Grid line width)
