Whole derivation of two variable differential function

조회 수: 38 (최근 30일)
Minjae Cho
Minjae Cho 2022년 6월 22일
댓글: Walter Roberson 2022년 6월 22일
I am struggleing with the whole derivation of differential equation.
Can y'all give me an advice how to implement that into a code?
I've tried using diff() but diff(f(x,y), y) gives 1 not y'.

답변 (2개)

James Tursa
James Tursa 2022년 6월 22일
Please show the code you are using.
y' means derivative of y with respect to x, not derivative of y with respect to y. You should be taking derivative of f(x,y) with respect to x, not y.
  댓글 수: 2
Minjae Cho
Minjae Cho 2022년 6월 22일
편집: Minjae Cho 2022년 6월 22일
syms x y
f(x, y) = -x^3 + x + 1 +y;
the derivation should be f '(x, y) => y ' - 3*x^2 + 1
but when I do diff(f, x) => - 3*x^2 + 1 [which is partial derivative w.r.t. x].
Is there any way to get a whole derivative rather than a partial derivative?
Walter Roberson
Walter Roberson 2022년 6월 22일
Is there any way to get a whole derivative rather than a partial derivative?
syms x y
f = y - x^3 + x + 1
f = 
dy = f
dy = 
df = diff(f, x) + diff(f, y)
df = 
simplify(subs(df, diff(y,x), dy))
ans = 
You may notice that this is not what you wanted... but it satisfies at least one plausible definition of what a "whole derivative" means.
I recommend that you re-examine that derivative provided. I think you will find that it makes no sense unless it is the derivative with respect to x with the assumption that y is a function of x

댓글을 달려면 로그인하십시오.


Walter Roberson
Walter Roberson 2022년 6월 22일
The equations are being careless about which variables depend on which variables, and on which variable the differentiation is with respect to.
syms x y(x)
f = y - x^3 + x + 1
f(x) = 
dy = f
dy(x) = 
df = diff(f, x)
df(x) = 
simplify(subs(df, diff(y,x), dy))
ans(x) = 
  댓글 수: 2
Minjae Cho
Minjae Cho 2022년 6월 22일
편집: Minjae Cho 2022년 6월 22일
then how can I plug the value to y(x)?
ex) later on I have to plug value y=3 to y(x)
Walter Roberson
Walter Roberson 2022년 6월 22일
Plug what values into y(x) ?
syms x y(x) yx
f = y - x^3 + x + 1
f(x) = 
dy = f
dy(x) = 
df = diff(f, x)
df(x) = 
sol = simplify(subs(subs(df(x), diff(y,x), dy), y, yx))
sol = 
[X, Y] = ndgrid(linspace(-1, 1, 15));
solgrid = double(subs(sol, {x, yx}, {X, Y}));
whos
Name Size Bytes Class Attributes X 15x15 1800 double Y 15x15 1800 double cmdout 1x33 66 char df 1x1 8 symfun dy 1x1 8 symfun f 1x1 8 symfun sol 1x1 8 sym solgrid 15x15 1800 double x 1x1 8 sym y 1x1 8 symfun yx 1x1 8 sym
surf(X, Y, solgrid)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by