| 1 | initial version |
You can see which symbolic variables are used by the input V with V.variables(). Then, you can define the corresponding derivation symbols by looking to their string representation, add the letter 'd' in front of them, and make them symbols with SR.var function. So, the following should work:
def implicit_derivative(V):
w1, w2 = V.variables()
dw1 = SR.var('d{}'.format(w1))
dw2 = SR.var('d{}'.format(w2))
V_w1 = diff(V, w1)
V_w2 = diff(V, w2)
# Differential
dV = V_w1 * dw1 + V_w2 * dw2
# Dérivée du premier ordre
sol=solve(dV==0, dw2)
impder=(sol[0]/dw1)
return impder
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.