Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python for Rapid Engineering Solutions Homework # 2 There are two parts to this homework, both worth 5 0 points. Use scipy.integrate.quad for both parts!
Python for Rapid Engineering Solutions
Homework #
There are two parts to this homework, both worth points.
Use scipy.integrate.quad for both parts!
Part
Compute the value of the integral:
where ranges from to in steps of and and are the constants and
respectively. Place the results on a plot using matplotlib. Then change the constants so that
b and are and respectively. Use these results to add another curve to your plat.
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 and 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 hwpoly.py
Part
Compute the value of the integral:
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 methad, your work will nat be counted!
Note that this is a known integral whose answer is in fact,
Use the substitution method taught in lecture and discussed in the Newman text.
Print out your result to a precision of digits past the decimal point. Then subtract your answer
from numpy.pi and print the difference to digits pas the decimal point.
NOTE: Be sure to use npsqrt to compute any square roots required.
Name your script hwpipy
Your output must match this format:
Pi is
Difference from numpy.pi is:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started