[SOLVED] EEE591 Homework #2

35.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon hw2-gf1rci.zip (322.9 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
πŸ”’ Securely Powered by:
Secure Checkout
5/5 - (2 votes)

Homework #2

There are two parts to this homework, both worth 50 points.

Use scipy.integrate.quad for both parts!

Part 1

Compute the value of the integral:


! (π‘Žπ‘₯! + 𝑏π‘₯ + 𝑐)𝑑π‘₯ #

where r ranges from 0 to 5 in steps of 0.01, and a, b, and c are the constants 2, 3, and 4, respectively. Place the results on a plot using matplotlib. Then change the constants so that a, b, and c are 2, 1, and 1, respectively. Use these results to add another curve to your plot.

NOTE: You must use the same function for performing both integrals! That is, one function that computes the value of π‘Žπ‘₯! + 𝑏π‘₯ + 𝑐. Therefore, you must pass the values of a, b, and c as arguments to the function!

To be clear, there will be two curves on your plot. Remember to properly label the axis and add a title. And don’t forget the legend!

Name your script hw2_poly.py.

Part 2
Compute the value of the integral:
$ 𝑑π‘₯
!= πœ‹
# (1 + π‘₯)√π‘₯
using the substituion method. (You might be able to find a package that will integrate this without substitution, but the point of this execise is to learn to do the substitution. Therefore, unless you do the substitution method, your work will not be counted!)
Note that this is a known integral whose answer is, in fact, πœ‹.
Print out your result to a precision of 8 digits past the decimal point. Then subtract your answer from numpy.pi and print the difference to 15 digits pas the decimal point.
NOTE: Be sure to use np.sqrt() to compute any square roots required.
Name your script hw2_pi.py.
Your output must match this format:
Pi is 3.14159265
Difference from numpy.pi is: -0.000000000000099

  • hw2-gf1rci.zip