Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Do not import any Python packages such as math or numpy to complete this assignm

ID: 3875898 • Letter: D

Question

Do not import any Python packages such as math or numpy to complete this assignment. These questions require only the standard Python library. Solutions will be given 0 if any

Python package/module is used.

My answer is as follow, but it does not work. Can you please tell me what is wrong with that? And I appreciate a full solution in Jupyter of this question a lot. (without packages)

2. Write a function called k_sum which takes an input parameter N and returns the sum (-1)k+1 (2k-1)3 As N oo, the infinite series satisfies the beautiful identity k=1 for some integer M. Find M and explain your method.

Explanation / Answer

def k_sum(N):
res=0
for i in range(1,N):
res=res+((-1)**(i+1))/((2*i-1)**3)
return res

print(k_sum(10))

This is the correct code for this question. What you were doing wrong is the syntax in denominator_terms, It should be (2*k-1)**3 where ** means raised to the power. The rest, I didn't understand at all, but this question is very simple with a for loop. When you copy the code remember to indent properly. return res is out of the for loop.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote