Hi, I would like to differentiate an abstract symbolic function in MATLAB.
To make sure we're all on the same page, let's say I have a function of two variables where f is any function of one variable that is differentiable across its domain. Using partial differentiation, we should expect to see:
I've tried to use syms to observe this behaviour in MATLAB:
syms x y f(k) g(x,y)
g(x,y) = f(x - 3*y);
g_x = diff(g,x);
g_y = diff(g,y);
In effect, we find that
Which translates to after using the latex function.
But we also find that
g_x = diff(f(x - 3*y), x)
which translates to . I have tried to use the expand and simplify functions on this result, but they don't seem to transform it into the expected . Is there a way for me to do this?
Note that if the coefficient of x was anything other than 1 or 0, then we have