Ask Your Question

subs: why it accepts one form but not the other?

asked 2020-06-10 03:51:05 +0200

curios_mind gravatar image

updated 2020-06-10 04:09:11 +0200


Consider the following expression


I would like to replace diff(y,x)/y^4 by, say, 2/5

I tried,


But this didn't work (threw back at me the original expression)

I tried to replace y^4 by 5, and to do that I did


It didn't work. However,


worked!. I am confused!

If I tried to replace just y with 5^(1/4)


it worked! so it cannot replace y^4 with 5, but it can replace y with (5)^1/4.

To get what I want I finally did


I got this by trial and error. Shouldn't the first one


have worked in the first place? What is the logic behind this that it didn't work?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-06-10 17:41:02 +0200

eric_g gravatar image

updated 2020-06-10 17:41:44 +0200

The general strategy to replace a composed expression like diff(y, x)/y^4 is to replace only a simple part of it by an equivalent expression. In your case:

sage: y = function('y')
sage: Y = y(x)
sage: z = -3*diff(Y, x)/Y^4
sage: z.subs(diff(Y, x) == 2/5*Y^4)
edit flag offensive delete link more

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


Asked: 2020-06-10 03:51:05 +0200

Seen: 203 times

Last updated: Jun 10 '20