mramine364

sum( (-1)^(i+1) * x^(2*i) / (2*i-1)! , i=1..n )

Dec 30th, 2015
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. var p,x,X,n,i,f,j,res;
  2. p <- 1;
  3. ecrire("Donner x: "); lire(x);
  4. ecrire("Donner n: "); lire(n);
  5. X <- x;
  6. res <- 0;
  7. i <- 1;
  8. tant que i <= 2*n+1 faire
  9. // f = i!
  10. j <- 1;
  11. f <- 1;
  12. tant que j <= i faire
  13. f <- f*j;
  14. j <- j+1;
  15. fin tant que;
  16.  
  17. res <- res + p*X/f;
  18. p <- p*(-1);
  19. X <- X*x*x;
  20. i <- i+2;
  21. fin tant que;
  22. ecrire( "l'approximation est: ",res);
Advertisement
Add Comment
Please, Sign In to add comment