Question: I need help in writing a Python code for the following problem Exercise 5.2: a) Write a program to calculate an approximate value for the
I need help in writing a Python code for the following problem
Exercise 5.2: a) Write a program to calculate an approximate value for the integral '(x4 2x + 1) dx from Example 5.1, but using Simpson's rule with 10 slices instead of the trapezoidal rule. You may wish to base your program on the trapezoidal rule program on page 142. b) Run the program and compare your result to the known correct value of 4.4. What is the fractional error on your calculation? c) Modify the program to use a hundred slices instead, then a thousand. Note the improvement in the result. How do the results compare with those from Exam- ple 5.1 for the trapezoidal rule with the same numbers of slices? Exercise 5.2: a) Write a program to calculate an approximate value for the integral '(x4 2x + 1) dx from Example 5.1, but using Simpson's rule with 10 slices instead of the trapezoidal rule. You may wish to base your program on the trapezoidal rule program on page 142. b) Run the program and compare your result to the known correct value of 4.4. What is the fractional error on your calculation? c) Modify the program to use a hundred slices instead, then a thousand. Note the improvement in the result. How do the results compare with those from Exam- ple 5.1 for the trapezoidal rule with the same numbers of slices
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
