# Graphing derivatives of implicitly given functions

Sorry if this is too elementary.

I want to graph the derivative of a function y that is given implicitly as a function of x. I would appreciate any suggestions.

edit retag close merge delete

Sort by ยป oldest newest most voted

Unfortunately, this is pretty hard to do in Sage. Even this attempt (eventually) fails:

sage: y = function('y',x)
sage: f = y*x==1; f
x*y(x) == 1
sage: f.derivative(x)
x*D[0](y)(x) + y(x) == 0
sage: g = f.derivative(x)
sage: g.operands()[0].operands()[0].operands()[1]
D[0](y)(x)
sage: h = g.solve(g.operands()[0].operands()[0].operands()[1])[0]; h
D[0](y)(x) == -y(x)/x
sage: implicit_plot(h.rhs(),(x,-1,1),(y,-1,1))
<boom>


I don't know that this is easy to fix in general, either, because of course derivatives in implicit functions can be arbitrarily complicated to solve for, and so not necessarily accessible to a computer method. I don't think there are any numerical methods for doing this.

more

I am not sure whether this is what you are looking for

y(x)=sin(x)
plot(diff(sin(x),x),(x,0,pi))

more

Surely there is a way to do this numerically, isn't there? What I mean is that one should be able to write a function which, for a given numerical value of x, solves the implicit equation to find the value of the derivative at x -- using find_root, perhaps. And then one ought to be able to plot this function.

Of course this won't work for every implicitly defined function, but sage's numerics should work for a lot of cases that users actually want.

But I don't know enough about sage symbolics to actually do this. Any takers?

more

You can try this:

y=function('y',x)
var('x,yy,z')
f=x*y+x^2-y^3*x
ff=f.diff(x).subs({y.diff(x):z,y:yy})
implicit_plot3d(ff,(x,-3,3),(yy,-3,3),(z,-4,4))


This way you avoid the "solve" issue.

more