What are you looking for?
Featured Topics
Select a topic to start reading.
okay so first see this python code
"""
#STEP 1
x = 2
tol = 10**-5
ln15 = 0.40546511
n = 2
#STEP2
def pn(n,x):
sum = 0
for i in range(1,n+1):
sum = sum + (((-1)**(i+1))/i)*(x-1)**i
return sum
#STEP3
diff = abs(pn(n,2) - np.log(2))
while diff > 0.01:
n = n+1
diff = abs(pn(n,2)-np.log(2))
print(n)
np.log(2) """"
so this simple code took me nearly six hours of hard work but there was the error and infinite loop kept occurring again and again I don't know why but I was writing it with this exact same algorithm and I kept writing it again and even I had the solution as well but it was not working and finally it worked after executing it and comparing it with the solution at each line.
Message:- Don't Give up keep trying and try to start from the scratch there is always something hidden that we don't see.
If you see a comment that is unsupportive or unfriendly, please report it using the flag button.
More Posts
-
I miss my childhood
I miss the time I spent during childhood. I want to turn back time and made some friends with other people. I want some daily random conversation between us. I...
-
Why is it so hard to pick a gift
I have this issue with gift picking. First of all, I always have thoughts like what if they don't really like what I gave. Of course they'd accept it gratefu...
Congrats on finding the solution
Replythanks
well I already had the solution of my friend and in my mind but for some reasons each time error or undesired result appeared and kept me trusfrated.
Reply