Substituting the partial differentiation

31 ビュー (過去 30 日間)
Tae Woo Lee
Tae Woo Lee 2023 年 7 月 25 日
コメント済み: Tae Woo Lee 2023 年 7 月 25 日
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 件のコメント
VBBV
VBBV 2023 年 7 月 25 日

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 2023 年 7 月 25 日
Problem has solved. Thank you very much.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeLinear Algebra についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by