differential operator in maxima



"tws" <tws5@mail.ru> writes:

> Also i wonder how could i define a function which argument and value
> are at their turn functions, for example the following symmetrizing
> linear operator:
> 
> AF(x) = 1/2(F(x)+F(-x))
> 
> In Maple this would be A:=F->unapply(1/2*(F(x)+F(-x)),x); 
> then A(exp)(x) = 1/2*(exp(x)+exp(-x)).

As Stavros pointed out, Maxima doesn't have lexical closures, but in
many cases we can work around this deficiency by means of BUILDQ.

(C1) prefix("A");
(D1) 				      "A"
(C2) A(f):=buildq([f],lambda([u],(f(u)+f(-u))/2));
					       f(u) + f(- u)
(D2) 	        A f := BUILDQ([f], LAMBDA([u], -------------))
						     2
(C3) (A g)(x);
				 g(x) + g(- x)
(D3) 				 -------------
				       2
(C4) (A exp)(x);
				    x	  - x
				  %E  + %E
(D4) 				  -----------
				       2
(C5) (A cos)(x);
(D5) 				    COS(x)
(C6) (A sin)(x);
(D6) 				       0


Note that the definition (C2) has the following bug:


(C7) (A u)(x);
				 x(x) + x(- x)
(D7) 				 -------------
				       2

So we have to make the definition slightly more complicated in order
to avoid the name clash and the Lisp function GENSYM is our friend.

(C8) A(f):=buildq([f,u:?gensym()],lambda([u],(f(u)+f(-u))/2));
						      f(u) + f(- u)
(D8) 	 A f := BUILDQ([f, u : GENSYM()], LAMBDA([u], -------------))
							    2
(C9) (A u)(x);
				 u(x) + u(- x)
(D9) 				 -------------
				       2

Wolfgang