On Oct. 30, nijso beishuizen wrote:
> > I have an equation containing f(x), eg
> > eq: f(x)*g(x)*x*sin(f(x)
> > I want f(x) to be replaced by a so the equation is eq: a*g(x)*x*sin(a).
>More specifically, I want to be able to differentiate expressions like the
>above with respect to expressions, e.g.
>d: diff(eq,f(x)*g(x));
>Non-variable 2nd argument to diff:
Use ratsubst(a,b,c) a replaces b in expression c
(%i1) display2d : false$
(%i2) eq: f(x)*g(x)*x*sin( f(x) );
(%o2) x*f(x)*g(x)*sin( f(x) )
(%i3) ratsubst( a, f(x)*g(x), eq );
(%o3) a*x*sin( f(x) )
(%i4) diff(%, a);
(%o4) x*sin( f(x) )
(%i5) diff( ratsubst( a, f(x)*g(x), eq ), a );
(%o5) x*sin( f(x) )
Ted Woollett