Description
Returns the principal unit of the real quadratic number field
sqrt (n)
where n is an integer,
i.e., the element whose norm is unity.
This amounts to solving Pell's equation a^2 - n b^2 = 1
.
(%i1) qunit (17);
(%o1) sqrt(17) + 4
(%i2) expand (% * (sqrt(17) - 4));
(%o2) 1