# # # 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. # # EPage # #----- #postscript("../../WriteUp/Graphics/Chapter7/section_2_prob_4.eps", onefile=FALSE, horizontal=FALSE) x_1 = seq( -100, +600, length=100 ) x_2 = 350 - x_1 plot( x_1, x_2, type='l' ) x_2 = 500 - x_1 lines( x_1, x_2, type='l' ) abline( v=0 ) abline( h=0 ) polygon( c(200,250,400,200), c(150,100,100,300), col="gray" ) grid() #dev.off() #postscript("../../WriteUp/Graphics/Chapter7/section_2_prob_5.eps", onefile=FALSE, horizontal=FALSE) x_1 = seq( -5, +35, length=100 ) x_2 = 30 - x_1 plot( x_1, x_2, type='l' ) abline( v=3 ) abline( v=15 ) abline( h=22 ) abline( h=0 ) polygon( c(3,15,15,8,3), c(0,0,15,22,22), col="gray" ) grid() #dev.off() #postscript("../../WriteUp/Graphics/Chapter7/section_2_prob_10.eps", onefile=FALSE, horizontal=FALSE) x = seq( -1, 6, length=100 ) y = ( 1 - 0.9 * x ) / 0.6 plot( x, y, type='l', ylim=c(-0.5,4) ) y = ( 0.4 - 0.1 * x ) / 0.4 lines( x, y, type='l' ) abline( v=0 ) abline( h=0 ) y_middle = 2.6/3 x_middle = ( 0.4 - 0.4 * y_middle ) / 0.1 polygon( c(0,0,x_middle,4,7,7), c(5,5/3,y_middle,0,0,5), col='gray' ) grid() #dev.off() # Some simple calculations: # x_eps = c(0,0.5333333,4) y_eps = c(1.666667,0.8666667,0) for( ii in 1:3 ){ #print( x_eps[ii] + 0.5 * y_eps[ii] ) # cost for part (c) #print( 0.75 * x_eps[ii] + 0.5 * y_eps[ii] ) # cost for part (d) print( x_eps[ii] + y_eps[ii] ) # cost for part (e) } #postscript("../../WriteUp/Graphics/Chapter7/section_2_prob_14.eps", onefile=FALSE, horizontal=FALSE) x = seq( -1, 6, length=100 ) y = ( 0.6 - 0.9 * x ) / 0.6 plot( x, y, type='l', ylim=c(-0.5,4) ) y = ( 0.4 - 0.1 * x ) / 0.4 lines( x, y, type='l' ) abline( v=0 ) abline( h=0 ) polygon( c(0,0,4,7,7), c(5,1,0,0,5), col='gray' ) grid() #dev.off()