No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
Ok, I am writing a program to find the root of f(x)= x - cos(x) using Newton-Raphson method. I implemented a loop and have calculated the root with no problems. However I want to break the loop when the difference between iterations = 10^-8. how exactly can I do this. … |
|
I recently wrote a program to determine perfect numbers..... [CODE]n=raw_input("Please input a number: ") factors = [] p=int(n) for k in range(1): x=0 while x < p-(p/3): x=x+1 z = p/x if p%z == 0: factors.append(z) if factors.count(z) > 1: factors.remove(z) print "The factors are,", factors print "the sum of … |
|
Hi, Am a beginner in python. Wrote this program based on the doomsday algorithm to calculate what day of the week corresponds to an inputted date.... at the moment idle rejects the program citing'march4 is not defined'.(line 23) Am i not clearly defining it there?? Please help!! Program text: #Doomsday … |