if( !require('NLRoot') ){ install.packages('NLRoot') } library(NLRoot) # Plot the region where the argument of the square root is positive: # x = seq( -2, 1, length.out=100 ) y = function(x){ 2*(1-x)*exp(x) - 1 } ys = y(x) plot( x, ys, type='l' ) abline(h=0, col='blue') grid() BFfzero( y, -2.0, -1.5 ) BFfzero( y, 0.5, 1.0 ) #postscript("../../WriteUp/Graphics/Chapter2/chap_2_sect_2_prob_11_plot.eps", onefile=FALSE, horizontal=FALSE) x = seq( -1.67, 0.75, length.out=100 ) y = function(x){ sqrt( 2*(1-x)*exp(x) - 1 ) } ys = y(x) plot( x, ys, type='l', xlab='x', ylab='y(x)' ) grid() #dev.off()