Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

radicalSolve() in FriCAS is pathetic

125 views
Skip to first unread message

nob...@nowhere.invalid

unread,
Nov 30, 2023, 6:36:19 AM11/30/23
to

Oh dear! In FriCAS 1.3.9 try:

radicalSolve(64*z^4 + 64*z^3 + 32*z^2 - 8*z + 1)

and then try:

ii := rootOf(ii^2+1)
factor(64*z^4 + 64*z^3 + 32*z^2 - 8*z + 1, [ii])

to see what is wrong with radicalSolve(). (The integer quartic splits
into gaussian-integer quadratics.)

Also, unparse() in FriCAS refuses to convert the result from
radicalSolve() of the type List(Equation(Expression(Integer))) back
to InputForm. Why shouldn't this be be allowed?!? (The prettyprinted
ASCII monster is appended below.)

Derive 6.10 factors the integer polynomial right away as:

FACTOR(64*z^4 + 64*z^3 + 32*z^2 - 8*z + 1, Complex)
= 64*(z - SQRT(2)/4 + 1/4 + #i*(1/4 - SQRT(2)/4))
*(z + SQRT(2)/4 + 1/4 + #i*(SQRT(2)/4 + 1/4))
*(z + SQRT(2)/4 + 1/4 - #i*(SQRT(2)/4 + 1/4))
*(z - SQRT(2)/4 + 1/4 + #i*(SQRT(2)/4 - 1/4))

This polynomial arises in integral 5.66 (#401) from the Timofeev test
suite:

INT(TAN(x)/(SQRT(TAN(x)) - 1)^2, x)
= - x/2 + 1/(1 - SQRT(TAN(x))) + 1/2*LN(COS(x))
+ LN(1 - SQRT(TAN(x)))
+ 1/SQRT(2)*LN((1 + TAN(x) + SQRT(2)*SQRT(TAN(x)))/SEC(x))
- 1/SQRT(2)*ATAN(1 + SQRT(2)*SQRT(TAN(x)))
+ 1/SQRT(2)*ATAN(1 - SQRT(2)*SQRT(TAN(x)))
= - x/2 + 1/(1 - SQRT(TAN(x))) + 1/2*LN(COS(x))
+ LN(1 - SQRT(TAN(x)))
+ 1/SQRT(2)*ATANH((1 + TAN(x))/(SQRT(2)*SQRT(TAN(x))))
- 1/SQRT(2)*ATAN(1 + SQRT(2)*SQRT(TAN(x)))
+ 1/SQRT(2)*ATAN(1 - SQRT(2)*SQRT(TAN(x)))

which was discussed in the <sci.math.symbolic> thread
"Boooooooooooooooooooooooooo" from April to June 2016. Note that the
one and only radical extension needed to express the antiderivative is
SQRT(2).

No doubt, radicalSolve() in FriCAS needs to be overhauled.

Martin.

PS: The result from radicalSolve(64*z^4 + 64*z^3 + 32*z^2 - 8*z + 1) in
FriCAS 1.3.9 is:

[
z
=
-
+--+
\|13
*
ROOT
+------------------+2
+-+ +---+ 3| +---+ +-+
(68 \|3 - 18 \|- 1 )\|18 \|- 1 \|3 + 35
+
+------------------+
+-+ +---+ 3| +---+
+-+ +-+
(208 \|3 - 234 \|- 1 )\|18 \|- 1 \|3 + 35 -
676 \|3
*
ROOT
+------------------+2
+---+ +-+ 3| +---+ +-+
(- 18 \|- 1 \|3 + 35)\|18 \|- 1 \|3 + 35
+
+------------------+
3| +---+ +-+
169 \|18 \|- 1 \|3 + 35 - 169
+
+------------------+2
+---+ +-+ 3| +---+ +-+
(702 \|- 1 \|3 - 1365)\|18 \|- 1 \|3 + 35
+
+------------------+
3| +---+ +-+
- 6591 \|18 \|- 1 \|3 + 35 - 13182
+
+-+
13 \|3
*
ROOT
+------------------+2
+---+ +-+ 3| +---+ +-+
(- 18 \|- 1 \|3 + 35)\|18 \|- 1 \|3 + 35
+
+------------------+
3| +---+ +-+
169 \|18 \|- 1 \|3 + 35 - 169
+
- 507
/
2028
,

z
=
+--+
\|13
*
ROOT
+------------------+2
+-+ +---+ 3| +---+ +-+
(68 \|3 - 18 \|- 1 )\|18 \|- 1 \|3 + 35
+
+------------------+
+-+ +---+ 3| +---+
+-+ +-+
(208 \|3 - 234 \|- 1 )\|18 \|- 1 \|3 + 35 - 676
\|3
*
ROOT
+------------------+2
+---+ +-+ 3| +---+ +-+
(- 18 \|- 1 \|3 + 35)\|18 \|- 1 \|3 + 35
+
+------------------+
3| +---+ +-+
169 \|18 \|- 1 \|3 + 35 - 169
+
+------------------+2
+---+ +-+ 3| +---+ +-+
(702 \|- 1 \|3 - 1365)\|18 \|- 1 \|3 + 35
+
+------------------+
3| +---+ +-+
- 6591 \|18 \|- 1 \|3 + 35 - 13182
+
+-+
13 \|3
*
ROOT
+------------------+2
+---+ +-+ 3| +---+ +-+
(- 18 \|- 1 \|3 + 35)\|18 \|- 1 \|3 + 35
+
+------------------+
3| +---+ +-+
169 \|18 \|- 1 \|3 + 35 - 169
+
- 507
/
2028
,

z
=
-
+--+
\|13
*
ROOT
+------------------+2
+-+ +---+ 3| +---+ +-+
(- 68 \|3 + 18 \|- 1 )\|18 \|- 1 \|3 + 35
+
+------------------+
+-+ +---+ 3| +---+
+-+ +-+
(- 208 \|3 + 234 \|- 1 )\|18 \|- 1 \|3 + 35 +
676 \|3
*
ROOT
+------------------+2
+---+ +-+ 3| +---+ +-+
(- 18 \|- 1 \|3 + 35)\|18 \|- 1 \|3 + 35
+
+------------------+
3| +---+ +-+
169 \|18 \|- 1 \|3 + 35 - 169
+
+------------------+2
+---+ +-+ 3| +---+ +-+
(702 \|- 1 \|3 - 1365)\|18 \|- 1 \|3 + 35
+
+------------------+
3| +---+ +-+
- 6591 \|18 \|- 1 \|3 + 35 - 13182
+
-
+-+
13 \|3
*
ROOT
+------------------+2
+---+ +-+ 3| +---+ +-+
(- 18 \|- 1 \|3 + 35)\|18 \|- 1 \|3 + 35
+
+------------------+
3| +---+ +-+
169 \|18 \|- 1 \|3 + 35 - 169
+
- 507
/
2028
,

z
=
+--+
\|13
*
ROOT
+------------------+2
+-+ +---+ 3| +---+ +-+
(- 68 \|3 + 18 \|- 1 )\|18 \|- 1 \|3 + 35
+
+------------------+
+-+ +---+ 3| +---+
+-+ +-+
(- 208 \|3 + 234 \|- 1 )\|18 \|- 1 \|3 + 35 +
676 \|3
*
ROOT
+------------------+2
+---+ +-+ 3| +---+ +-+
(- 18 \|- 1 \|3 + 35)\|18 \|- 1 \|3 + 35
+
+------------------+
3| +---+ +-+
169 \|18 \|- 1 \|3 + 35 - 169
+
+------------------+2
+---+ +-+ 3| +---+ +-+
(702 \|- 1 \|3 - 1365)\|18 \|- 1 \|3 + 35
+
+------------------+
3| +---+ +-+
- 6591 \|18 \|- 1 \|3 + 35 - 13182
+
-
+-+
13 \|3
*
ROOT
+------------------+2
+---+ +-+ 3| +---+ +-+
(- 18 \|- 1 \|3 + 35)\|18 \|- 1 \|3 + 35
+
+------------------+
3| +---+ +-+
169 \|18 \|- 1 \|3 + 35 - 169
+
- 507
/
2028
]

Type: List(Equation(Expression(Integer)))

Sam Blake

unread,
Nov 30, 2023, 4:02:51 PM11/30/23
to
Unrelated to your factorisation issue in FriCAS, but this factors nicely into two quadratics in Mathematica with the extension Sqrt[2]

In[2096]:= Factor[64*z^4 + 64*z^3 + 32*z^2 - 8*z + 1, Extension -> Sqrt[2]]

Out[2096]= -((-3 + 2 Sqrt[2] + (-4 + 4 Sqrt[2]) z - 8 z^2) (3 + 2 Sqrt[2] + (4 + 4 Sqrt[2]) z + 8 z^2))

A resource function I wrote recently (https://resources.wolframcloud.com/FunctionRepository/resources/IntegratePFD/) finds a nice form for the rational integral after the substitution u == Sqrt[Tan[x]]

In[2111]:= Eliminate[{Dt[y] == Tan[x]/(-1 + Sqrt[Tan[x]])^2 Dt[x],
u == Sqrt[Tan[x]], Dt[u == Sqrt[Tan[x]]]}, {x, Dt[x]}]
Solve[%, Dt[y]]

During evaluation of In[2111]:= Eliminate::ifun: Inverse functions are being used by Eliminate, so some solutions may not be found; use Reduce for complete solution information.

Out[2111]= -2 u^3 Dt[u] - 2 u Dt[y] + u^2 Dt[y] + u^4 Dt[y] -
2 u^5 Dt[y] + u^6 Dt[y] == -Dt[y]

Out[2112]= {{Dt[y] -> (2 u^3 Dt[u])/((-1 + u)^2 (1 + u^4))}}

In[2113]:= integratePFD = ResourceFunction["IntegratePFD"];

In[2114]:= integratePFD[(2 u^3)/((-1 + u)^2 (1 + u^4)), u]
% /. u -> Sqrt[Tan[x]]
D[%, x] - Tan[x]/(-1 + Sqrt[Tan[x]])^2 // Simplify

Out[2114]= 1/(
1 - u) + (1/2 + 1/Sqrt[2]) ArcTan[
1 - Sqrt[2] u] + (1/2 - 1/Sqrt[2]) ArcTan[1 + Sqrt[2] u] +
Log[-1 + u] + Log[1 - Sqrt[2] u + u^2]/(4 - 4 Sqrt[2]) +
1/4 (-1 + Sqrt[2]) Log[1 + Sqrt[2] u + u^2]

Out[2117]= (1/2 + 1/Sqrt[2]) ArcTan[
1 - Sqrt[2] Sqrt[Tan[x]]] + (1/2 - 1/Sqrt[2]) ArcTan[
1 + Sqrt[2] Sqrt[Tan[x]]] + Log[-1 + Sqrt[Tan[x]]] +
Log[1 - Sqrt[2] Sqrt[Tan[x]] + Tan[x]]/(4 - 4 Sqrt[2]) +
1/4 (-1 + Sqrt[2]) Log[1 + Sqrt[2] Sqrt[Tan[x]] + Tan[x]] + 1/(
1 - Sqrt[Tan[x]])

Out[2118]= 0



Richard Fateman

unread,
Nov 30, 2023, 5:11:32 PM11/30/23
to
in Maxima,
gfactor(64*z^4+64*z^3+32*z^2-8*z+1) produces
(8*z^2-4*%i*z+4*z+%i)*(8*z^2+4*%i*z+4*z-%i)

factor(64*z^4+64*z^3+32*z^2-8*z+1, s^2-2) produces
(8*z^2-4*s*z+4*z-2*s+3)*(8*z^2+4*s*z+4*z+2*s+3)



> > Oh dear! In FriCAS 1.3.9 try:
> >
> > radicalSolve(64*z^4 + 64*z^3 + 32*z^2 - 8*z + 1)
> >
<snip>

Валерий Заподовников

unread,
Dec 11, 2023, 9:11:33 PM12/11/23
to
Meh, at least you are solving degree 2 correctly. You do, right?

https://cnrs.hal.science/hal-04116310

nob...@nowhere.invalid

unread,
Dec 21, 2023, 12:16:29 PM12/21/23
to

"clicl...@freenet.de" schrieb:
According to old notes of mine, a simple way to split any suitable
quartic:

a + b*x + c*x^2 + d*x^3 + e*x^4

into quadratics is by factorizing its resolvent:

4*a*c*e - a*d^2 - b^2*e + e*(b*d - 4*a*e)*y - c*e^2*y^2 + e^3*y^3

and expressing the quadratics in terms of any one resolvent root y as:

1/(4*e)*(e*y - e*(d*y - 2*b)/SQRT(d^2 + 4*e*(e*y - c))
+ (d - SQRT(d^2 + 4*e*(e*y - c)))*x + 2*e*x^2)
*(e*y + e*(d*y - 2*b)/SQRT(d^2 + 4*e*(e*y - c))
+ (d + SQRT(d^2 + 4*e*(e*y - c)))*x + 2*e*x^2)

which applies if d^2 + 4*e*(e*y - c) /= 0 and doesn't involve a, or as:

1/(4*e)*(e*y - SQRT(e*(e*y^2 - 4*a))
+ (d - e*(d*y - 2*b)/SQRT(e*(e*y^2 - 4*a)))*x + 2*e*x^2)
*(e*y + SQRT(e*(e*y^2 - 4*a))
+ (d + e*(d*y - 2*b)/SQRT(e*(e*y^2 - 4*a)))*x + 2*e*x^2)

which applies if e*y^2 - 4*a /= 0 and doesn't involve c. For d^2 +
4*e*(e*y - c) = 0 one can use:

1/(4*e)*(e*y - SQRT(e*(e*y^2 - 4*a)) + d*x + 2*e*x^2)
*(e*y + SQRT(e*(e*y^2 - 4*a)) + d*x + 2*e*x^2)

while for e*y^2 - 4*a = 0 one finds:

1/(4*e)*(e*y + (d - SQRT(d^2 + 4*e*(e*y - c)))*x + 2*e*x^2)
*(e*y + (d + SQRT(d^2 + 4*e*(e*y - c)))*x + 2*e*x^2)

As no cube roots can appear, this way of splitting a quartic is
advantageous whenever its resolvent possesses at least one rational
root. Indeed, the resolvent of 64*z^4 + 64*z^3 + 32*z^2 - 8*z + 1
simply is:

(4*y - 3)*(4*y + 1)*y

Using all three resolvent roots in turn yields three different ways of
splitting the quartic; if the quartic is real, at least one pair of
factors is real as well.

Martin.

nob...@nowhere.invalid

unread,
Jan 11, 2024, 7:12:40 AMJan 11
to

"clicl...@freenet.de" schrieb:
In version 3.1.10 of FriCAS, unparse() can convert the result from
radicalSolve() of the type List(Equation(Expression(Integer))) back
to InputForm:

radicalSolve(64*z^4 + 64*z^3 + 32*z^2 - 8*z + 1)

[equation(z,((-1)*(((((-18)*((-1)/3)^(1/2)+68)*((54*((-1)/3)^(1/2)+35)^(1/3))^2+((-234)*((-1)/3)^(1/2)+208)*(54*((-1)/3)^(1/2)+35)^(1/3)+(-676))*((((-54)*((-1)/3)^(1/2)+35)*((54*((-1)/3)^(1/2)+35)^(1/3))^2+169*(54*((-1)/3)^(1/2)+35)^(1/3)+(-169))/3)^(1/2)+((702*((-1)/3)^(1/2)+(-455))*((54*((-1)/3)^(1/2)+35)^(1/3))^2+(-2197)*(54*((-1)/3)^(1/2)+35)^(1/3)+(-4394)))/39)^(1/2)+(((((-54)*((-1)/3)^(1/2)+35)*((54*((-1)/3)^(1/2)+35)^(1/3))^2+169*(54*((-1)/3)^(1/2)+35)^(1/3)+(-169))/3)^(1/2)+(-13)))/52),equation(z,((((((-18)*((-1)/3)^(1/2)+68)*((54*((-1)/3)^(1/2)+35)^(1/3))^2+((-234)*((-1)/3)^(1/2)+208)*(54*((-1)/3)^(1/2)+35)^(1/3)+(-676))*((((-54)*((-1)/3)^(1/2)+35)*((54*((-1)/3)^(1/2)+35)^(1/3))^2+169*(54*((-1)/3)^(1/2)+35)^(1/3)+(-169))/3)^(1/2)+((702*((-1)/3)^(1/2)+(-455))*((54*((-1)/3)^(1/2)+35)^(1/3))^2+(-2197)*(54*((-1)/3)^(1/2)+35)^(1/3)+(-4394)))/39)^(1/2)+(((((-54)*((-1)/3)^(1/2)+35)*((54*((-1)/3)^(1/2)+35)^(1/3))^2+169*(54*((-1)/3)^(1/2)+35)^(1/3)+(-169))/3)^(1/2)+(-13)))/52),equation(z,((-1)*((((18*((-1)/3)^(1/2)+(-68))*((54*((-1)/3)^(1/2)+35)^(1/3))^2+(234*((-1)/3)^(1/2)+(-208))*(54*((-1)/3)^(1/2)+35)^(1/3)+676)*((((-54)*((-1)/3)^(1/2)+35)*((54*((-1)/3)^(1/2)+35)^(1/3))^2+169*(54*((-1)/3)^(1/2)+35)^(1/3)+(-169))/3)^(1/2)+((702*((-1)/3)^(1/2)+(-455))*((54*((-1)/3)^(1/2)+35)^(1/3))^2+(-2197)*(54*((-1)/3)^(1/2)+35)^(1/3)+(-4394)))/39)^(1/2)+((-1)*((((-54)*((-1)/3)^(1/2)+35)*((54*((-1)/3)^(1/2)+35)^(1/3))^2+169*(54*((-1)/3)^(1/2)+35)^(1/3)+(-169))/3)^(1/2)+(-13)))/52),equation(z,(((((18*((-1)/3)^(1/2)+(-68))*((54*((-1)/3)^(1/2)+35)^(1/3))^2+(234*((-1)/3)^(1/2)+(-208))*(54*((-1)/3)^(1/2)+35)^(1/3)+676)*((((-54)*((-1)/3)^(1/2)+35)*((54*((-1)/3)^(1/2)+35)^(1/3))^2+169*(54*((-1)/3)^(1/2)+35)^(1/3)+(-169))/3)^(1/2)+((702*((-1)/3)^(1/2)+(-455))*((54*((-1)/3)^(1/2)+35)^(1/3))^2+(-2197)*(54*((-1)/3)^(1/2)+35)^(1/3)+(-4394)))/39)^(1/2)+((-1)*((((-54)*((-1)/3)^(1/2)+35)*((54*((-1)/3)^(1/2)+35)^(1/3))^2+169*(54*((-1)/3)^(1/2)+35)^(1/3)+(-169))/3)^(1/2)+(-13)))/52)]

but the result involves unnecessary cube roots as before.

Martin.

nob...@nowhere.invalid

unread,
Jan 27, 2024, 12:01:02 PMJan 27
to

"clicl...@freenet.de" schrieb:
>
> [...]
>
> This polynomial arises in integral 5.66 (#401) from the Timofeev test
> suite:
>
> INT(TAN(x)/(SQRT(TAN(x)) - 1)^2, x)
> = - x/2 + 1/(1 - SQRT(TAN(x))) + 1/2*LN(COS(x))
> + LN(1 - SQRT(TAN(x)))
> + 1/SQRT(2)*LN((1 + TAN(x) + SQRT(2)*SQRT(TAN(x)))/SEC(x))
> - 1/SQRT(2)*ATAN(1 + SQRT(2)*SQRT(TAN(x)))
> + 1/SQRT(2)*ATAN(1 - SQRT(2)*SQRT(TAN(x)))
> = - x/2 + 1/(1 - SQRT(TAN(x))) + 1/2*LN(COS(x))
> + LN(1 - SQRT(TAN(x)))
> + 1/SQRT(2)*ATANH((1 + TAN(x))/(SQRT(2)*SQRT(TAN(x))))
> - 1/SQRT(2)*ATAN(1 + SQRT(2)*SQRT(TAN(x)))
> + 1/SQRT(2)*ATAN(1 - SQRT(2)*SQRT(TAN(x)))
>
> which was discussed in the <sci.math.symbolic> thread
> "Boooooooooooooooooooooooooo" from April to June 2016. Note that the
> one and only radical extension needed to express the antiderivative is
> SQRT(2).
>

In version 3.1.10 of FriCAS, the integral:

integrate(tan(x)/(sqrt(tan(x)) - 1)^2, x)

evaluates to:

(((2^(1/2)+(-1))*tan(x)+((-1)*2^(1/2)+1))*log(2^(1/2)*tan(x)^(1/2)+(tan(x)+1))+((4*tan(x)+(-4))*log(tan(x)^(1/2)+(-1))+((((-1)*2^(1/2)+(-1))*tan(x)+(2^(1/2)+1))*log((-1)*2^(1/2)*tan(x)^(1/2)+(tan(x)+1))+((((-2)*2^(1/2)+2)*tan(x)+(2*2^(1/2)+(-2)))*atan(2^(1/2)*tan(x)^(1/2)+1)+((((-2)*2^(1/2)+(-2))*tan(x)+(2*2^(1/2)+2))*atan(2^(1/2)*tan(x)^(1/2)+(-1))+((-4)*tan(x)^(1/2)+(-4)))))))/(4*tan(x)+(-4))

which can be restated as:

(SQRT(TAN(x)) + 1)/(1 - TAN(x)) + LN(SQRT(TAN(x)) - 1)
+ (SQRT(2) - 1)/4*LN(TAN(x) + SQRT(2)*SQRT(TAN(x)) + 1)
- (SQRT(2) + 1)/4*LN(TAN(x) - SQRT(2)*SQRT(TAN(x)) + 1)
- (SQRT(2) - 1)/2*ATAN(SQRT(2)*SQRT(TAN(x)) + 1)
- (SQRT(2) + 1)/2*ATAN(SQRT(2)*SQRT(TAN(x)) - 1)

and thus constitutes an interesting alternative to the solutions above.

Martin.
0 new messages