Tarea 1. Gráficas de funciones.

Análisis Numérico.

Enero del 2022

Realiza la gráfica de las siguientes funciones en el intervalo adecuado.

  1. \(f(x)=e^x-3x^2\) para \(0\leq x \leq 5\).
f_a <- function(x){exp(x)-3*x^2} 
x_a <- seq(from=0, to=5, by=0.001) 
y_a <- f_a(x_a) 
graf_a <- ggplot()+
  geom_vline(xintercept = 0, linetype="dashed")+ 
  geom_hline(yintercept = 0, linetype="dashed")+ 
  geom_line(aes(x=x_a, y=y_a), color="red", size=1)+
  labs(x="x", y="f(x)", title="Gráfico A")+
  theme_bw() 
ggplotly(graf_a)

b)\(f(x)=\frac{2x^2-8}{x+2}\)

f_b <- function(x){(2*x^2-8)/(x+2)}
x_b <- seq(from=-8, to=3, by=0.01)
y_b <- f_b(x_b)
graf_b <- ggplot()+
  geom_vline(xintercept = 0, linetype="dashed")+ 
  geom_hline(yintercept = 0, linetype="dashed")+ 
  geom_line(aes(x=x_b, y=y_b), color="blue", size=2)+
  labs(x="x", y="f(x)", title="Gráfico B")+
  theme_bw()
ggplotly(graf_b)

c)\(f(x)=\frac{x+1}{x+2}\)

f_c <- function(x){(x+1)/(x+2)} 
x_c <- seq(from=-1, to=100, by=0.02) 
y_c <- f_c(x_c) 
graf_c <- ggplot()+
  geom_vline(xintercept = 0, linetype="dashed")+ 
  geom_hline(yintercept = 0, linetype="dashed")+ 
  geom_line(aes(x=x_c, y=y_c), color="346625", size=1.90)+
  labs(x="x", y="f(x)", title="Gráfico C")+
  theme_bw()
ggplotly(graf_c)
  1. \(f(x)=3x+1\)
f_d <- function(x){3*x+1} 
x_d <- seq(from=100, to=200, by=0.2) 
y_d <- f_d(x_d) 
graf_d <- ggplot()+
  geom_vline(xintercept = 0, linetype="dashed")+ 
  geom_hline(yintercept = 0, linetype="dashed")+ 
  geom_line(aes(x=x_d, y=y_d), color="421102220", size=1)+
  labs(x="x", y="f(x)", title="Gráfico D")+
  theme_bw()
ggplotly(graf_d)
  1. \(f(x)=x^4-x^3+x^2-x+1\).
f_e <- function(x){x^4-x^3+x^2-x+1} 
x_e <- seq(from=-15, to=12, by=0.1) 
y_e <- f_e(x_e) 
graf_e <- ggplot()+
  geom_vline(xintercept = 0, linetype="dashed")+ 
  geom_hline(yintercept = 0, linetype="dashed")+ 
  geom_line(aes(x=x_e, y=y_e), color="pink", size=0.3)+
  labs(x="x", y="f(x)", title="Gráfico E")+
  theme_bw()
ggplotly(graf_e)
  1. \(f(x)=x\,cos\,x-3x\).
f_f <- function(x){x*cos(x)-3*x} 
x_f <- seq(from=-50, to=30, by=0.001)
y_f <- f_f(x_f) 

graf_f <- ggplot()+
  geom_vline(xintercept = 0, linetype="dashed")+ 
  geom_hline(yintercept = 0, linetype="dashed")+ 
  geom_line(aes(x=x_f, y=y_f), color="purple", size=3)+
  labs(x="x", y="f(x)", title="Gráfico F")+
  theme_bw()
ggplotly(graf_f)
  1. \(f(x)=e^{2x}\).
f_g <- function(x){exp(2*x)} 
x_g <- seq(from=-2, to=35, by=0.01) 
y_g <- f_g(x_g) 
graf_g <- ggplot()+
  geom_vline(xintercept = 0, linetype="dashed")+ 
  geom_hline(yintercept = 0, linetype="dashed")+ 
  geom_line(aes(x=x_g, y=y_g), color="02102000", size=1.5)+
  labs(x="x", y="f(x)", title="Gráfico G")+
  theme_bw()
ggplotly(graf_g)
  1. \(f(x)=log(e^x+2)\).
f_h <- function(x){log(exp(x)+2)} 
x_h <- seq(from=-20, to=5, by=0.001) 
y_h <- f_h(x_h) 
graf_h <- ggplot()+
  geom_vline(xintercept = 0, linetype="dashed")+ 
  geom_hline(yintercept = 0, linetype="dashed")+ 
  geom_line(aes(x=x_h, y=y_h), color="red", size=1)+
  labs(x="x", y="f(x)", title="Gráfico H")+
  theme_bw()
ggplotly(graf_h)
  1. \(f(x) = cos \,x+sen\,x\).
f_m <- function(x){cos(x)*sin(x)} 
x_m <- seq(from=-35, to=15, by=0.01) 
y_m <- f_m(x_m) 
graf_m <- ggplot()+
  geom_vline(xintercept = 0, linetype="dashed")+ 
  geom_hline(yintercept = 0, linetype="dashed")+ 
  geom_line(aes(x=x_m, y=y_m), color="0215", size=2)+
  labs(x="x", y="f(x)", title="Gráfico I")+
  theme_bw()
ggplotly(graf_m)
  1. \(f(x)=sen(e^x-2)\).
f_j <- function(x){sin(exp(x)-2)} 
x_j <- seq(from=-27, to=12, by=0.01) 
y_j <- f_j(x_j) 
graf_j <- ggplot()+
  geom_vline(xintercept = 0, linetype="dashed")+ 
  geom_hline(yintercept = 0, linetype="dashed")+ 
  geom_line(aes(x=x_j, y=y_j), color="020501", size=0.51)+
  labs(x="x", y="f(x)", title="Gráfico J")+
  theme_bw()
ggplotly(graf_j)