Realiza la gráfica de las siguientes funciones en el intervalo adecuado.
- \(f(x)=e^x-3x^2=0\) para \(0\leq x \leq 5\)
f_a <- function(x){exp(x)-3*x^2}
x_a <- seq(0, 5, by=0.0001)
y_a <- f_a(x_a)
graf_a <- ggplot()+
geom_vline(xintercept = 0, linetype="dashed")+ #eje x
geom_hline(yintercept = 0, linetype="dashed")+ #eje y
geom_line(aes(x=x_a, y=y_a), color="red", size=1)+
#coord_fixed(ratio = 1)+ # misma escala en los ejes
labs(x="x", y="f(x)", title="Primera gráfica")+
theme_minimal()
ggplotly(graf_a)- \(f(x)=\frac{2x^2-8}{x+2}\)
f_b <- function(x){(2*x^2-8)/(x+2)}
x_b <- seq(0, 10, by=0.0001)
y_b <- f_b(x_b)
graf_b <- ggplot()+
geom_vline(xintercept = 0, linetype="dashed")+ #eje X
geom_hline(yintercept= 0, linetype="dashed")+ #eje Y
geom_line(aes(x=x_b, y=y_b), color= "blue", size=1)+
labs(x="tiempo", y="velocidad", title = "Segunda gráfica")+
theme_minimal()
ggplotly(graf_b)c)\(f(x)=\frac{x+1}{x+2}\)
f_c <- function(x){(x+1)/(x+2)}
x_c <- seq(-1, 5, by=0.0001)
y_c <- f_c(x_c)
graf_c <- ggplot()+
geom_vline(xintercept=0, linetype="continue")+
geom_hline(yintercept = 0, linetype= "continue")+
geom_line(aes(x=x_c, y=y_c), color="red",size=1.1)+
labs(x="tiempo", y="poblacion", title= "Tercera gráfica")+
theme_minimal()
ggplotly(graf_c)- \(f(x)=3x+1\)
f_d <- function(x){3*x+1}
x_d <- seq(0, 5, by=0.0001)
y_d <- f_d(x_d)
graf_d <- ggplot()+
geom_vline(xintercept=0, linetype="continue")+
geom_hline(yintercept = 0, linetype= "continue")+
geom_line(aes(x=x_d, y=y_d), color="red",size=1.1)+
#coord_fixed(ratio=1)+
labs(x="tiempo", y="poblacion", title= "Cuarta gráfica")+
theme_minimal()
ggplotly(graf_d)- \(f(x)=x^4-x^3+x^2-x+1\).
f_e <- function(x){x^4+x^3-x+1}
x_e <- seq(-10, 10, by=0.0001)
y_e <- f_e(x_e)
graf_e <- ggplot()+
geom_vline(xintercept=0, linetype="continue")+
geom_hline(yintercept = 0, linetype= "continue")+
geom_line(aes(x=x_e, y=y_e), color="red",size=1)+
coord_fixed(ratio=0.002)+
labs(x="tiempo", y="poblacion", title= "Quinta gráfica")+
theme_minimal()
ggplotly(graf_e)