Hello Astronomy

Automatic translation; Simplified Chinese is the reference text.

How to turn a long garden into a square step by step?

Keep the area unchanged, adjust the two sides, and see with your own eyes that "the more you guess, the more accurate you will be."

General Algorithms and Numerical Computing

You have 159 square meters of land and want to enclose it in a square shape. First, randomly determine one side, and then calculate the other side using "area ÷ side length". Two sides are not equal? Take their average and try again.

Open interactive lesson →

Guess first

If you want to turn a rectangle with a fixed area into a square, what should be the last two sides?

Show answer and explanation

Same length — If two adjacent sides of a square are equal, the area will still be the same number.

Then connect experience and science

Replace the unknown side length with a guess

The blue dot is the guess x, the gray dot is 159/x. The two always add up to 159, which is often not a square.

Length × Width = x × (159/x) = 159

The two sides move closer to the middle

If one is too short, the other will be too long. Average them as the next guess for the side length.

xnew = (xold + 159/xold) / 2

Repeat the same rule

Change the number of corrections and observe that the two points gradually overlap. Different initial values ​​will affect the number of steps required, but will not change the positive square root of this problem.

12 → 12.625 → 12.6095297 → …

Revert to original problem check

Don’t just look at the last two numbers: square the current side length and see how far it is from 159.

Residual = x² − 159

Expand the calculation

xₙ₊₁ = (xₙ + N/xₙ)/2 rₙ = xₙ² − N

N=159; start from positive numbers. Calculate N/x first, then average it with the old x. The residual is close to zero, which means the square is close to the target, which does not mean that all digits are accurate.

give it a try

Change the initial value from 12 to 1 and gradually increase the number of corrections. Have you achieved the accuracy you want in six steps?

Take a look at it →

No need to memorize symbols

x
Current positive side length guess
159/x
The other side of the rectangle is guaranteed to have an area of ​​159
residual
The remaining difference after substituting the candidate answers back into the original equation

Algorithm, accuracy and scope of application

Chapter 5 Example 5.a, printed page 48. Only the iteration of positive square roots is demonstrated here, and it cannot be concluded that any iteration converges. The initial value is limited to positive, and a maximum of six steps can be displayed. "The number of steps used up" is not called "reaching accuracy". Independent verification uses bipartite root finding, book stepwise values, and residuals; AA+'s AAKepler is another iterative application, but not implemented in this example.

my understanding check

Has the garden area changed after each adjustment?

No, still 159 — The other side always divides the first side by 159, so the area always remains.

The two sides are 12 and 13.25, what is the average?

12.625 — Add the two numbers and divide by 2.

If it looks like a square, can every decimal place be correct?

No, you need to check the error — Graphs only help to establish intuition; sufficiently fine-grained results should be checked using the difference between the two sides or the substitution equation.

Try an answer first, correct it with the rules, and then check the results; this is the intuition of "successive approximation."

Jean Meeus · Astronomical Algorithms, 2nd ed. · No. 5 chapter

General Algorithms and Numerical Computing · All interactive courses