[Maxima] Pattern matching - new user question
nathanielvirgo at gmail.com
Thu Oct 1 10:42:18 CDT 2009
Thanks for your helpful comments. It's odd that using apply1 gives an
infinite loop for you but just fails for me.
However, applyb1 does work for me in this case (I thought I'd already tried
it, but apparently not). It doesn't work in all cases though.
Specifically, if I try to apply Bayes' rule twice (which should give the
original expression) it doesn't match:
(%i21) expr: bayes(a | b and c);
(%o21) ((a | c)*(b | a and c))/b | c
(%o23) ((a | c)*(b | a and c))/b | c
Surely "(b | a and c)" is a subexpression of "((a | c)*(b | a and c))/b |
c", so why doesn't applyb1 find it and apply the rule?
2009/10/1 Robert Dodier <robert.dodier at gmail.com>
> On 10/1/09, Nathaniel Virgo <nathanielvirgo at gmail.com> wrote:
> > (%i6) apply1( (a|b and c)*x, bayes);
> > (%o6) (a | b and c)*x
> applyb1 (bottom-up) works for me here instead of apply1 (top-down).
> That's helpful, but not very satisfying; I can see why one
> works and the other doesn't, but it's far from obvious.
> Robert Dodier
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Maxima