Question: Integration by the least - square method The least square method is a graphical method of integration, based on computing the surface located below a

Integration by the least-square method
The least square method is a graphical method of integration, based on computing the surface located below a function (which represents the integral of the function). Let us
assume that we have a function f(x) we want to integrate between the two values A and B. If you compute f(A) and f(B), and do the following calculus f(A)+f(B)*B-A2,
you can see that you are computing the area of the trapeze defined by A,f(A),f(B), and B. This trapeze will be "close" to the value of the integral of the function if A and B are
very close values (this is called a linear regression of the function f ). So, if you have plenty of small intervals between A and B, you will have a good approximation of the real
integral.
Task 1
Create a function named surface which will compute the calculus of the surface of a trapeze. The function will take as entry parameter 4 numbers, and will return one number.
The first line is def surface(i,j,k,l :
Task 2
We will suppose we have a lower limit for the integral and an upper limit for the integral, and we want to define N intervals in between ( N can be 1 or above).
Create two functions: one creating the lower limits of each interval, called I(A,B,N), and one creating the upper limit of each interval, called ul(A,B,N
[]: # Do not change this celli =0
j = np.pi
k}=n\mp@code{np.sin(i)
l = np.sin(j)
toto = surface(i,j,k,l)
tata = ll(i,j,100)
titi = ul(i,j,100)
Integration by the least - square method The

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 Programming Questions!