Realiza la gráfica de las siguientes funciones en el intervalo adecuado.
- \(e^x-3x^2=0\) para \(0\leq x \leq 1\) y \(3\leq x \leq 5\).
<- function(x){exp(x)-3*x^2}
f_a
<- seq(0, 5, by=0.0001)
x_a <- f_a(x_a)
y_a
<- ggplot()+
graf_a 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_bw()
plot(graf_a)
ggplotly(graf_a)
b)\(f(x)=\frac{2x^2-8}{x+2}\)
<- function(x){(2*x^2-8)/(x+2)}
f_b
<- seq(from=-5, to=5, by=0.01)
x_b <- f_b(x_b)
y_b
<- ggplot()+
graf_b 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="green", size=0.5)+
#coord_fixed(ratio = 1)+ # misma escala en los ejes
labs(x="x", y="f(x)", title="Gráfica B")+
theme_bw()
plot(graf_b)
#ggplotly(graf_b)
c)\(f(x)=\frac{x+1}{x+2}\)
<- function(x){(x+1)/(x+2)}
f_c
<- seq(from=-10, to=10, by=0.01)
x_c <- f_c(x_c)
y_c
<- ggplot()+
graf_c geom_vline(xintercept = 0, linetype="dashed")+ #eje x
geom_hline(yintercept = 0, linetype="dashed")+ #eje y
geom_line(aes(x=x_c, y=y_c), color="purple", size=1)+
#coord_fixed(ratio = 1)+ # misma escala en los ejes
labs(x="x", y="f(x)", title="Gráfica C")+
theme_bw()
plot(graf_c)
#ggplotly(graf_c)
- \(f(x)=3x+1\)
<- function(x){3*x+1}
f_d
<- seq(from=-10, to=10, by=0.01)
x_d <- f_d(x_d)
y_d
<- ggplot()+
graf_d geom_vline(xintercept = 0, linetype="dashed")+ #eje x
geom_hline(yintercept = 0, linetype="dashed")+ #eje y
geom_line(aes(x=x_d, y=y_d), color="orange", size=1)+
#coord_fixed(ratio = 1)+ # misma escala en los ejes
labs(x="x", y="f(x)", title="Gráfica D")+
theme_bw()
plot(graf_d)
#ggplotly(graf_d)
- \(f(x)=x^4-x^3+x^2-x+1\).
<- function(x){x^4-x^3+x^2-x^1}
f_e
<- seq(from=-10, to=10, by=0.01)
x_e <- f_e(x_e)
y_e
<- ggplot()+
graf_e geom_vline(xintercept = 0, linetype="dashed")+ #eje x
geom_hline(yintercept = 0, linetype="dashed")+ #eje y
geom_line(aes(x=x_e, y=y_e), color="blue", size=1)+
#coord_fixed(ratio = 1)+ # misma escala en los ejes
labs(x="x", y="f(x)", title="Gráfica E")+
theme_bw()
plot(graf_e)
#ggplotly(graf_e)
- \(f(x)=x\,cos\,x-3x\).
<- function(x){x*cos(x)-3*x}
f_f
<- seq(from=-100, to=100, by=0.01)
x_f <- f_f(x_f)
y_f
<- ggplot()+
graf_f geom_vline(xintercept = 0, linetype="dashed")+ #eje x
geom_hline(yintercept = 0, linetype="dashed")+ #eje y
geom_line(aes(x=x_f, y=y_f), color="pink", size=1)+
#coord_fixed(ratio = 1)+ # misma escala en los ejes
labs(x="x", y="f(x)", title="Gráfica F")+
theme_bw()
plot(graf_f)
#ggplotly(graf_f)
- \(f(x)=e^{2x}\).
<- function(x){exp(2*x)}
f_g
<- seq(from=-10, to=10, by=0.01)
x_g <- f_g(x_g)
y_g
<- ggplot()+
graf_g geom_vline(xintercept = 0, linetype="dashed")+ #eje x
geom_hline(yintercept = 0, linetype="dashed")+ #eje y
geom_line(aes(x=x_g, y=y_g), color="yellow", size=1)+
#coord_fixed(ratio = 1)+ # misma escala en los ejes
labs(x="x", y="f(x)", title="Gráfica G")+
theme_bw()
plot(graf_g)
#ggplotly(graf_g)
- \(f(x)=log(e^x+2)\).
<- function(x){log(exp(x)+2)}
f_h
<- seq(from=-10, to=10, by=0.01)
x_h <- f_h(x_h)
y_h
<- ggplot()+
graf_h geom_vline(xintercept = 0, linetype="dashed")+ #eje x
geom_hline(yintercept = 0, linetype="dashed")+ #eje y
geom_line(aes(x=x_h, y=y_h), color="red", size=0.5)+
#coord_fixed(ratio = 1)+ # misma escala en los ejes
labs(x="x", y="f(x)", title="Gráfica H")+
theme_bw()
plot(graf_h)
#ggplotly(graf_h)
- \(f(x) = cos \,x+sen\,x\).
<- function(x){cos(x)+sin(x)}
f_i
<- seq(from=-10, to=10, by=0.01)
x_i <- f_i(x_i)
y_i
<- ggplot()+
graf_i geom_vline(xintercept = 0, linetype="dashed")+ #eje x
geom_hline(yintercept = 0, linetype="dashed")+ #eje y
geom_line(aes(x=x_i, y=y_i), color="green", size=1)+
#coord_fixed(ratio = 1)+ # misma escala en los ejes
labs(x="x", y="f(x)", title="Gráfica I")+
theme_bw()
plot(graf_i)
#ggplotly(graf_i)
- \(f(x)=sen(e^x-2)\).
<- function(x){sin(exp(x)-2)}
f_j
<- seq(from=-10, to=10, by=0.01)
x_j <- f_j(x_j)
y_j
<- ggplot()+
graf_j geom_vline(xintercept = 0, linetype="dashed")+ #eje x
geom_hline(yintercept = 0, linetype="dashed")+ #eje y
geom_line(aes(x=x_j, y=y_j), color="purple", size=1)+
#coord_fixed(ratio = 1)+ # misma escala en los ejes
labs(x="x", y="f(x)", title="Gráfica J")+
theme_bw()
plot(graf_j)
#ggplotly(graf_j)