Sometimes when calling integrate using algorithm such as maxima, it returns
result which is not fully resolved but still have an integrate inside it.
Next, when calling latex() on the anti-derivative this cause problems,
because sage tried to calls maxima again on the integrate command inside
the result.
Is there a way to make latex() just convert the result without calling
integrate again?
This results in problems like the following
sage: latex(anti)
Not invertible Error: Bad Argument Value
Undef/Unsigned Inf encountered in limit
Undef/Unsigned Inf encountered in limit
Here is an example
>sage
│ SageMath version 10.0, Release Date: 2023-05-20 │
│ Using Python 3.11.3. Type "help()" for help. │
sage: var('f x e n a p h g b c d q')
sage: anti=integrate(x*sec(a+b*log(c*x^n))^2,x, algorithm="maxima");
sage: latex(anti)
Not invertible Error: Bad Argument Value
Undef/Unsigned Inf encountered in limit
Undef/Unsigned Inf encountered in limit
Undef/Unsigned Inf encountered in limit
Undef/Unsigned Inf encountered in limit
Undef/Unsigned Inf encountered in limit
Undef/Unsigned Inf encountered in limit
Undef/Unsigned Inf encountered in limit
Undef/Unsigned Inf encountered in limit
The result of maxima in this case has unresolved integrate inside it. This
is the actual antiderivative
sage: integrate(x*sec(a+b*log(c*x^n))^2,x, algorithm="maxima")
2*(x^2*cos(2*b*log(x^n) + 2*a)*sin(2*b*log(c)) +
x^2*cos(2*b*log(c))*sin(2*b*log(x^n) + 2*a) -
2*(2*b^2*n^2*cos(2*b*log(c))*cos(2*b*log(x^n) + 2*a) -
2*b^2*n^2*sin(2*b*log(c))*sin(2*b*log(x^n) + 2*a) + (b^2*cos(2*b*log(c))^2
+ b^2*sin(2*b*log(c))^2)*n^2*cos(2*b*log(x^n) + 2*a)^2 +
(b^2*cos(2*b*log(c))^2 + b^2*sin(2*b*log(c))^2)*n^2*sin(2*b*log(x^n) +
2*a)^2 + b^2*n^2)*integrate((x*cos(2*b*log(x^n) + 2*a)*sin(2*b*log(c)) +
x*cos(2*b*log(c))*sin(2*b*log(x^n) +
2*a))/(2*b^2*n^2*cos(2*b*log(c))*cos(2*b*log(x^n) + 2*a) -
2*b^2*n^2*sin(2*b*log(c))*sin(2*b*log(x^n) + 2*a) + (b^2*cos(2*b*log(c))^2
+ b^2*sin(2*b*log(c))^2)*n^2*cos(2*b*log(x^n) + 2*a)^2 +
(b^2*cos(2*b*log(c))^2 + b^2*sin(2*b*log(c))^2)*n^2*sin(2*b*log(x^n) +
2*a)^2 + b^2*n^2), x))/(2*b*n*cos(2*b*log(c))*cos(2*b*log(x^n) + 2*a) +
(b*cos(2*b*log(c))^2 + b*sin(2*b*log(c))^2)*n*cos(2*b*log(x^n) + 2*a)^2 -
2*b*n*sin(2*b*log(c))*sin(2*b*log(x^n) + 2*a) + (b*cos(2*b*log(c))^2 +
b*sin(2*b*log(c))^2)*n*sin(2*b*log(x^n) + 2*a)^2 + b*n)
Notice there is an integrate(...) command inside the above output. So
maxima found it can't integrate that part and left the integrate command
there. So I do not want this to be evaluated. I just need the latex
conversion done keeping integrate as "\int{.....}" without evaluating.
This happens because sage was calling
integrate((x*cos(2*b*log(x^n) + 2*a)*sin(2*b*log(c)) +
x*cos(2*b*log(c))*sin(2*b*log(x^n) +
2*a))/(2*b^2*n^2*cos(2*b*log(c))*cos(2*b*log(x^n) + 2*a) -
2*b^2*n^2*sin(2*b*log(c))*sin(2*b*log(x^n) + 2*a) + (b^2*cos(2*b*log(c))^2
+ b^2*sin(2*b*log(c))^2)*n^2*cos(2*b*log(x^n) + 2*a)^2 +
(b^2*cos(2*b*log(c))^2 + b^2*sin(2*b*log(c))^2)*n^2*sin(2*b*log(x^n) +
2*a)^2 + b^2*n^2), x)
Not invertible Error: Bad Argument Value
Undef/Unsigned Inf encountered in limit
Undef/Unsigned Inf encountered in limit
Undef/Unsigned Inf encountered in limit
Undef/Unsigned Inf encountered in limit
Undef/Unsigned Inf encountered in limit
Undef/Unsigned Inf encountered in limit
Undef/Unsigned Inf encountered in limit
Undef/Unsigned Inf encountered in limit
Not invertible Error: Bad Argument Value
Undef/Unsigned Inf encountered in limit
Undef/Unsigned Inf encountered in limit
Undef/Unsigned Inf encountered in limit
Undef/Unsigned Inf encountered in limit
Undef/Unsigned Inf encountered in limit
and these go on forever it seems
And getting these error. The strange thing, is calling the above exact
command inside Maxima just returns the input back, without these errors!
So these errors are generated by sagemath and not by maxima from the
latex() command.
I am using Maxima 5.47 with sagemath 10.0
>which maxima
/usr/bin/maxima
>maxima --version
;;; Loading #P"/usr/lib/ecl-21.2.1/sb-bsd-sockets.fas"
;;; Loading #P"/usr/lib/ecl-21.2.1/sockets.fas"
Maxima 5.47.0
>
And
>which sage
/home/me/TMP/sage-10.0/sage
>sage --version
SageMath version 10.0, Release Date: 2023-05-20
>
Thanks
--Nasser
--
You received this message because you are subscribed to the Google Groups
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sage-devel/43c4f68d-4be8-4cbc-a68a-d54321969ab7n%40googlegroups.com.