Advertisement
Guest User

Untitled

a guest
Sep 5th, 2019
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 1.22 KB | None | 0 0
  1. nu = 51
  2. sig = 0.0011
  3. K=23490
  4. mu=3.9
  5.  
  6. ### calcul de Emid
  7.  
  8. #fonction pour l'intégrale double
  9. f <- function(t,s){
  10.   a <- (exp(s)-1)/s
  11.   b <- (sig**2*t/6 + sig**2)*exp(-mu*t)*a
  12.   c <-  nu*exp(-nu*t)*b
  13.   return(c)
  14. }
  15.  
  16. #fonction pour l'intégrale simple
  17. g <- function(t){
  18.   a <- nu*exp(-nu*t)
  19.   b <- sig**2*t/3*(1-exp(-mu*t))
  20.   return(a*b)
  21. }
  22.  
  23.  
  24. emid <- function(h){
  25.  
  26.   tmin <- h
  27.   tmax <- 100
  28.   smax <- function(x) mu*x
  29.   smin <- 0
  30.  
  31.   I <- integral2(f,tmin,tmax,smin,smax)$Q
  32.  
  33.   J <- integrate(g,h,100)$value
  34.  
  35.   a <- (1 - exp(-nu*h)*(nu/(nu+h)))*exp(nu*h)
  36.  
  37.   return(a*(I+J))
  38. }
  39.  
  40.  
  41. #### calcul de E final
  42.  
  43. # fonction pour l'intégrale triple
  44. k <- function(t,s,u){
  45.   a <- (exp(u)-1)/u
  46.   b <- 1/s
  47.   c <- nu*exp(-nu*t)*exp(-mu*t)
  48.   return(a*b*c)
  49. }
  50.  
  51. efin <- function(h){
  52.  
  53.   tmin <- h
  54.   tmax <- 100
  55.   smax <- function(x) mu*x
  56.   smin <- 0
  57.   umax <- function(x,y) y
  58.   umin <- 0
  59.    
  60.   I <- integral3(k,tmin,tmax,smin,smax,umin,umax)
  61.  
  62.   a <- (1-exp(-mu*h)*mu/(mu+h))
  63.   b <- exp(mu*h)/a
  64.   J <- nu**2*(nu*h+0.5)
  65.  
  66.   e <- emid(h) + (J/K**2)*b*I
  67.   return(e)
  68. }
  69.  
  70.  
  71. #Graphique
  72. c <- 0.1 * 1:140
  73. d <- lapply(c,efin)
  74.  
  75. plot(c,d,xlab = 'h en secondes',ylab = 'E(h)',main = 'Courbe de E(h)')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement