= #JxnPortable/docs/programmer_examples/demos/derivative_tangent_line_polynomial_Demo.jxn

JxnRealArrayCurve.setLimiter(true)  ! remove outliers before scaling
!
slider = @JxnSliderPanel( $this )
ix = slider.add( "ix", 200., 0., length x - 1 )
!
y = (x+7)(x-2)(x-8)  ! y = x^3 - 3 x^2 - 54 x + 112
yprime = ( 3 x - 6 ) x - 54  ! =dy/dx
!
dx = 2.5
xp = x[ix]
yp = y[ix]
xL = xp - dx
xR = xp + dx
yL = yp - yprime[ix] dx
yR = yp + yprime[ix] dx
plot( x, y, yprime ).add( @JxnGraphicsPainter( 0, xL, yL, xR, yR ).setColor(G) )
!
xder = derivative x  ! =h(const)
yder = derivative y
yxder = derivative( y, x )
pf1 = plot( x, yxder, yder/xder, yprime ).setPlotFrameTitle( "yxder, yder/xder, yprime" )
pf2 = plot( x, yxder - yprime ).setPlotFrameTitle( "yxder - yprime" )
pf3 = plot( x, yder/xder - yprime ).setPlotFrameTitle( "yder/xder - yprime" )
pf4 = plot( x, yder/xder - yxder ).setPlotFrameTitle( "yder/xder - yxder" )