Question: (CODE A) AND (NUM METHODS) below. Code says #&MISSING CODE HERE for code that needs filled in. thanks --CODE A-- import matplotlib.pyplot as plt import

(CODE A) AND (NUM METHODS) below. Code says #&MISSING CODE HERE for code that needs filled in. thanks (CODE A) AND (NUM METHODS) below. Code says #&MISSING CODE HERE for--CODE A-- 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 
 --NUM METHODS--- 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  For this problem, we will re-work homework 2a using the integrate: gauss function of sciplintegrate rather than the Simpson method to find: P(x

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!