Question: Use the python code below as an example to solve the following Integral: I/IO =1/8*[2C(u) + 1]^2 + [2S(u) + 1]^2 where u = x*sqrt(2/z),

Use the python code below as an example to solve the following Integral: I/IO =1/8*[2C(u) + 1]^2 + [2S(u) + 1]^2

where u = x*sqrt(2/z), C(u) = cos(t^2/2), S(u) = sin(t^2/2) and x in range(0,5)

-----------------------------------------------------------

from gaussxw import gaussxw def f(x): return x**4 - 2*x + 1 N = 3 a = 0.0 b = 2.0 # Calculate the sample points and weights, then map them # to the required integration domain x,w = gaussxw(N) xp = 0.5*(b-a)*x + 0.5*(b+a) wp = 0.5*(b-a)*w # Perform the integration s = 0.0 for k in range(N): s += wp[k]*f(xp[k]) print(s)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!