Question
please use python to do this thx
In this lab you will explore the accuracy of the different quadrature methods. You will explore the Newton-Cotes method using
0 0
Add a comment Improve this question Transcribed image text
Answer #1

The Trapezoidal law represents a method to approximate a given definite integral. It is done by approximation of the area, under the function graph, called trapezoid.

For the given integral:

import numpy as nmpy

import matplotlib.pyplot as plot

%matplotlib inline

f = lambda x: nmpy.exp(-3*x)

x = nmpy.linspace(-0.75,1.5,100)

y = f(x)

plot.plot(x,y)

x0 = -1; x1 = 1;

y0 = f(x0); y1 = f(x1);

plot.fill_between([x0,x1],[y0,y1])

plot.xlim([-0.75,1.5]); plot.ylim([0,1.5]);

plot.show()

This code will show the plot from the approximation of integral. Since number of intervals are not given, accuracy will be affected.

Add a comment
Know the answer?
Add Answer to:
please use python to do this thx In this lab you will explore the accuracy of the different quadrature methods. You...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In this lab you will explore the accuracy of the different quadrature methods. You will explore the Newton-Cotes me...

    In this lab you will explore the accuracy of the different quadrature methods. You will explore the Newton-Cotes method using the method of undetermined coefficients. You will also be expected to debug existing code The tutors will provide an explanation (and demonstration) of the Newton-Cotes method using the method of undetermined coefficients. Your task is to implement the Trapezoidal law to approximate the following integral "1 and comment on the accuracy of the method. In this lab you will explore...

  • Lab Objectives Be able to write methods Be able to call methods Be able to declare...

    Lab Objectives Be able to write methods Be able to call methods Be able to declare arrays Be able to fill an array using a loop Be able to access and process data in an array Introduction Methods are commonly used to break a problem down into small manageable pieces. A large task can be broken down into smaller tasks (methods) that contain the details of how to complete that small task. The larger problem is then solved by implementing...

  • MATLAB Create a function that provides a definite integration using Simpson's Rule Problem Summar This example demo...

    MATLAB Create a function that provides a definite integration using Simpson's Rule Problem Summar This example demonstrates using instructor-provided and randomized inputs to assess a function problem. Custom numerical tolerances are used to assess the output. Simpson's Rule approximates the definite integral of a function f(x) on the interval a,a according to the following formula + f (ati) This approximation is in general more accurate than the trapezoidal rule, which itself is more accurate than the leftright-hand rules. The increased...

  • Please use Java to write the program The purpose of this lab is to practice using...

    Please use Java to write the program The purpose of this lab is to practice using inheritance and polymorphism. We need a set of classes for an Insurance company. Insurance companies offer many different types of policies: car, homeowners, flood, earthquake, health, etc. Insurance policies have a lot of data and behavior in common. But they also have differences. You want to build each insurance policy class so that you can reuse as much code as possible. Avoid duplicating code....

  • Create a new project in BlueJ and name it LastName-lab8-appstore, e.g., Smith-lab8-appstore. If your App class from Lab 4 is fully functional, copy it into the project. (You can drag a file from File...

    Create a new project in BlueJ and name it LastName-lab8-appstore, e.g., Smith-lab8-appstore. If your App class from Lab 4 is fully functional, copy it into the project. (You can drag a file from File Explorer onto the BlueJ project window.) Otherwise, use the instructor's App class: Create a new class using the "New Class..." button and name it App. Open the App class to edit the source code. Select and delete all the source code so that the file is...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT