fork download
  1. n=input('Enter n- ');
  2. x=zeros(1,n);
  3. fx=zeros(1,n);
  4. for i=1:n
  5. x(i)=input('enter x- ');
  6. fx(i)=input('enter fx- ');
  7. end;
  8. X=input('enter X for which we want fX- ');
  9. table=zeros(n,n);
  10. table(:,1)=fx;
  11. for j=2:n
  12. for i=j:n
  13. table(i,j)=table(i,j-1)-table(i-1,j-1);
  14. end;
  15. end;
  16. u=(X-x(n))/(x(2)-x(1));
  17. result=table(n,1);
  18. for i=2:n
  19. term=1;
  20. term=term*table(n,i);
  21. term=term/factorial(i-1);
  22. us=u;
  23. if(i>2)
  24. for j=1:i-2
  25. us=us*(u+j);
  26. end;
  27. end;
  28. term=term*us;
  29. result=result+term;
  30. end;
  31. fprintf('the value of fX for X is- %f',result);
Success #stdin #stdout #stderr 0.12s 47780KB
stdin
Standard input is empty
stdout
Enter n- 
stderr
error: input: reading user-input failed!
error: called from
    /home/xIgiSe/prog.octave at line 1 column 2