# # 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. # #----- #postscript("../WriteUp/Graphics/1963/prob_12.eps", onefile=FALSE, horizontal=FALSE) # Plot the points P, Q, R (and the solution): x = c(-3,1,9, 5) y = c(-2,-5,1, 4) plot(x,y,pch=16,col="blue") text( c(-3,1,9), c(-1.75,-4.75,0.75), labels=c("P","Q","R") ) abline( a=1/4, b=3/4 ) grid() #dev.off() s_x = polyroot( c( 225/16 - 100, 75/8, 25/16 ) ) s_y = 1/4 + (3/4) * s_x # Compute the distance between the points we found above (or S) and P: ( c(-2,-2) - s_y )^2 + ( c(-3,-3) - s_x )^2 # Compute the slope between the points we found above (or S) and R: # Note the first one has the needed slope of -3/4 and is our solution # ( c(1,1) - s_y ) / ( c(9,9) - s_x )