Section 2.2

Calculus I
Andy Long

(* Section 2.2: derivative as a function *)
ClearAll["Global`*"]

(* Exercise 7, p. 111: *)
f[x_]:=Sqrt[x]
a=1
R={{0,2},{-.1,1.5}};
m=Limit[(f[x]-f[a])/(x-a),x->a]
m=Limit[(f[a+h]-f[a])/h,h->0]
PlotA=Plot[{f[x],m(x-a)+f[a]},{x,a-1,a+1}];
PlotB=ListPlot[{{a,f[a]}},PlotMarkers->{"☹"}];
Show[PlotA,PlotB,PlotRange->R]

(* Now let's see that in action: *)
list={};
Manipulate[
Module[
{m},
m=Limit[(f[a+h]-f[a])/h,h->0];
list=Append[list,{a,m}];
PlotA=Plot[{f[x],m(x-a)+f[a]},{x,0,3}];
PlotB=ListPlot[{{a,f[a]}},PlotMarkers->{"☹"}];
PlotC=ListPlot[list];
Show[PlotA,PlotB,PlotC,PlotRange->R]
]
,{a,0,2}
]

Plot [{f[x],f'[x]},{x,0,3},PlotRange->R]

Clear[u,v,a,a0,a1,a2,a3,a4,a5,a6,a7];
c[x_]:=(x-2.3)(x-4.3);
p[x_]:=a*x^8+a0*x^7+a1*x^6+a2*x^5+a3*x^4+a4*x^3+a5*x^2+a6*x+a7;
f[x_]:=p[x]*c[x];
fp[x_]:=f'[x]
fp[x]
roots=Solve[{f[0]==1.3,f[.4]==1,f[1.5]==1.6,f[3]==-.7,f[5]==.8,fp[.4]==0,fp[1.5]==0,fp[3]==0,fp[5]==3/2},{a,a0,a1,a2,a3,a4,a5,a6,a7}]
p[x_]:=(-0.1009963894230044`-0.16186494526001277` a4-0.9461647139149743` a5-3.7822350078329015` a6)*x^8+(1.1454809272497808`+1.8758472813615963` a4+10.837085902432374` a5+43.11538513263828` a6)*x^7+(-4.24625260273881`-7.317824097510355` a4-41.221042013443096` a5-162.33396025337512` a6)*x^6+(5.629371217347296`+11.24529000894129` a4+59.26725054434922` a5+227.32753550103905` a6)*x^5+(-1.5060865619155286`-5.943174631383346` a4-24.030885176668242` a5-83.24513999216394` a6)*x^4+a4*x^3+a5*x^2+a6*x+0.1314459049544995`;
a4=-10;
a5=-10;
a6=-10;
Plot[f[x],{x,0,5.5}]

Clear[u,v,a,a0,a1,a2,a3,a4,a5,a6,a7];
c[x_]:=(x-2.3)(x-4.3);
p[x_]:=a2*x^5+a3*x^4+a4*x^3+a5*x^2+a6*x+a7;
f[x_]:=p[x]*c[x];
fp[x_]:=f'[x]
fp[x]
roots=Solve[{f[0]==1.3,f[.4]==1,f[1.5]==1.6,f[3]==-.7,f[5]==.8,fp[.4]==0,fp[1.5]==0,fp[3]==0,fp[5]==3/2},{a2,a3,a4,a5,a6,a7}]
p[x_]:=.142922*x^5+-1.39326*x^4+3.75965*x^3+-2.13339*x^2+.346088*x+.131446;
Plot[f[x],{x,0,5.5}]

Integrate[gp[x],x]
g[x_]:=-1.0000008000000002` x+1.8416163068322984` (x^2)-1.1211762492753623` (x^3)+0.2635870676328502` (x^4)-0.020358868184955137` (x^5);
g[0]
Plot[1.3+20(g[x]/(2+x)),{x,0,6},PlotRange->{{0,6},{-2,2}}]