This is what I was looking for Xhantt.

Instead of writing polynomials in the conventional way like

ax^3 + bx^2 + cx + d

it is much faster to write them as

((ax + b)x + c)x + d

This is what you did with Deriv2. The results are

w/o FFIX w/FFIX

Conventional 35.4 sec 7.9 sec

Deriv (Xhantt) 27.2 sec 3.2 sec

Deriv2 (Xhantt) 21.7 sec 2.8 sec

You improved an already excellent time.

As far as I know, this is the most efficient way to calculate a polynomial. I suggested this challenge because I wanted to demonstrate the advantages of this method. Unfortunately, not many took any interest in it.

Here are my functions (notice that they do the same thing as yours, though I did it a bit differently)

DECLARE FUNCTION PofX# (x#, Coef#())

DECLARE FUNCTION dPdx# (x#, Coef#())

DEFDBL A-Z

FUNCTION dPdx (x, Coef())

P = 0

FOR j% = UBOUND(Coef) TO 2 STEP -1

dP = (dP + j% * Coef(j%)) * x

NEXT

dPdx = dP + Coef(1)

END FUNCTION

FUNCTION PofX (x, Coef())

P = 0

FOR j% = UBOUND(Coef) TO 1 STEP -1

P = (P + Coef(j%)) * x

NEXT

PofX = P + Coef(0)

END FUNCTION

Thank you for participating Xhantt and Agamemnus. Excellent work.

By the way, Xhantt suggested passing the order of the polynomial as a parameter, rather than using UBOUND. He was right. Passing the parameter saves about 3 or 4 tenths of a second off all times. If you are really trying to optimize, don't use UBOUND.