my mistake: subst(a,f(x)*g(x),eq)



> >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) )
>

I am not a mathematics expert, so forgive me (and please correct me), but
this is not what he wants, right?  He wants to differentiate eq w.r.t. the
function f(x)*g(x).  In the general case, f(x) and x are not constant w.r.t.
f(x)*g(x).  He can use the chain rule...

diff(f(x)*g(x)*x*sin(f(x)), f(x)*g(x))
    = diff(f(x)*g(x)*x*sin(f(x)), x) * diff(x, f(x)*g(x))

It is up to nijso to solve dx/d(f(x)*g(x)).  In some well behaved cases, I
think you can just use 1/(d(f(x)*g(x))/dx).  This sort of stuff flies for
something like dx/d(x^2).

Using subst/ratsubst for this in the first place is just the wrong
direction, right?

Zach