When evaluating a polynomial function (1) in a computer program, the naivest way usually result in more computation complexcity.
In order to speed up the process, Horner's scheme were used.
Rather than direct evaluating (1), Horner's scheme change (1) into (2) which can give the same result but a more efficient way.
Naive way of evaluating polynomail requires at most additions and multiplications while Horner's scheme only require additions and multiplications.
Following program first computing the coefficient , then I generate a random number using subroutine RANDOM_NUMBER. Finally, I use another intrinsic function
CPU_TIME to measure time it takes for two different approach to evaluating the polynomial ( times).
I calculate the time it takes for both method to preform times, and divide the time it takes using naive method by the time of evaluating using Horner's method. Naive way cost roughly 7 times longer to calculate in this particular example than Horner's method did.
For meausering the accuracy, I evaluating (3) from to using two method. But it seems that the accuracy are roughly the same in this particular example.