Find the expression of the annual fraction of the Python ignition equation, sqrt (2)

Asked 2 years ago, Updated 2 years ago, 17 views

I'd like to write a code to get the circled a0, a1, a2... and a50.

i=0
for i in range(51):
     j=i+1
    xj=1/(xi-ai)
    aj=int(xi)
    print (aj)

I thought we could do it roughly like this, but it's not possible. Masters, please help me.

python

2022-09-20 10:18

1 Answers

>>> b = [ 2**.5 ]
>>> a = []
>>> a
[]
>>> b
[1.4142135623730951]
>>> for n in range(51):
    aa = int(b[n])
    a.append(aa)
    bb = 1/(b[n] - aa)
    b.append(bb)


>>> a
[1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
 2, 1, 1, 1, 3, 3, 1, 3, 1, 1, 
 2, 1809, 1, 2, 5, 2, 2, 1, 2, 1, 
 3, 3, 4, 1, 1, 3, 12, 2, 2, 10, 
32]

Put the beta n in the question in a list named b so that b[0], b[1], b[2], etc. are beta0, beta1, beta2, etc., and similarly put the alpha n in a list named a[0], a[1], a[2] etc. represent alpha0, alpha1, and alpha2.

The value of the a list obtained in this way is the same as the result above.

However, this result differs from the annual fraction ([1:2,2,2,2,2...]) of sqrt(2). 1.414 not exactly sqrt(2)... Because we used an approximate value, we go back and get a value other than 2.

In the given formula, b0! = b1 but b1 == b2. Since the equation for obtaining b3 from b2 is the same as the equation for obtaining b2 from b1, b1 == b2 == b3 == b4 == ... You can see that it is. So the annual fraction of sqrt (2) can be obtained without a complex equation.

If you want to find the exact value of the annual fraction through formulas and operations... You need to think about it a little more.


2022-09-20 10:18

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.