Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(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 image text in transcribed--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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part 2 Lnai 8725

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448505, 978-3662448502

More Books

Students also viewed these Databases questions

Question

Question What is the advantage of a voluntary DBO plan?

Answered: 1 week ago

Question

Question How is life insurance used in a DBO plan?

Answered: 1 week ago