axiom-mail
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Axiom-mail] Going mad with pattern matching


From: Martin Rubey
Subject: Re: [Axiom-mail] Going mad with pattern matching
Date: 28 May 2007 18:52:36 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

"Alasdair McAndrew" <address@hidden> writes:
> But this doesn't quite work.  I'd be grateful for a little help here!  (Then
> I'll see if I can use the z-transform to solve some difference equations.)

it seems that rules don't like local function definitions too much.  The usual
syntax would be

  (op1; op2; ...; opn)

which returns the value of opn, but I had no luck with this construction.

zt:=operator 'zt

help(z,a) == 
    tmp := z/(z-1)
    for i in 1..a repeat 
        tmp:=-D(tmp,z)
    tmp

ztransrules := rule
  zt(f+g,n,z) == ztrans(f,n,z)+ztrans(g,n,z)     -- two lines for linearity
  zt((a | freeOf?(a,n)),n,z) == a*ztrans(f,n,z)
  zt(0,n,z) == 0       -- a couple of end cases, probably not needed
  zt(1,n,z) == z/(z-1)
  zt(a | freeOf?(a,n),n,z) == a*z/(z-1)  -- now some standard rules
  zt((a | freeOf?(a,n))^n,n,z) == z/(z-a)
  zt(n,n,z) == z/(z-1)^2
  zt(n^(a | integer?(a) and a>1),n,z) == help(z, a)

ztrans(f,n,z)==ztransrules zt(f,n,z)


Does this answer your question?  I'm a little in the dark, I must say.

Martin





reply via email to

[Prev in Thread] Current Thread [Next in Thread]