# source("http://macosa.dima.unige.it/r.R")
f1=function(x) sin(3*x); f2=function(x) a*x^3+b*x^2+c*x+d
f = function(x) ifelse(x < 0, f1(x), f2(x) )
BF=3.5; HF=2.8
Plane(-4,5, -2,3)
graph(f1,-4,0, "brown")
POINT(3,1, "brown"); line(2,1, 4,1, "brown")
# La derivazione:
deriv(f1,"x")
# cos(3 * x) * 3
df1 <- function(x) eval(deriv(f1,"x")); df1(0)
# 3
d = 0; c = 3; b = -5/3; a = 7/27
df2 <- function(x) eval(deriv(f2,"x")); df2(0)
# 3 OK
graph(f2,0,5, "seagreen"); POINT(3,1, "brown")
#
Plane(-4,5, -3,3); graph(f1,-4,0, "brown"); graph(f2,0,5, "seagreen")
POINT(3,1, "brown")
graph2(df1,-4,0, "red"); graph2(df2,0,5, "green2")
solution(df2,0, 0,2); fraction(solution(df2,0, 0,2))
# 1.285714 9/7
POINT(9/7,f2(9/7),"red")