I want to define a function of a function ( maybe functional) in Maxima. For example, I want to define T in the code:
f(r,GN,M)::=(2*GN*M^2)*(2*GN*M/r-(2*GN*M/(2*r))^2);
X(r,GN,M) ::= 2*GN*M/(2*r)+2*GN*M/r*(1-2*GN*M/(4*r));
T(r,GN,M) ::= diff(f(r,GN,M),r)+X(r,GN,M);
But I don't know the code.
In maxima it is convenient to use expressions.
Define two expressions
(%i1) display2d: false $
(%i2) f: (2*GN*M^2)*(2*GN*M/r-(2*GN*M/(2*r))^2) $
(%i3) X: 2*GN*M/(2*r)+2*GN*M/r*(1-2*GN*M/(4*r)) $
Define a function which operates on two expressions
(%i4) T(f, X) := diff(f, r) + X $
Call it. Result is an expression
(%i5) dfpX: T(f, X);
(%o5) (2*GN*M*(1-(GN*M)/(2*r)))/r+(GN*M)/r+2*GN*M^2
*((2*GN^2*M^2)/r^3-(2*GN*M)/r^2)
You can create a function based on dfpX
(%i6) define(f(r, GN, M), dfpX);
(%o6) f(r,GN,M):=(2*GN*M*(1-(GN*M)/(2*r)))/r+(GN*M)/r
+2*GN*M^2*((2*GN^2*M^2)/r^3-(2*GN*M)/r^2)
and call it
(%i7) f(1, 2, 3);
(%o7) 2142
but you can stay with expressions
(%i8) subst([r=1, GN=2, M=3], dfpX);
(%o8) 2142