Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need a code in Python following the required logic , not using import quad etc. And find out the value of N when numerical
I need a code in Python following the required logic , not using import quad etc. And find out the value of N when numerical value has 2 decimals. your effort will be appreciated, ty.
make a numerical integration program in Python
. Exercise: Integrate f(x) = 2x2 + 3x from x = 1 to x = 5 and compare your numerical result with what you calculate analytically Strategy/Algorithm: Define a function, S(x), that will return 2x2 + 3x Define a variable N, the number of times that you will evaluate f(x) Create an array of N values of x between x 1 and x = 5 Create an array of N values of f(x) (by evaluating your function with the array of x values as argument) Define a variable, Ax = Sum all of the values in your array of f(x) values, and multiply that by Ax Note that for the last point, since Ax is a constant (the same for each value x), it factors out of the sum: IN-1 f(x,)x = . f(x) FEN-1 =0 10 Also, note that if you have a numpy array of values, you can easily find the sum without a for loop: an = np.linspace(1,5,100) theSum an.sum()Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started