0
Need help with this programme( sum of series )
Find the sum of the series:- x^2+ x^4/3!+ x^6/5!+..... x^2n/ (2n-1)! I used a nested for loop for this. First i declared f= 1 for the factorial and then i declared sum=0. My for statements were like this. for i in range(1,n+1): for j in range(1,2*i): f*=j sum+=x**2*i/f But I'm getting the wrong output every time. What correction should I make in my code? Please reply ASAP
5 Réponses
+ 1
I guess you have to reset f after your iterarion? :) After adding your element to the sum you should write f=1
+ 1
All right. Thank you!
0
Use recursion and for reducing time complexity you can also use Horner's rule
0
I don't know what that is. I'm a beginner in Python. Can you please explain?
0
when a function calls itself then it's recursion. And you must learn it because you can solve any complex problem very easily