JSL has a derivative function. I've forgotten all my calculus, so I can't explain the last three terms, but I made a small test harness, and it works.
// make a really ugly formula
fx = Expr(
A * x ^ W + B * x ^ Z + C * x + D * Sin( E * x ) + F * x * Log( G * x ) + Tan( x ) * Exp( x )
);
// ask JMP to find the derivative with respect to x. p for prime.
fxp = Derivative( Name Expr( fx ), x );
W * x ^ (W - 1) * A
+ Z * x ^ (Z - 1) * B
+ C
+ E * Cosine( E * x ) * D
+ F * Log( G * x ) + G / (G * x) * F * x
+ 1 / Cosine( x ) ^ 2 * Exp( x ) + Exp( x ) * Tan( x )
Test harness:
A = 3;
B = 4;
C = 5;
D = 6;
E = 7;
F = 8;
G = 9;
W = 10;
Z = 11;
// do a small test at some point, "center"
center = 7;
// evaluate the original formula to calculate the slope on a small interval
interval = .0000001;
halfinterval = interval / 2;
x = center - halfinterval;
y1 = fx; // low side of center
x = center + halfinterval;
y2 = fx; // high side of center
slope = (y2 - y1) / interval; // approximate derivative
Write( "\!nslope: " || Char( slope ) );
x = center; // midpoint
yd = fxp; // exact derivative
Write( "\!nderivative: " || Char( yd ) );
Write( "\!npercent error: " || Char( 100 * (slope - yd) / ((slope + yd) / 2) ) );
slope: 13639522056.5796
derivative: 13639522109.8688
percent error: -0.000000390696846545
pretty steep! centers much closer to zero are less steep.
Craige