@@ -14,15 +14,15 @@ def taylorexpansion(func, a, n, var):
1414 k = 1
1515 while (k < n ):
1616 d = diff (d , var )
17- term = (d * ((t_y - a ) ** k ))/ factorial (k )
17+ term = (d * ((t_y - a ) ** k )) / factorial (k )
1818 term = term .subs (var , a )
1919 if (term == 0 ):
2020 continue
2121 term = term .subs (t_y , var )
22- expansion = term + expansion
22+ expansion = term + expansion
2323 k += 1
2424 if (d == 0 and k < n ):
25- print ("only " , k - 1 , " terms present" )
25+ print ("only " , k - 1 , " terms present" )
2626 if (n < 1 ):
2727 print ("3rd argument is for no. of terms, provide a natural number" )
2828 return ''
@@ -54,16 +54,16 @@ def examples():
5454 print (taylorvalue (exp (x ), 1 , 10 , x ))
5555
5656 # log(1+x) expansion at x=0 with 5 terms differentiating with respect to x
57- pprint (taylorexpansion (log (x + 1 ), 0 , 5 , x ))
57+ pprint (taylorexpansion (log (x + 1 ), 0 , 5 , x ))
5858
5959 # sin(x) expansion at x=0 with 5 terms differentiating with respect to x
6060 pprint (taylorexpansion (sin (x ), 0 , 5 , x ))
6161
6262 # expansion for expression at x=0 with 3 terms differentiating wrt to x
63- pprint (taylorexpansion ((5 * x ** 2 ) + ( 3 * x ) + (7 ), 0 , 3 , x ))
63+ pprint (taylorexpansion ((5 * x ** 2 ) + ( 3 * x ) + (7 ), 0 , 3 , x ))
6464
6565 # e^(xy) expansion at x=1 with 5 terms differentiating with respect to x
66- pprint (taylorexpansion (exp (x * y ), 1 , 5 , x ))
66+ pprint (taylorexpansion (exp (x * y ), 1 , 5 , x ))
6767
6868
6969examples ()
0 commit comments