python (65.2k questions)
javascript (44.3k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (13k questions)
Continued fraction for pi in Python
I'm trying to approximate pi using continued fraction.
I'm using this formula.
After many hours, I ended up here.
for i in range(1,15,1):
e = ((2*i - 1) ** 2)
b = (e / (6 + ((2*(i+1) - 1) ** ...
user18701301
Votes: 0
Answers: 2
How can I use the Approximate algorithm in this problem?
Imagine that a needle in the speedometer, which shows the speed, has
fallen off.
It was reattached, but not at the right angle. So, although the
speedometer showed the value of the current speed v, i...
redflag
Votes: 0
Answers: 1
Sorting based on fuzzy criteria OR Create an acceptable order with only n comparisons
I'm looking for an algorithm to sort a large number of items using the fewest comparisons. My specific case makes it unclear which of the obvious approaches is appropriate: the comparison function is ...

Salvatore Ambulando
Votes: 0
Answers: 0
How can I improve this python code approximating pi?
My way of calculating pi is:
import math
a = 2
n = int(input('number:'))
for i in range(n):
a = 2 - math.sqrt(4-a)
print((2**(i+2))*math.sqrt(a))
If this worked well, the printout would have...
Mango Mochi
Votes: 0
Answers: 1