Evaluate:
1 cos x
∫ ------------
-1 e(1/x) +1
0.8414712710225863
is the result I get if I run the command:
integrate(-1,1,700)
I went to Wolfram Alpha to double check the result. Wolfram's result was essentially the same but with the added information
that this equal sin(1).
So far, I have not found a calculus method to do this integration.
import math
def f(x):
num = math.cos(x)
den = math.e ** (1/x) + 1
return num/den
def integrate(l_limit, u_limit, bins=100):
ans = 0
x_range = u_limit - l_limit
delta = x_range / bins
for n in range(bins):
ans += f(l_limit + delta*(n + .5)) * delta
return ans
|
Posted by Larry
on 2023-12-26 13:09:51 |