Substituting the partial differentiation

I am trying to substitute the partial differential equation but I can't find appropriate function.
Here is the sample code I have to modify.
syms u v x(u,v) y(u,v) z(x,y)
z = exp(x*y) ;
x = 2*u+v ;
y = u/v ;
dx = diff(x,u)
dy = diff(y,u)
dz_du = diff(z,u)
dz_du = subs(dz_du, {diff(x,u),diff(y,u)}, {dx, dy})
The result is
dx =
2
dy =
1/v
dz_du(u, v) =
exp(x(u, v)*y(u, v))*(y(u, v)*diff(x(u, v), u) + x(u, v)*diff(y(u, v), u))
dz_du(u, v) =
exp(x(u, v)*y(u, v))*(y(u, v)*diff(x(u, v), u) + x(u, v)*diff(y(u, v), u))
The point is, those diff(x(u, v), u) & diff(y(u, v), u) haven't substituted.
(what I want is the result below)
exp(x(u, v)*y(u, v))*(y(u, v)*2 + x(u, v)*1/v)
*At first, I changed the last line
subs(dz_du, {diff(x(u,v),u),diff(y(u,v),u)}, {dx, dy})
but it only returns error.
** I found some answers asking the version of my MATLAB and it is R2021a
Is there any way to guide matlab to substitute those partial differentiations?

3 comentarios

Star Strider
Star Strider el 25 de Jul. de 2023
I am not certain what you want to do or what result you want.
One option may be the functionalDerivative function.
VBBV
VBBV el 25 de Jul. de 2023

It seems you have defined z = exp(x*y) first. You should define it after x and y. Then do the diff(z,u) which will give the same result but in u and v. There's no need for subs in the equation

Tae Woo Lee
Tae Woo Lee el 25 de Jul. de 2023
Problem has solved. Thank you very much.

Iniciar sesión para comentar.

Respuestas (0)

Preguntada:

el 25 de Jul. de 2023

Comentada:

el 25 de Jul. de 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by