Friday, January 25, 2013

Procedure to Evaluate the Polynomial

Procedure for Polynomial Evaluation

Vector = array[1 .. 40] of integer;
Procedure PolyEval(A : Vector; X : Integer; Sum :real)
     i: Integer;
begin
   Sum=0; i=2;
   while (i<=2*A[1])
   begin
      Sum=sum+ A[i+1]* exp(A[i] * LN(X));
      I=i+2;
   end
end


  

Program to Polynomial Evaluation

Vector = array[1 .. 40] of integer;
program PolynomialEval()
     i: Integer;
     s: real;
begin
  write(“enter the polynomial”);
  read A[1];
  for i= 2 to 2*A[1]
   read a[i];
write(“enter X value’);
read(x);
PolyEval(A,x,S);
write(“result is “, s);
end

No comments:

Post a Comment