> restart:
> a := 1;
> f := x->cos(x);
> h := 2.2; q:= (f(a+h) - f(a))/h; secline:= x -> f(a) + q*(x - a); m:= D(f)(a); tanline:= x -> f(a) + m*(x - a);
> plot([tanline(x), f(x), secline(x)], x=-5..5, color=[blue,green,magenta]);