AlgebraicNumberTool¶
antool.spad line 89 [edit on github]
AlgebraicNumberTool provides functions to find better/easier representations of algebraic numbers. We try to guarantee that the value of the input algebraic number equals to the output algebraic number within the precision of Float.
- approximateNestedRadical: (AlgebraicNumber, Fraction Integer) -> AInterval Fraction Integer
- approximateNestedRadical(x,eps)returns an interval iv with width(iv)<=eps such that contains?(iv,x::Float) (where Float is taken with enough precision. Input condition:- xis a nested radicals with each expression under an nthRoot being positive. If the input condition is not fulfilled then sup(iv)- <0.
- approximateNthRoot: (AlgebraicNumber, PositiveInteger, Fraction Integer) -> AInterval Fraction Integer
- approximateNthRoot(x,n,eps)returns a positive interval iv such that width(iv)<=eps and contains?(iv,nthRoot(x::Float,- n)) where Float is set with enough precision. Input condition:- xis a nested radicals with each expression under an nthRoot being positive. If the input condition is not fulfilled then the error interval [0,- -1] is returned.
- combineCommonSqrt: AlgebraicNumber -> AlgebraicNumber
- combineCommonSqrt(x)finds expressions of the form (a*sqrt(- r)- +b)*sqrt(u*sqrt(- r)- +v) and combines it to s*sqrt((a*sqrt(- r)- +b)^2*sqrt(u*sqrt(- r)- +v)) where- sis a compensating factor to make both expression have the same complex value when taking the branch cut along the negative real axes.
combineIntegerRoot?: (AlgebraicNumber, AlgebraicNumber) -> Boolean
combinePositiveIntegerRoot?: (AlgebraicNumber, AlgebraicNumber) -> Boolean
combineSameRoot?: (AlgebraicNumber, AlgebraicNumber) -> Boolean
- combineSqrtFactors: List AlgebraicNumber -> AlgebraicNumber
- combineSqrtFactors(l)forms the product over all elements of the list- l, but combines factors of the form (a*sqrt(- b)+c*sqrt(- d)) (that may appear with a sqrt in front of such an expression. Only factors with the same- band- dare combined. We ensure that the resulting expression gives the same complex value as the product of the list elements.
- complexValue: AlgebraicNumber -> Complex Float
- complexValue(x)converts the algebraic number- xinto a complex floating point representation with the currently set precision.
- integerRootFactor: AlgebraicNumber -> AlgebraicNumber
- integerRootFactor(x)factors any expression in- xof the form nthRoot(- z,- n) where- zis an integer into the product of nthRoot(- f,- n) for all factors- fof- z. This does not change the value of- x.
integerRootFactorK: Kernel AlgebraicNumber -> AlgebraicNumber
integerRootKernel?: Kernel AlgebraicNumber -> Boolean
integerRootKernels: List Kernel AlgebraicNumber -> List Kernel AlgebraicNumber
- isSqrt: AlgebraicNumber -> Union(AlgebraicNumber, failed)
- isSqrt(x)returns- zif x=nthRoot(- z,2) and failed otherwise.
mapOverFactors: (SparseMultivariatePolynomial(Integer, Kernel AlgebraicNumber), BasicOperator, PositiveInteger) -> AlgebraicNumber
- recursiveRootSimplification: AlgebraicNumber -> AlgebraicNumber
- recursiveRootSimplification(x)applies rsimp from the leaves of the expression to the top of the expression tree. If rsimp(- z) returns “failed” for a subexpression,- zis used for further computation.
recursiveRootSimplificationPoly: SparseMultivariatePolynomial(Integer, Kernel AlgebraicNumber) -> AlgebraicNumber
rootCombine: (AlgebraicNumber, (AlgebraicNumber, AlgebraicNumber) -> Boolean) -> AlgebraicNumber
- rootFactor: AlgebraicNumber -> AlgebraicNumber
- rootFactor(x)factors expressions under the root kernels and returns factors of roots. It multiplies a certain compensating root of unity such that the value of the input agrees with that of the output taking into account that the branch cut of the root is the negative real axix.
rootFactorK: (List Kernel AlgebraicNumber, List AlgebraicNumber, Kernel AlgebraicNumber) -> AlgebraicNumber
rootFactorPol: (SparseMultivariatePolynomial(Integer, Kernel AlgebraicNumber), BasicOperator, PositiveInteger) -> AlgebraicNumber
- simpler?: (AlgebraicNumber, AlgebraicNumber) -> Boolean
- simpler?(x,y)is- trueif- xhas a “simpler” structure than- y. We neglect the denominator (which is supposed to be an integer). It is- trueif- xand- yare integers and- x<- y;- trueif- xis an integer and- ya polynomial;- falseif- yis an integer and- xa polynomial;- trueif- xhas less variables than- y;- falseif- yhas less variables than- x;- falseif- x(or- y) has more than 1 term;- trueif- xhas less variables than- y;- falseif- yhas less variables than- x; nx<ny if- xand- yare- n-th root expression and nx~=ny; simpler?(argument(- x),argument(- y)).
- simplifyRadicals: AlgebraicNumber -> AlgebraicNumber
- simplifyRadicals(x)applies recursiveRootSimplification to- xand some other transformations to make the radical more “canonical”.
- sqrtArgument: Kernel AlgebraicNumber -> Integer
- sqrtArgument(k)returns- zif- kis nthRoot(- z,2) for some integer- zand 0 if that is not the case.
- sqrtSum: AlgebraicNumber -> List List Integer
- sqrtSum(x)returns a list of pairs [- ai,- ci] if- xis of the form $sum_{- i=1}- ^nci*sqrt(- ai)$ with- ci~=0and ai<aj if i<j. We expect the denominator to be an integer and only consider the numerator. The returned list is empty, if- xis not of the above form, it is [[numer(- x),1]] if- xis rational.
- sqrtSumArguments: AlgebraicNumber -> List Integer
- sqrtSumArguments(x)returns a list of the- aiif- xis of the form $sum_{- i=1}- ^nci*sqrt(- ai)$ with- ci~=0, (- ai=1for at most one- i) and ai<aj if i<j. We expect the denominator to be an integer and only consider the numerator. The returned list is empty, if- xis not of the above form, it is [1] if- xis rational.