dprodanov/maximaft — pull request #1 by robert-dodier (2014-03-15 20:29:21+00:00)
Title: changes to fourrier.mac

Hi, I've made some changes to fourrier.mac on my own branch.
What do you think?

(1) omit explicit expression hacking (assume rules will do all the work)
(2) changed implementation of rect and friends
(3) changed rules involving diff
(4) changed matchdeclare for t to be more specific (otherwise ft_t matches every FT expression)
(5) implement distribution over equations and lists via DISTRIBUTE_OVER property

I haven't tested it much; doubtless there is more work to do.
Anyway, with these changes I get:

(%i2) batch ("./fourrier.mac") $

(%i23) e : 2*rect(u, A) + 3*%step(u);
(%o23) 2*rect(u,A)+3*%step(u)
(%i24) apply1 (e, expand_rect, expand_step);
(%o24) 2*(if abs(u) <= A/2 then 1 else 0)+3*(if u >= 0 then 1 else 0)
(%i25) FT(e);
(%o25) 2*FT(rect(u,A))+3*FT(%step(u))

(%i27) ft (%, u, s);
(%o27) 2*'sinc(s,1/A)/abs(A)+3*delta(s)-3*%i/(2*%pi*s)

Note that rect(u, A) isn't expanded until it's explicitly requested, otherwise it just stays rect(u, A).

Probably at this point the next thing to do is to create an rtest_fourier.mac for example inputs and expected outputs.

Comments welcome -- let me know what you think.