#postscript("../../WriteUp/Graphics/Chapter2/chap_2_sect_8_prob_12_plot.eps", onefile=FALSE, horizontal=FALSE) ts = seq( -0.5, 0.5, length.out=100 ) phi_1 = - (1/2) * ( ts^3 + 2 * ts^2 + 2 * ts ) phi_2 = - ( ts - ts^2 / 2 - ts^3 / 6 - ts^4 / 4 + ts^5 / 5 + ts^6 / 20 ) phi_3 = - ts - (1/2) * ts^2 + (1/12) * ts^4 - (3/20) * ts^5 + (4/45) * ts^6 phi_4 = - ts - (1/2) * ts^2 + (1/8) * ts^4 - (7/60) * ts^5 + (1/15) * ts^6 all_phis = c( phi_1, phi_2, phi_3, phi_4 ) min_y = min( all_phis ) max_y = max( all_phis ) plot( ts, phi_1, type='l', ylim=c( min_y, max_y ), col='blue', xlab='t', ylab='phi_n(t)' ) lines( ts, phi_2, type='l', col='green' ) lines( ts, phi_3, type='l', col='red' ) lines( ts, phi_4, type='l', col='black' ) legend( 'bottomleft', c('phi_1', 'phi_2', 'phi_3', 'phi_4'), lwd=2, lty=1, col=c('blue', 'green', 'red', 'black' ) ) grid() #dev.off()