## Ejercicio 1 
x<- 10 
y<- 3
a<- function(x,y){
  u= x+y 
  return(u)
}
a(x,y)
## [1] 13
b<- function(x,y){
  x*y
}
b(x,y)
## [1] 30
c<- function(x,y){
  x/y
}
c(x,y)
## [1] 3.333333
d<-function(x){
  sin(x*pi/180)
}
d(x)
## [1] 0.1736482
e<-function(y){
  8*sin(y*pi/180)
}
e(y)
## [1] 0.4186876
f<-function(y){
  5*sin(2*y*pi/180)
}
f(y)
## [1] 0.5226423

## Ejercicio 2
x<-2
y<-5
a<-function(x,y){
  (y*x^3)/(x-y)
}
a(x,y)
## [1] -13.33333
b<- function(x,y){
  (3*x)/(2*y)
}
b(x,y)
## [1] 0.6
c<- function(x,y){
  (3/2)*(x*y)
}
c(x,y)
## [1] 15
d<- function(x){
  (x^5)/((x^5)-1)
}
d(x)
## [1] 1.032258

##Ejercicio 3 
x<- 3
y<- 4
a<- function(x){
  (1-(1/(x^5)))^(-1)
}
a(x)  
## [1] 1.004132
b<-function(x){
  3*pi*x^2
}
b(x)
## [1] 84.823
c<- function (x,y){
  (4*(y-5))/(3*x-6)
}
c(x,y)
## [1] -1.333333

## Ejercicio 4 
a<- function(x){
  (6*x^3)+(4/x)
}
a(2)  
## [1] 50
b<- function(x){
  (x/4)*3
}
b(8)
## [1] 6
c<-function(x){
  ((4*x)^2)/25
}
c(10)
## [1] 64
d<-function(x){
  (2/5)*(sin(x*pi/180))
}
d(2)
## [1] 0.0139598
e<- function(x){
  7*(x^(1/3))+4*(x^(0.58))
}
e(20)
## [1] 41.73396

### Ejercicio 5 
a<- 1.12
b<- 2.34
c<- 0.72
d<- 0.81
f<- 19.83
x<- function(a,b,c,d,f){
  1+(a/b)+(c/(f^2))
}
x(a=a, b=b, c=c, f=f)
## [1] 1.480463
s<- function(a,b,c,d,f){
  (b-a)/(d-c)
}
s(a=a, b=b, c=c , d=d)
## [1] 13.55556
r<- function(a,b,c,d,f){
  1/((1/a)+(1/b)+(1/c)+(1/d))
}
r(a=a, b=b, c=c, d=d)
## [1] 0.2535713
y<- function(a,b,c,d,f){
  a*b*(1/c)*((f^2)/2)
}
y(a=a, b=b, c=c, f=f)
## [1] 715.6766

##Ejercicio 6 
(a<-(3/4)*6*(7^2)+((4^5)/((7^3)-145)))
## [1] 225.6717
(b<-(48.2*(55)-(9^3))/(53+(14^2))) 
## [1] 7.718876
(c<-((27^2)/4)+((319^(4/5))/5)+60*(14)^-3)
## [1] 202.412

##Ejercicio 7 
v<- function(r){
  v= 4*pi*(r^3)/3
  return(v)
}
##Volumen de la esfera con radio 5 ft
v(5)
## [1] 523.5988
##30% más del volumen de una esfera con radio 5ft
(u=(v(5)*30/100)+v(5))
## [1] 680.6784
## radio de la esfera con 30% mas del volumen de la esfera de 5ft
(u*3/(4*pi))^(1/3)
## [1] 5.456964

## Ejercicio 8 
x<- -7-5i
y<- 4+3i
(a<- x+y)
## [1] -3-2i
(b<- x*y)
## [1] -13-41i
(c<- x/y)
## [1] -1.72+0.04i

## Ejercicio 9 
ley.gases<- function(n,R=0.08206,Tp,v){
  p=(n*R*Tp)/v
  return(p)
}
ley.gases.es<- function(n,R=0.08206, Tp, v, a, b){
  vm=n*b
  atm= ((a*n^2)/v^2)
  p=((n*R*Tp)/(v-(vm)))-atm
  return(p)
}
## Sea el volumen molecular nb
## Sea la atraccion molecular an^2/v^2
## Para Cl2 con a= 6.49 y b=0.0562, n=1 , v=22.41, Tp= 273.2
## ¿Cual es la principal causa de la
##diferencia entre las dos estimaciones el volumen molecular 
## o la atracción molecular 
(p1=ley.gases(n=1, Tp = 273.2, v = 22.41))
## [1] 1.000392
(p2=ley.gases.es(n=1, Tp =273.2, v = 22.41, a = 6.49, b = 0.0562 ))
## [1] 0.9899845
##Diferencia de presiones 
p1-p2
## [1] 0.01040783
#¿que causa la diferencia?
#variando el volumen molecular 
(vm=((1*0.08206*273.2)/(22.41-(0)))-((6.49*1^2)/22.41^2))
## [1] 0.9874694
(atm=((1*0.08206*273.2)/(22.41-(1*0.0562)))-0)
## [1] 1.002907
p2-vm
## [1] 0.0025151
p2-atm
## [1] -0.01292293
## La principal diferencia la causa la atraccion molecular 

## Ejercicio 10 
E<- function (M){
  E= (10^4.4)*(10^(1.5*M))
  return(E)
}
E(7.3)
## [1] 2.238721e+15
E(5.5)
## [1] 4.466836e+12
(w=E(7.5)-E(5.5))
## [1] 4.462369e+15
## Se libera w energía mas en un terremoto de 7.5 frente a uno de 5.5 

## Ejercicio 11
Tem<- function (t){
  Tem= 6*log(t)-(7*(exp(1)^(0.2*t)))
  return(Tem)
}
Tem(1)
## [1] -8.549819
plot(Tem, xlim = c(1,3), main= "Temperatura en función del tiempo"
     , col= "darkred", xlab= "Minutos", ylab="Temperatura °C")

##Ejercicio 12
fun1<- function(x){
  u=2*log10(60*x+1)
  return(u)
}
plot(fun1, xlim = c(0,2), main= "Velocidad en función de distancia"
     , col= "darkgreen", xlab= "Millas", ylab="Millas/horas")

fun2<- function(x){
  v=3*cos(6*x)
}
plot(fun2, xlim = c(0,2), main= "Velocidad en función de distancia"
     , col= "darkgreen", xlab= "Millas", ylab="Millas/horas")

##Ejercicio 13 
longitud<- function(w,a){
  l=(a-((w^2)/4))/w
  return(l)
}
longitud(6,80)
## [1] 11.83333
## Sabiendo que el area del lote seria el area del rectangulo 
## Mas el area del triangulo que es base*altura /2 
## Para calcular la altura del triangulo utilice tangente 

##Ejercicio 14 
(ax1<- seq(5,28,length=100))
##   [1]  5.000000  5.232323  5.464646  5.696970  5.929293  6.161616  6.393939
##   [8]  6.626263  6.858586  7.090909  7.323232  7.555556  7.787879  8.020202
##  [15]  8.252525  8.484848  8.717172  8.949495  9.181818  9.414141  9.646465
##  [22]  9.878788 10.111111 10.343434 10.575758 10.808081 11.040404 11.272727
##  [29] 11.505051 11.737374 11.969697 12.202020 12.434343 12.666667 12.898990
##  [36] 13.131313 13.363636 13.595960 13.828283 14.060606 14.292929 14.525253
##  [43] 14.757576 14.989899 15.222222 15.454545 15.686869 15.919192 16.151515
##  [50] 16.383838 16.616162 16.848485 17.080808 17.313131 17.545455 17.777778
##  [57] 18.010101 18.242424 18.474747 18.707071 18.939394 19.171717 19.404040
##  [64] 19.636364 19.868687 20.101010 20.333333 20.565657 20.797980 21.030303
##  [71] 21.262626 21.494949 21.727273 21.959596 22.191919 22.424242 22.656566
##  [78] 22.888889 23.121212 23.353535 23.585859 23.818182 24.050505 24.282828
##  [85] 24.515152 24.747475 24.979798 25.212121 25.444444 25.676768 25.909091
##  [92] 26.141414 26.373737 26.606061 26.838384 27.070707 27.303030 27.535354
##  [99] 27.767677 28.000000
length(ax1)
## [1] 100
(ax2<-seq(5,28, by=(23/99)))
##   [1]  5.000000  5.232323  5.464646  5.696970  5.929293  6.161616  6.393939
##   [8]  6.626263  6.858586  7.090909  7.323232  7.555556  7.787879  8.020202
##  [15]  8.252525  8.484848  8.717172  8.949495  9.181818  9.414141  9.646465
##  [22]  9.878788 10.111111 10.343434 10.575758 10.808081 11.040404 11.272727
##  [29] 11.505051 11.737374 11.969697 12.202020 12.434343 12.666667 12.898990
##  [36] 13.131313 13.363636 13.595960 13.828283 14.060606 14.292929 14.525253
##  [43] 14.757576 14.989899 15.222222 15.454545 15.686869 15.919192 16.151515
##  [50] 16.383838 16.616162 16.848485 17.080808 17.313131 17.545455 17.777778
##  [57] 18.010101 18.242424 18.474747 18.707071 18.939394 19.171717 19.404040
##  [64] 19.636364 19.868687 20.101010 20.333333 20.565657 20.797980 21.030303
##  [71] 21.262626 21.494949 21.727273 21.959596 22.191919 22.424242 22.656566
##  [78] 22.888889 23.121212 23.353535 23.585859 23.818182 24.050505 24.282828
##  [85] 24.515152 24.747475 24.979798 25.212121 25.444444 25.676768 25.909091
##  [92] 26.141414 26.373737 26.606061 26.838384 27.070707 27.303030 27.535354
##  [99] 27.767677 28.000000
length((ax2))
## [1] 100
(bx1<-seq(2,14, by=0.2))
##  [1]  2.0  2.2  2.4  2.6  2.8  3.0  3.2  3.4  3.6  3.8  4.0  4.2  4.4  4.6
## [15]  4.8  5.0  5.2  5.4  5.6  5.8  6.0  6.2  6.4  6.6  6.8  7.0  7.2  7.4
## [29]  7.6  7.8  8.0  8.2  8.4  8.6  8.8  9.0  9.2  9.4  9.6  9.8 10.0 10.2
## [43] 10.4 10.6 10.8 11.0 11.2 11.4 11.6 11.8 12.0 12.2 12.4 12.6 12.8 13.0
## [57] 13.2 13.4 13.6 13.8 14.0
length(bx1)
## [1] 61
(bx2<-seq(2,14, length=61))
##  [1]  2.0  2.2  2.4  2.6  2.8  3.0  3.2  3.4  3.6  3.8  4.0  4.2  4.4  4.6
## [15]  4.8  5.0  5.2  5.4  5.6  5.8  6.0  6.2  6.4  6.6  6.8  7.0  7.2  7.4
## [29]  7.6  7.8  8.0  8.2  8.4  8.6  8.8  9.0  9.2  9.4  9.6  9.8 10.0 10.2
## [43] 10.4 10.6 10.8 11.0 11.2 11.4 11.6 11.8 12.0 12.2 12.4 12.6 12.8 13.0
## [57] 13.2 13.4 13.6 13.8 14.0
length(bx2)
## [1] 61
(cx1<- seq(-2,5,length=50))
##  [1] -2.0000000 -1.8571429 -1.7142857 -1.5714286 -1.4285714 -1.2857143
##  [7] -1.1428571 -1.0000000 -0.8571429 -0.7142857 -0.5714286 -0.4285714
## [13] -0.2857143 -0.1428571  0.0000000  0.1428571  0.2857143  0.4285714
## [19]  0.5714286  0.7142857  0.8571429  1.0000000  1.1428571  1.2857143
## [25]  1.4285714  1.5714286  1.7142857  1.8571429  2.0000000  2.1428571
## [31]  2.2857143  2.4285714  2.5714286  2.7142857  2.8571429  3.0000000
## [37]  3.1428571  3.2857143  3.4285714  3.5714286  3.7142857  3.8571429
## [43]  4.0000000  4.1428571  4.2857143  4.4285714  4.5714286  4.7142857
## [49]  4.8571429  5.0000000
length(cx1)
## [1] 50
(cx2<-seq(-2,5, by=(7/49)))
##  [1] -2.0000000 -1.8571429 -1.7142857 -1.5714286 -1.4285714 -1.2857143
##  [7] -1.1428571 -1.0000000 -0.8571429 -0.7142857 -0.5714286 -0.4285714
## [13] -0.2857143 -0.1428571  0.0000000  0.1428571  0.2857143  0.4285714
## [19]  0.5714286  0.7142857  0.8571429  1.0000000  1.1428571  1.2857143
## [25]  1.4285714  1.5714286  1.7142857  1.8571429  2.0000000  2.1428571
## [31]  2.2857143  2.4285714  2.5714286  2.7142857  2.8571429  3.0000000
## [37]  3.1428571  3.2857143  3.4285714  3.5714286  3.7142857  3.8571429
## [43]  4.0000000  4.1428571  4.2857143  4.4285714  4.5714286  4.7142857
## [49]  4.8571429  5.0000000
length((cx2))
## [1] 50

## Ejercicio 15 
(ax1<- exp(log(10)*seq(log10(10),log10(1000),length=50))) 
##  [1]   10.00000   10.98541   12.06793   13.25711   14.56348   15.99859
##  [7]   17.57511   19.30698   21.20951   23.29952   25.59548   28.11769
## [13]   30.88844   33.93222   37.27594   40.94915   44.98433   49.41713
## [19]   54.28675   59.63623   65.51286   71.96857   79.06043   86.85114
## [25]   95.40955  104.81131  115.13954  126.48552  138.94955  152.64180
## [31]  167.68329  184.20700  202.35896  222.29965  244.20531  268.26958
## [37]  294.70517  323.74575  355.64803  390.69399  429.19343  471.48664
## [43]  517.94747  568.98660  625.05519  686.64885  754.31201  828.64277
## [49]  910.29818 1000.00000
length(ax1)
## [1] 50
(ax2<- exp(log(10)*seq(log10(10),log10(1000),length=20))) 
##  [1]   10.00000   12.74275   16.23777   20.69138   26.36651   33.59818
##  [7]   42.81332   54.55595   69.51928   88.58668  112.88379  143.84499
## [13]  183.29807  233.57215  297.63514  379.26902  483.29302  615.84821
## [19]  784.75997 1000.00000
length(ax2)
## [1] 20