I've been testing this pexpect interface. But it does not seem to work for all CAS systems the same way.
Using sagemath 9.6, RC 4, it worked for fricas, but for giac and maxima it did not.
```
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.6.rc4, Release Date: 2022-05-12 │
│ Using Python 3.10.4. Type "help()" for help. │
└────────────────────────────────────────────────────────────────────┘
sage: x = var('x')
sage: integrand = cos(x)^3*(cos(2*x)-3*tan(x))/(sin(x)^2-sin(2*x))/sin(2*x)^(5/2)
sage: giac(2)
2
sage: giac._expect.timeout = 0.00000001 #set time out
sage: integrate(integrand,x,algorithm="giac")
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
TypeError: timeout must be a float or None
```
And with maxima it does not even time out. It hanged
```
>sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.6.rc4, Release Date: 2022-05-12 │
│ Using Python 3.10.4. Type "help()" for help. │
└────────────────────────────────────────────────────────────────────┘
sage: x = var('x')
sage: integrand = cos(x)^3*(cos(2*x)-3*tan(x))/(sin(x)^2-sin(2*x))/sin(2*x)^(5/2)
sage: maxima(2)
2
sage: maxima._expect.timeout = 0.00000001 #set time out
sage: integrate(integrand,x,algorithm="maxima")
```
it hangs
Only with fricas it worked
```
>sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.6.rc4, Release Date: 2022-05-12 │
│ Using Python 3.10.4. Type "help()" for help. │
└────────────────────────────────────────────────────────────────────┘
sage: x = var('x')
sage: integrand = cos(x)^3*(cos(2*x)-3*tan(x))/(sin(x)^2-sin(2*x))/sin(2*x)^(5/2)
sage: fricas(2)
2
sage: fricas._expect.timeout = 0.00000001 #set time out
sage: integrate(integrand,x,algorithm="fricas")
---------------------------------------------------------------------------
TIMEOUT Traceback (most recent call last)
```
Now, fricas and maxima are the ONES installed by sagemath
```
>which sage
/home/me/TMP/sage-9.6.rc4/sage
>which maxima
/home/me/TMP/sage-9.6.rc4/local/bin/maxima
>which fricas
/home/me/TMP/sage-9.6.rc4/local/bin/fricas
```
But giac, since I had it already installed before building sagemath, and it is
newer version, it used the one I had on the system.
```
>which giac
/usr/bin/giac
>giac --version
1.7.0
```
Does this makes a difference to pexpect? i.e. for pexpect timeout to work, does
the external CAS has to be the one build by sagemath and not the one
that is already installed in the system and build outside sagemath? sagemath
comes with older CAS systems and I need to use ones I build myself
since they are newer (maxima for example is now at 5.46, but the one
that is build by sagemath is 5.45.
Note in the above, maxima was build by sagemath and the timeout still did not work.
Should it not have worked?
Thanks
--Nasser