Horner Functions 

Horner Functions SupportThe Fractal Science Kit fractal generator Horner functions apply Horner's scheme to evaluate a polynomial expression defined by 1 or more coefficient arrays. Complex Horner.EvaluatePolynomial( \ Horner.EvaluatePolynomial applies Horner's scheme to evaluate a polynomial expression defined by the coefficients in the coef[] array at the value z. Horner.EvaluatePolynomialDerivative returns the value of the derivative of the function. Horner.EvaluatePolynomialAndDerivative returns both the polynomial expression value and its derivative. The values are returned in the array result[] which must be dimensioned 2. result[0] is the value of the polynomial and result[1] is the value of the derivative both evaluated at the point z. The number of elements in the coef[] array defines the degree of the polynomial (e.g., a 4^{th} degree polynomial would have 5 values) and any terms missing in the equation must have a 0 coefficient. The coefficients are ordered from high to low in the array; i.e., the coefficient associated with the term with the highest degree is in the array at index 0. Example: comment: This fractal equation defines the coefficients of the equation in an array called coef[] and simply calls Horner.EvaluatePolynomial to apply Horner's method to evaluate the polynomial at the value z. The degree of the polynomial is 4 since the number of elements in the array is 5. Notice how we set coef[4]=c if we are processing a Mandelbrot fractal. This is required for Mandelbrot fractals since c is initialized to the pixel location just prior to calling the initialize section so the assignment in the global section is not correct with respect to coef[4]. This is not required for Julia fractals since c is set to the Julia Constant before the program runs and is never changed. We could move the initialization of the coef[] array out of the global section and into the initialize section to avoid this complexity and thereby simplify the code but this would be less efficient since the inititialize section is executed at the beginning of every iteration while the global section is executed once during program compilation. In fact, since IsJulia is a constant, the compiler will evaluate the if statement during Program Optimization and remove the entire if block for Julia fractals, and at runtime, the initialize section is not even executed! Complex Horner.EvaluatePolynomialQuotient( \ Horner.EvaluatePolynomialQuotient returns the quotient of 2 polynomials. Horner's scheme is applied to the coefficient arrays coef0[] and coef1[] to evaluate the associated polynomials at the point z and the quotient of the resulting values is returned. Horner.EvaluatePolynomialQuotientDerivative returns the value of the derivative of the function. Horner.EvaluatePolynomialQuotientAndDerivative returns both the polynomial quotient and its derivative. The values are returned in the array result[] which must be dimensioned 2. result[0] is the value of the polynomial quotient and result[1] is the value of the derivative both evaluated at the point z. For details see: From Wikipedia, the free encyclopedia. 
Copyright © 20042016 Hilbert, LLC 