Question: Complete python code. Necessary files are below import matplotlib.pyplot as plt import NumMethods as nm import numpy as np def main(): ''' Calculates P(x+2|N(175, 3))

Complete python code. Necessary files are below Complete python code. Necessary files are below import matplotlib.pyplot as plt import import matplotlib.pyplot as plt import NumMethods as nm import numpy as np def main(): ''' Calculates P(x+2|N(175, 3)) and displays both the GNPDF and CDF for each case :return: ''' #part 1. P(x', connectionstyle="arc3")) #draw the arrow with text plt.ylabel('f(x)', size=12) #add a label to the y axis ax.tick_params(axis='both', which='both', direction='in', top=True, right=True, labelsize=10) # format tick marks ax.xaxis.set_ticklabels([]) #erase x tick labels for the top graph #create the CDF plot plt.subplot(2,1,2) #select the second plot plt.plot(#&MISSING CODE HERE) #plot cdf_a vs x_a plt.ylim(0,1) #set limits for the y axis plt.ylabel(#&MISSING CODE HERE, size=12) #label the y axis plt.xlabel('x') #add the x label plt.plot(#&MISSING CODE HERE,'o', markerfacecolor='white', markeredgecolor='red') #put a red circle on the cdf at location c_a, p_a ax=plt.gca() #get the current set of axes ax.tick_params(axis='both', which='both', direction='in', top=True, right=True, labelsize=10) # format tick marks ax.set_xlim(x_a.min(), x_a.max()) #make sure the x axis has the correct limits ax.hlines(p_a,ax.get_xlim()[0],c_a, color='black', linewidth=1) #draw a horizontal line connecting the y axis to the red circle ax.vlines(c_a, 0, p_a,color='black', linewidth=1) #draw a vertical line connecting the x axis to the red circle plt.show() #show the plot. Note, the code stops here and waits for the user to close the figure window #part 2. P(x 
 --NumMethods--- from scipy import integrate def GNPDF(x, args=(0,1)): ''' This is the Gaussian Normal Probability Density Function with parameters mean (m), standard deviation (s). A call to GNPDF will calculate f(x)=(1/(s*sqrt(2*pi)))*exp(-0.5*((x-m)/s)**2). :param x: the x value of interest :param args: (mean, standard deviation) as a tuple :return: f(x) ''' m, s = args #unpack from args f= #&MISSING CODE HERE #calculate f(x) return f #return f(x) def CDF(c, args=(0,1)): ''' This function integrates the GNPDF from mu-10*sigma to x=c to yield the probability x  a) For this problem, we will re-work homework 2a using the integrate.gauss function of scipy.integrate rather than the Simpson method to find: P(xu+26N(175, 3)) Rather than printing your findings to the console, we will use matplotlib.pyplot to produce nicely formatted plots such as shown below. Additional requirements are:  You should put your main function in a file called HW4a.py and all other functions in a file called NumMethods.py.  You should import your methods from Nummethods.py with the statement: import NumMethods as nm in your HW4a file. You should use numpy arrays for all of your work on this problem where arrays are needed. Note: code stems for HW4a.py and Nummethods.py are available for download. 0.40 0.35 0.30 0.12 0.10 0.08 RecSINO BLOG 0.25 0.20 0.15 0.10 0.05 0.00 0.06 0.04 R1.00 175.00,3.0010.02 0.02 0.00 10 1.0 0.8 0.8 051 06 X).xdx XPIXS = (x)0 041 0.4 02  02 00 200 165 170 175 180 185 190

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!