On Fri, May 22, 2026 at 10:24:38PM +0800, Qian Yun wrote:
> On 5/22/26 10:09 PM, Waldek Hebisch wrote:
> >
> > Representation of derivatives needs a dummy. Kernels may
> > be nested and we sometimes need to substitute for dummies.
> > Old code in few other places (not this one) tried to use
> > the same dummy and this led to obscure bugs. Those bugs
> > were fixed by consistently using new dummies.
> >
> > Need for distinct dummies may be unobvious and people believed
> > that reusing dummy is safe, but it is easy to overlook some
> > special case. So, I very much prefer current state, that
> > is consistently using new dummies.
> >
>
> That code has remained the same since the beginning of FriCAS,
> so at least unchanged for 20 years, maybe 40 years.
>
> I believe with the introduction of encode_diff/decode_diff,
> this usage of new dummy is no longer needed.
>
> In encode_diff, for high order derivatives, same dummy symbols
> are reused. If certain rules are followed (i.e alpha
> substitution), then transformation of (%diff) kernel will not
> mess things up.
>
> For making changes safe, we can add some assertions there.
The trouble is that such change affects all expression code. Bugs
that I mentioned looked like obviously correct code when viewed in
isolation and were triggered by interaction with other code.
For old bugs we have tests, so hopefully anybody trying to
reintroduce old bug will be warned by failing test. But here
we are likely to see problem only some time after making change.
--
Waldek Hebisch
--
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/ahBq4_FbmJJTxssM%40fricas.org.