Advertisement
DEMOOH

Untitled

Dec 6th, 2016
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. In[119]:= f[x_] := 3 (Sin[x] + 2)/(Cos[2*x] + 1.5)
  2. a = 1;
  3. b = 3;
  4. n = 10;
  5. nn = 2*n;
  6. h = (b - a)/nn;
  7. s = f[a] + f[b];
  8. For[j = 1, j < n, ++j,
  9. s += 2*f[a + 2 j*h] + 4*f[a + (2*j - 1) h];
  10. ];
  11. s += 4*f[a + (2 n - 1)*h];
  12. s *= h/3
  13. Integrate[f[x], {x, a, b}]
  14.  
  15. Out[128]= 19.0347
  16.  
  17. Out[129]= 19.0348
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement