# Calculation of the golden ratio with Maxima

Euclid defined the golden section or golden ratio in the following way:

Split a segment into two unequal parts such that the ratio between the total length of the segment and the major division is equal to the ratio between the major division and the minor division.

Therefore:

|-------------------------|-----------------|
<----------- x ----------><-------- y ------>
<---------------------- a ------------------>

$$\frac{a}{x}=\frac{x}{y}$$

This ratio represents the numerical value of the golden ratio. The other condition we need to carry out the calculation, in order to have two equations with two unknowns is

$$x+y=a$$

We calculate it with Maxima:

(%i1) solve([a/x = x/y, x + y = a], [x, y]);
(SQRT(5) + 1) a      (SQRT(5) + 3) a
(%o1) [[x = - ---------------, y = ---------------],
2                    2

(SQRT(5) - 1) a        (SQRT(5) - 3) a
[x = ---------------, y = - ---------------]]
2                      2

(%i2) float(%);
(%o2) [[x = - 1.618033988749895 a, y = 2.618033988749895 a],
[x = 0.61803398874989 a, y = 0.38196601125011 a]]

(%i3) x:0.61803398874989 * a;
(%o3)                         0.61803398874989 a

(%i4) y:0.38196601125011 * a;
(%o4)                         0.38196601125011 a

(%i5) x/y;
(%o5)                          1.618033988749862

Which is the value of the golden ratio, equal to 1.618033988749862