Processing math: 100%

First time here? Check out the FAQ!

Ask Your Question
2

partial derivatives

asked 0 years ago

KingUncrowned gravatar image

updated 0 years ago

I have the function f(x,y,y)=1+y(x)2 from which I want to calculate fy as well as fy and ddx(fy).

I tried using the SymbolicRing of Sagemath with

 x = SR.var('x')
 y = function('y')
 f = sqrt(1+y(x).diff(x,1)^2)

which only allows me to calculate dfdx. So I tried with the following sample

 x,y = SR.var('x,y')
 y = function('y')(x)
 y1 = y.diff(x,1)
 f(x,y,y1) = sqrt(1+y1^2)
 fy1 = f.diff(y1)
 fy = f.diff(y)
 dxfy1 = fy1.diff(x)

which works for calculating fy and fy, but not for ddx(fy). Because dxfy1 which stands for ddx(fy) returns 0 when it should return y1+y(x)23/2.

Another unseccesful try would be

x,y = SR.var('x,y')
y = function('y')(x)
y1 = y.diff(x,1)
y1=function('y1')(x)
f(x,y,y1) = sqrt(1+y.diff(x)^2)
fy1(x,y,y1) = f.diff(y1); fy1
fy(x,y,y1) = f.diff(y); fy
fy1.diff(x)

I'd really appreciate any idea. Thanks in advance!

Preview: (hide)

Comments

is y a notation for dydx ?

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 0 years ago )

Nver mind : your code anwered for you.

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 0 years ago )

Yes, y stand for dydx. @Emmanuel Charpentier

KingUncrowned gravatar imageKingUncrowned ( 0 years ago )

1 Answer

Sort by » oldest newest most voted
0

answered 0 years ago

Emmanuel Charpentier gravatar image

Since y is a function of x, so is y, and f is a function of x and x alone : fixing x fixes y(x) and y(x).

End of story.

HTH,

Preview: (hide)
link

Comments

But if I write f(x) = sqrt(1+y1^2) then f.diff(y) won't work. What can I do?

KingUncrowned gravatar imageKingUncrowned ( 0 years ago )

Write it correctly : when you write f(x)=1+y2, you are eliding the real expression f(x)=1+y(x)2, which reminds you that the only argument of f if x ; y is just a notation for some expression including x which is fixed for a given x. Differentiating "with respect to y" is nonsense.

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 0 years ago )

@Emmanuel Charperntier some days ago I thought like you, but in fact f depends not only on the independent variable x but also on the dependent functions y and y. So fy makes sense with the solution [here] (https://math.stackexchange.com/questions/4938742/trouble-understanding-frac-partial-y-partial-y (https://math.stackexchange.com/questi...)). So definitely it is needed f(x,y,y), problem comes when doing ddxfy in code.

KingUncrowned gravatar imageKingUncrowned ( 0 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 0 years ago

Seen: 534 times

Last updated: Jun 30 '24