Question: Write a function to integrate a function fun(x) from A to B using the trapezoidal rule. Your function should have 3 arguments: A, B and

Write a function to integrate a function fun(x) from A to B using the trapezoidal rule. Your function should have 3 arguments: A, B and N (the number of intervals)
so we want .
for the function use
but this should also be written as a function .. not imbedded in your quadrature function so like: function fun(x)
(x-sin(x^3)-exp(-0.01*x))/(x+exp(0.01*x))
end
Then use the function in your quadrature function.
(recall h = (B-A)/N)
2. Write a program which prompts the user to enter A, B and N. You may assume the user will enter numbers, but you should check to see that N is an integer. A and B can be either integers or real numbers. Your program should then print out
The integral of fun(x) from A to B using N intervals is xxxx
(obviously print out the values A,B and N not A B and N
 Write a function to integrate a function fun(x) from A to

1. Write a function to integrate a function "fun(x)'" from A to B using the trapezoidal rule. Your function should have 3 arguments: A, B and N (the number of intervals) so we want.. for the function use but this should also be written as a function.. not imbedded in your quadrature function... so like function fun(x) (x-sin(x^3)- exp(-0.01*x))/(x+exp(0.01*x)) end Then use the function in your quadrature function (recall h -(B-A)/N) 2. Write a program which prompts the user to enter A, B and N. You may assume the user will enter numbers, but you should check to see that N is an integer. A and B can be either integers or real numbers. Your program should then print out The integral of fun(x) from A to B using N intervals is xxxx" (obviously print out the values A,B and N not"A "B" and "N

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!