I define a function f as :
f <- function(x){
if (x < 0) {
x^3-x^2+4
} else {
-4*x+2
}
}
and now i want to draw it with curve function for example on interval [-100,100].
So i write
curve(f,from=-100,to=100)
And i only get the function x^3-x^2+4 on interval [-100,100]
Why i don't get my function -4x+2 on interval [0,100] ?
When i want to draw function f for example on interval [3,4] it show's me a good function. It seem's to be a problem when it has to draw two functions in a one graph.