Hello Friends,
While Gearing up for my exam scheduled tommorow, I just came across Horner's Rule or the so called Horner's Algorithm for evaluating polynomials.

In this post, I want to share with you a MATLAB program which I wrote for implementing Horner's Algorithm.

You can read more about Horner's Rule here and for a concise explanation, you can also read this. Horner's Algorithm is basically an algorithm which reduces the computation time for evaluating polynomials of higher degree.

Basically, if you consider a polynomial of degree n, then it would take nearly n additions and (((n^2)+n)/2) multiplications, when solved using conventional old school methods. But using Horner's Algorithm, we can achieve it using n additions and n multiplications, which would greatly reduce computation time. These kinds of algorithms can be best utilized in Electronics in VLSI Architecture related research work.

The short and simple MATLAB program is given below:

``````
%Horner's Algorithm Implementation in MATLAB
%Programmed By: Amit Biswal
%URL: www.123mylist.com
clc
clear all
fprintf('\n------SOLVING POLYNOMIAL USING HORNERS RULE-------');
n=input('\nEnter the Degree of Polynomial');
fprintf('\nEnter the coefficients from Lowest degree to Highest');
for i = n:-1:0
fprintf('\na%d = ',i);
temp=input('');
a(i+1)=temp;
end
x=input('\nEnter the value of x');
p(n+1)=a(n+1);
for i = n:-1:1
p(i)=(p(i+1)*x) + a(i);
end