On 17/02/2026 04:57, Waldek Hebisch wrote:
I recently met the problem:
: Let t := (5/9)*%pi. Simplify tan(t) + 4*sin(t)
The solution using FriCAS can be as follows. First, we want to
express this in terms of complex exponentials. Since (5/9)*%pi is
a rational multiple of %pi we get root of 1, in this case root of
degree 18. But we also need %i, which leads to root of degree 36.
Corresponding field is extention by cyclotomic polynomial, so
we build it:
cyclotomic(36)$CyclotomicUtilities
cF := SAE(FRAC(INT), SUP(FRAC(INT)), %)
Now, we can express all ingredients in terms of generator:
et := (generator()$cF)^10
ct := (et + 1/et)/2
st := (et - 1/et)/(2*(generator()$cF)^9)
and our expression is:
(4*ct + 1)*st/ct
9 3
(41) ? - 2 ?
Type:
SimpleAlgebraicExtension(Fraction(Integer),SparseUnivariatePolynomial(Fraction(Integer)),?^12+(-(?^6))+1)
Now we can find minimal polynomial:
(68) -> minimalPolynomial(%)
2
(68) ? - 3
Type: SparseUnivariatePolynomial(Fraction(Integer))
and we see that the result is sqrt(3). We could also observe that
the expression above is a member of smaller cyclotomic field and from
that infer expression 2*cos(%pi/6).
A clever approach indeed.
I wonder how much of this is worth automating. Recognizing explicit
rational multiples of %pi is easy. From that we can infer appropriate
cyclotomic field, which may be unconfortably large, but is easy to
find. Inside cyclotomic field we get canonical form and can compute
minimal polynomial. So we can recognize when the result is say a square
root. Belonging to smaller field is easy too: we know Galois group
and can check if element is invariant. So we can find expression
in terms of smaller angles.
I think the theory is obvious (Trigonometric numbers ~ AlgebraicNumber)
https://en.wikipedia.org/wiki/Exact_trigonometric_values
so I tried for fun:
r:=rootsOf(z^36-1)
ct:=(r.10+1/r.10)/2
st:=(r.10-1/r.10)/(2*r.9)
xx:= (4*ct + 1)*st/ct
>> Error detected within library code:
univariate: denominator is 0 mod p
Somehow strange? When using %i instead of r.9, in st, it doesn't
complain. I'm suspecting ratDenom in AlgebraicManipulations which
handles division in AlgebraicNumber.
There is question how much coverage we get this way. That is,
are there useful simplifications that are missed by approach above?
And how frequently simplifications of that kind are applicable?
Opinions? Anybody wants to make a package based on this?
Well, nice to have but surely not a must. I guess you could provide one
in a wink of an eye (if time allows :)
BTW: if arguments to trigonometric functions are _not_ a rational
multiple of %pi, then 'normalize' is quite good at finding canonical
form, but frequently it is different from what users want.
--
You received this message because you are subscribed to the Google Groups "FriCAS -
computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/fricas-devel/5700f5e4-5711-4e83-8f18-f19a0143dc57%40gmail.com.