Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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
image text in transcribed
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

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

Fundamentals Of Database System

Authors: Elmasri Ramez And Navathe Shamkant

7th Edition

978-9332582705

More Books

Students also viewed these Databases questions

Question

Explain the conditions that led to the debt crisis in Greece.

Answered: 1 week ago