Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Sage returning wrong derivative

I am trying to calculate the derivative of y = e^(x*y)

Hand calculation give me the result of dy/dx = ( y*e^(x*y) ) / ( 1 - x*e^(x*y) )

But the sage is giving me the wrong output of -y/x. Here is my code:

sage: 
sage:  y=function('y')(x)    
sage: y
y(x)
sage: 
sage: expr = exp(1)**(x*y)
sage: 
sage: diff(y)
diff(y(x), x)
sage: 
sage: diff(expr)
(x*diff(y(x), x) + y(x))*e^(x*y(x))
sage: 
sage: solve(diff(expr), diff(y))
[diff(y(x), x) == -y(x)/x]
sage: 
sage: