A pattern matching problem
- To: mathgroup at smc.vnet.net
- Subject: [mg72533] A pattern matching problem
- From: carlos at colorado.edu
- Date: Fri, 5 Jan 2007 02:06:10 -0500 (EST)
Here is an interesting challenge in pattern matching. Suppose
you are given an algebraic-differential expression exemplified by
r = u[t+h]-2*u[t]+u[t-h]+a^2*u'[t+h/2]+4*u'[t-h/4]+
c*u''[t+alfa*h]/12;
Here u[t] is a function of time t, assumed infinitely differentiable,
h is a time interval, and primes denote derivatives wrt t.
Relation r==0 is called a delay-differential equation, and is the
basic stuff in delayed automatic control (h is the signal "lag").
The function name u and the lag h are always symbolic.
Function u and its derivatives appear linearly in r, while
h always appears linearly in arguments.
Coefficients of h may be numeric or symbolic.
Coefficients of u & derivatives may be numeric or symbolic.
The challenge: given r, get the coefficients of h as a 2D list,
row-ordered by derivative order. Zero coefficients may be omitted.
For the above r, it should return
{{1,-1},{1/2,-1/4},{alfa}}
Envisioned module invocation: clist=LagCoefficients[r,u,t,h,m]
with m=max u-derivative order to be considered. Skeleton:
LagCoefficients[r_,u_,t_,h_,m_]:=Module[ {clist={}},
??????
Return[clist]];
Any ideas for ?????
- Follow-Ups:
- Re: A pattern matching problem
- From: János <janos.lobb@yale.edu>
- Re: A pattern matching problem