It outputted that is not pi. How to fix?
THIS IS PYTHON
import math
a_one = (23 + 4 * math.sqrt(34))
a = 1 / 2 * a_one
b_one = (19 * math.sqrt(2) + 7 * math.sqrt(17))
b = 1 / 2 * b_one
c = (429 + 304 * math.sqrt(2))
d_one = (627 + 442 * math.sqrt(2))
d = 1 / 2 * d_one
u = (a + (math.sqrt(a**2 - 1))**2) * (b + (math.sqrt(b**2 - 1))**2) * (c + (math.sqrt(c**2 - 1))**2) * (d + (math.sqrt(d**2 - 1)))
pi = (math.log((2 * u)**6 + 24) / math.sqrt(3502))
print(pi)
output=3.4829888487915346
input code and output
math stuff from wikipedia
I tried chatgpt for help, it also got the wrong result.
>Solution :
There’s a few mistakes in your u.
u = (a + (math.sqrt(a**2 - 1))**2) * (b + (math.sqrt(b**2 - 1))**2) * (c + (math.sqrt(c**2 - 1))**2) * (d + (math.sqrt(d**2 - 1)))
should be
u = ((a + math.sqrt(a**2 - 1))**2) * ((b + (math.sqrt(b**2 - 1)))**2) * (c + (math.sqrt(c**2 - 1))) * (d + (math.sqrt(d**2 - 1)))
The issue is that you squared the squareroot instead of the whole part between brackets for the equation with a and b. Also, you have a square at c, which should not be there.
I tested it out and running it with the new u gives 3.141592653589793 as the answer.