Ask Your Question
1

How do I differentiate an implicit function in sagemath?

asked 2020-06-27 14:50:08 +0100

lolora gravatar image

I'm trying to differentiate an implicit expression

$x e^{y} = x -y$

This is my sagemath code

x = var('x')
f(x,y)= x*e**y - x + y
show(diff(f))

Sagemath Answer is $\left( x, y \right) \ {\mapsto} \ \left(e^{y} - 1,\,x e^{y} + 1\right)$

But the actual answer is $\frac{1 - e^{y}}{x e^{y} + 1}$

How do I get the actual answer using sagemath?

edit retag flag offensive close merge delete

Comments

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-06-28 03:01:51 +0100

Juanjo gravatar image

The code

x = var('x')
y = function("y")(x)
eq = x*e**y == x - y
dy = diff(y,x)
sol = solve(diff(eq), dy)
show(dy.subs(sol))

yields $$-\frac{e^{y\left(x\right)} - 1}{x e^{y\left(x\right)} + 1}$$ as expected

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

Stats

Asked: 2020-06-27 14:50:08 +0100

Seen: 1,742 times

Last updated: Jun 28 '20