
Trapezoidal rule
Hello!
I want to approximate: 2π ∫ tan²x dx from x = 0 to π/4
Can anyone check if i'm doing this right (i used n = 4)?
f(x) = 2π tan² x
Δx = (b  a) / n = ((π/4)  0 / 4) = π/16
and (b  a) / 2n = π/32
So we have to go from 0 to π/4 by steps of π/16 :
π/32 [ f(0) + 2f(π/16) + 2f(π/8) + 2f(3π/16) + f(π/4)]
e.g. 2f(π/16) = 2*(2π tan²(π/16)) = 0,497202 etc..
π/32 [0 + 0,497202 + 2,156048 + 5,6104156 + 6,2831853]
π/32 (14,54685122) = 1,428133779
Thanks a lot!

1 Attachment(s)
Re: Trapezoidal rule