[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Axiom-mail] Going mad with pattern matching
From: |
Bill Page |
Subject: |
Re: [Axiom-mail] Going mad with pattern matching |
Date: |
Tue, 29 May 2007 09:11:58 -0400 |
User-agent: |
Webmail 4.0 |
Quoting Martin Rubey:
I did now go through your example. It seems that you hit a bug, but
fortunately, there is an easy workaround. THe problem is with rules
of the form:
rule ...a...b... | p(a,b) == ...
It seems that in this case, the predicate p is never tested, who knows
why. The workaround is to use the "suchThat" function.
Martin, could you please say two words (or a little more?) about
where you found information and examples of how to use suchThat
and ruleset? Sometimes finding out *how* to find out is more
important than the specific answer.
Find the modified ruleset below.
...
zt:=operator 'zt
help(z,a) ==
tmp := z/(z-1)
for i in 1..a repeat
tmp:=-D(tmp,z)
tmp
Note that there is a problem in this expression. It does not
correctly compute the ztrans of 'n^a'.
myFreeOf? l == freeOf?(l.1, l.2)
r0 := rule zt(f+g,n,z) == zt(f,n,z)+zt(g,n,z)
r1 := suchThat(rule zt(a*f,n,z) == a*zt(f,n,z), [a, n], myFreeOf?)
r2 := suchThat(rule zt(a,n,z) == a*z/(z-1), [a, n], myFreeOf?)
r3 := suchThat(rule zt(a^n,n,z) == z/(z-a), [a, n], myFreeOf?)
That's pretty cool! I've never seen that anywhere before...
r4 := rule zt(0,n,z) == 0
r5 := rule zt(1,n,z) == z/(z-1)
r6 := rule zt(n,n,z) == z/(z-1)^2
r7 := rule zt(n^(a | integer?(a) and a>1),n,z) == help(z, a)
ztransrules := ruleset([r0,r1,r2,r3,r4,r5,r6,r7])$Ruleset(INT, INT, EXPR INT)
How can one decide on the proper package call to Ruleset?
ztrans(f,n,z)==ztransrules zt(f,n,z)
...
Regards,
Bill Page.
- [Axiom-mail] Going mad with pattern matching, Alasdair McAndrew, 2007/05/28
- Re: [Axiom-mail] Going mad with pattern matching, Martin Rubey, 2007/05/28
- Re: [Axiom-mail] Going mad with pattern matching, Martin Rubey, 2007/05/28
- Re: [Axiom-mail] Going mad with pattern matching, Alasdair McAndrew, 2007/05/28
- Re: [Axiom-mail] Going mad with pattern matching, Martin Rubey, 2007/05/29
- Re: [Axiom-mail] Going mad with pattern matching, Martin Rubey, 2007/05/29
- Re: [Axiom-mail] Going mad with pattern matching,
Bill Page <=
- Re: [Axiom-mail] Going mad with pattern matching, Martin Rubey, 2007/05/29
- Re: [Axiom-mail] Going mad with pattern matching, Alasdair McAndrew, 2007/05/30
- Re: [Axiom-mail] Going mad with pattern matching, Martin Rubey, 2007/05/30
- Re: [Axiom-mail] Going mad with pattern matching, Alasdair McAndrew, 2007/05/30
- Re: [Axiom-mail] Going mad with pattern matching, Martin Rubey, 2007/05/30
- Re: [Axiom-mail] Going mad with pattern matching, Bill Page, 2007/05/29