x = seq( -2, +2, length.out=200 ) y_4_terms = 4 * ( 1 - x^2 ) -( x - x^3 / 2 ) plot( x, y_4_terms, type='l', col='red' ) y_5_terms = 4 * ( 1 - x^2 + x^4 / 3 ) -( x - x^3 / 2 ) lines( x, y_5_terms, type='l', col='blue' ) grid() legend( 'bottomright', c('4 terms', '5 terms'), lwd=2, lty=c(1,1), col=c('red', 'blue') )