After using SPAD for a while now, I think I've come across a few
compiler issues, leading either to compilation failure or to programs that crash ("system error").
In all cases I was able to circumvent them by rewriting the expression, interchanging independent lines etc.
One "system error" was for example produced by using
monomial(1,0)$UnivariateTaylorSeries(Expression(Integer),'x,0)
in a longer expression and I was able to circumvent this by just using
1$UnivariateTaylorSeries(Expression(Integer),'x,0)
Ideally I should probably produce minimal working examples and put them on the bugtracker,
but I think some of these just occur when the code is sufficiently complex. I know that there is
little manpower to fix these things, but it might still be worth to collect the issues? Things like this
make me a little nervous about investing development time. What happens when I come across
something without a workaround or there is a very deep and subtle bug? I know that in the end
this is my risk to take, but from your point of view, how concerned should I be? FriCAS/Axiom
have been around for a while and used for hundreds of packages, so I'm probably too concerned.
Have there been thoughts or plans of porting the FriCAS SPAD code completely to Aldor? As far
as I can tell Aldor is unmaintained, so this might not be a good idea in the long run.
The most problematic issue for me right now is that using ")compile file.spad" multiple times
without ")clear all" in-between will completely break things. For example something like:
)co mypackage
test := sqrt(x)
subst(test, x=0)
gives sqrt(0) as it should, but once I use )co mypackage again
it no longer substitutes x=0 and just returns sqrt(x). This then completely breaks the functionality in the package.
A fix for this is to use ")clear all" in between, or to redefine test. Is this "intended" or known behavior? I've had
similar issues before where ")clear completely" was necessary.
I've been able to produce a somewhat minimal example for this particular issue (see test.input and ptest.spad below):
)read test.input
test := sqrt(x)
subst(test,x=0) -- works
)co ptest
subst(test,x=0) -- fails
(Yes the matrix definition in test.input is necessary for this bug to happen)
Thanks and best wishes,
Tobias
)clear all
)compile ptest.spad
amat := matrix [[0, 0, 0, 0, 0, 0, 0, 0, 0], [x1/(sqrt(-(t*x1))*sqrt(4 - t*x1)), -(x1/(-4 + t*x1)), 0, 0, 0, 0, 0, 0, _
0], [(sqrt(-(t*x3))*sqrt(4 - t*x3))/(t*(-4 + t*x3)), 0, -(x3/(-4 + t*x3)), 0, 0, 0, 0, 0, 0], _
[(sqrt(-(t*x2))*sqrt(4 - t*x2))/(t*(-4 + t*x2)), 0, 0, -(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-(t*x3))^(3/2))/(t^2*x3*(x1 - x2 + x3)*sqrt(t*(-4*x1 + 4*x2 - 4*x3 + t*x1*x3))) + _
(x1*sqrt(-(t*x3))*(-x2 + x3))/(sqrt(-(t*x1))*(x1 - x2 + x3)*sqrt(t*(-4*x1 + 4*x2 - 4*x3 + t*x1*x3))), _
(sqrt(-(t*x1))*x2*sqrt(-(t*x3)))/(t*(-x1 + x2 - x3)*sqrt(t*(-4*x1 + 4*x2 - 4*x3 + t*x1*x3))) + _
(sqrt(-(t*x1))*(x1 - x2)*x3)/(sqrt(-(t*x3))*(x1 - x2 + x3)*sqrt(t*(-4*x1 + 4*x2 - 4*x3 + t*x1*x3))) + _
(x1*sqrt(-(t*x3))*(-x2 + x3))/(sqrt(-(t*x1))*(x1 - x2 + x3)*sqrt(t*(-4*x1 + 4*x2 - 4*x3 + t*x1*x3))), _
(x1*x2*x3)/((-x1 + x2 - x3)*(-4*x1 + 4*x2 - 4*x3 + t*x1*x3)) - _
((x1^2 - x1*x2)*x3)/((x1 - x2 + x3)*(-4*x1 + 4*x2 - 4*x3 + t*x1*x3)) - _
(x1*x3*(-x2 + x3))/((x1 - x2 + x3)*(-4*x1 + 4*x2 - 4*x3 + t*x1*x3))]]