Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M Ricardo, Susan D Urban

3rd Edition

1284056945, 9781284056945

More Books

Students also viewed these Databases questions

Question

Were members encouraged to participate?

Answered: 1 week ago

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago