# # Written by: # -- # John L. Weatherwax 2009-04-21 # # email: wax@alum.mit.edu # # Please send comments and especially bug reports to the # above email address. # #----- #m = 1 m = 2.5 #m = 10 x = seq( -10, +15, length.out=500 ) H1 = dnorm( x, 0, m ) H2 = dnorm( x, m, m ) H3 = dnorm( x, 0, sqrt(2)*m ) # The boundary between classes 3 and 1: m13 = m * sqrt( 2 * log(2) ) print( sprintf("m13 = %10.6f",m13) ) # The boundary between classes 1 and 2: m12 = m/2. print( sprintf("m12 = %10.6f",m12) ) # The boundary between classes 2 and 3: m23plus = 2 * m + sqrt(2) * m * sqrt( 1 + 8 * log(2) ) m23minus = 2 * m - sqrt(2) * m * sqrt( 1 + 8 * log(2) ) print( sprintf("m23minus = %10.6f; m23plus = %10.6f",m23minus,m23plus) ) #postscript("../../WriteUp/Graphics/Chapter2/prob_2.3.4.eps", onefile=FALSE, horizontal=FALSE) plot( x, H1, type="l", col="red" ) lines( x, H2, type="l", col="black" ) lines( x, H3, type="l", col="green" ) abline( v=-m13, col="gray" ) abline( v=m12, col="gray" ) abline( v=m23plus, col="gray" ) #dev.off()