MinimalSquareRootΒΆ

qetasqrt.spad line 116 [edit on github]

MinimalSquareRoot provides (helper) functions to express a square root of an integer or rational number in terms of a n-th root of unity.

minimalRootOfUnityForSquareRootOf: Fraction Integer -> PositiveInteger

minimalRootOfUnityForSquareRootOf(z) returns an integer n such that in QQ(x) (where x is a primitive n-th root of unity) there exists an element y such that y^2=z.

minimalRootOfUnityForSquareRootOfRadicalInteger: Integer -> PositiveInteger

minimalRootOfUnityForSquareRootOfRadicalInteger(z) returns an integer n such that in ZZ(x) (where x is a primitive n-th root of unity) there exists an element y such that y^2=z. We assume that z is a radical integer, i.e. no square of a prime is a factor of z.

rationalSquareRoot: Fraction Integer -> Record(rat: Fraction Integer, radical: Integer)

if z = rationalSquareRoot(x) then x = (z.rat)^2 * z.radical and z.radical has no square of a prime as a divisor, i.e. it is a radical integer. z.radical can be negative.