code for diagrams
> tx := proc (f, w, deltax, range, View) local P1, P2, pointsplot, line1, line2, line3, line4, fplot, fw, chordplot, tanslope, tanline, tanplot, txt1, txt2, line5, line6, putfx, putfxplush, putx, puth, putp2, putdeltax, putdeltay, putw; P1 := [w, subs(x = w,f)]; P2 := [w+deltax, subs(x = w+deltax,f)]; pointsplot := plot({P1, P2},style = POINT,thickness = 3,color = black); line1 := plot([[P1[1], View[1]], P1],linestyle = 3); line2 := plot([P1, [range[1], P1[2]]],linestyle = 3); line3 := plot([P2, [P2[1], View[1]]],linestyle = 3); line4 := plot([P2, [range[1], P2[2]]],linestyle = 3); fplot := plot(f,x = range[1] .. range[2],thickness = 1,color = blue); fw := subs(x = w,f); tanslope := subs(x = w,diff(f,x)); tanline := (x-P1[1])*tanslope+P1[2]; tanplot := plot(tanline,x = range[1] .. range[2],color = black); line5 := plot([[P2[1], P1[2]], P1],linestyle = 1,thickness = 2); line6 := plot([[P2[1], P1[2]], P2],linestyle = 1,thickness = 2); putfx := plots[textplot]([range[1], P1[2], convert(subs(x = w,f),stri ng)],align = LEFT,font = [TIMES, BOLD, 14]); Digits := 5; putfxplush := plots[textplot]([range[1], P2[2], convert(subs(x = P2[1],f),string)],align = LEFT,font = [TIMES, BOLD, 14]); Digits := 10; putw := plots[textplot]([P1[1], View[1], convert(w,string)],align = BELOW,font = [TIMES, BOLD, 14]); puth := plots[textplot]([P2[1], View[1], convert(w+deltax,string)],align = BELOW,font = [TIMES, BOLD, 14]); plots[display]([pointsplot, putfxplush, putw, putfx, puth, fplot, tanplot, line1, line2, line3, line4, line5, line6],xtickmarks = [0],ytickmarks = [],titlefont = [TIMES, BOLD, 18],axesfont = [TIMES, BOLD, 16],view = [range[1] .. range[2], View[1] .. View[2]]) end:
> tx(x^3,2,.1,[1,2.4],[3,9.5]);tx(x^3,2,.1,[1.9,2.2],[7.5,9.5]);