using ApproxFun
using Plots
x = Fun(identity,[-1,1.])
f = x
plot(f)
x = Fun(identity,[-1,1.])
f = x
pole = 1.5
g = Fun( x -> x + 0.01*sin(5*2*pi*x./((x-pole).*(x+pole))) )
plot([f,differentiate(f),g,differentiate(g)],layout=(2,1))
title!("f, g and df, dg")
x = Fun(identity,[-1,1.])
f = x
pole = 1.0005
perb = 0.0001
g = Fun( x -> x + perb*sin(5*2*pi*x./((x-pole).*(x+pole))) )
plot([f,differentiate(f),g,differentiate(g)],layout=(2,1))
title!("f, g and df, dg")
yaxis!([0.95,1.05])