This is the same example as the above, but now we want to remove the last argument instead of changing it.
Hence, given an expression which contains some different functions each with different number of arguments. Suppose we want to remove only the last argument of each function if the last argument is \(x\).
how to do that?
Hence given R0*f(R0,x)+h(x,y,z,r,x) we want to change it to R0*f(R0)+h(x,y,z,r).
expr:=R0*f(R0,x)+h(x,y,z,r,x) evalindets(expr, 'patfunc[reverse](anything,identical(x))', Z-> subsop(-1 = NULL, Z ));
Be careful using the above on expression that has diff(f(y,x),x) as this will give 0,
because we basically removed the variable of the differentiation.