Return to taylor CVS log | Up to [local] / OpenXM / src / asir-contrib / packages / sample |
1.1 ! tam 1: def taylor(F,X,P,N){ ! 2: R = 0; ! 3: A = F; ! 4: ! 5: for(I=0;I<N;I++){ ! 6: if(I!=0){ ! 7: A /= I; ! 8: } ! 9: R += subst(A,X,P) * x^I; ! 10: A = diff(A,X); ! 11: } ! 12: return R; ! 13: } ! 14: ! 15: taylor(1/(1-x),x,0,20); ! 16: quit;