mramine364

approxmation de la fonction sinus

Dec 29th, 2015
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. public static float appr_sin(float x, int n){
  2. float X = x;
  3. int p=1;
  4. for(int i=1;i<=2*n+1;i+=2){
  5. res += p*X/factoriel( i ); p*=-1; X *= X*X;
  6. }
  7. return res;
  8. }
  9.  
  10. public static int factoriel(int n){
  11. if( n==0 )
  12. return 1;
  13. return factoriel(n-1)*n;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment