# The graph and graphF commands take quite a long time to plot the 1-input function # graphs but make them accurate. In the following figure you can see the correct # graphs of some functions that have jumps made with graph and the wrong ones # obtained with CURVE and plot, which are discussed below. # As functions: f <- function(x) ifelse(x >= 2, -3, 4); g <- function(x) 1/(x-1/3) h = function(x) round(x) # As curves: F <- function(x,y) y - f(x); G <- function(x,y) y - g(x); H = function(x,y) y - h(x) # 1st: Plane(-5,5, -5,5); graph(f, -5,5, "black"); graph(g, -5,5, "blue") graph(h, -5,5, "red") # 2nd: Plane(-5,5, -5,5); CURVE(F, "black"); CURVE(G, "blue"); CURVE(H, "red") # 3rd: Plane(-5,5, -5,5); plot(f, -5,5, add=TRUE, col="black") plot(g, -5,5, add=TRUE, col="blue"); plot(h, -5,5, add=TRUE, col="red") # # graph and graphF trace the charts by point. If the graph has almost vertical # sections, it may happen that the curve appears dotted. It may then be useful to # retract it around those points to get a continuous curve there too. Instead, the # other commands are almost always trying to match the points that are drawn, as # seen in the previous figures. # If I'm sure the function is continuous I can plot the graph with CURVE.