I think there is no need to run solve.  The function will always be  
linear in dy/dx, because it is a linear operator, so the solution will  
always be -diff(eq, ind)/diff(eq, dep).  See 
http://en.wikipedia.org/wiki/Implicit_differentiation#Formula_for_two_variables

Aaron Meurer
On Nov 5, 2009, at 7:33 PM, smichr wrote:

>
> p.s. just remembering that you will always just get a single solution
> for dy/dx so you can return the answer rather than a list. It can all
> be encapsulated as:
>
> def implicit_diff(eq, dep, ind):
>    """Return d_dep/d_ind given eq(y) = 0
>
>>>> import sympy as s
>>>> s.var('x y')
>    (x, y)
>>>> eq=s.sympify('x^2+y^2 - 36')
>>>> implicit_diff(eq, y, x)
>>>> -x/y
>    """
>    f=sympy.Function('f', dummy=True)
>    eq=eq.subs(dep, f(ind))
>    return sympy.solve(eq.diff(ind), f(ind).diff(ind))[0].subs(f(ind),
> dep)
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sympy@googlegroups.com
To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sympy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to