Oh, now I see, you are searching for the curvature of a graph. So you have y as a function of x.
>From what you have written I presume that you want the expression for the curvature of a curve when the curve is given in the form "r as a function of theta". I guess that the easiest way to do it is to start from "x and y as functions of a parameter" instead of "y as a function of x". See http://en.wikipedia.org/wiki/Curvature#Local_expressions So here you go: # The parameter t = Symbol('t') # These are FUNCTIONS, not symbols x, y, r, theta = [Function(_)(t) for _ in ['x', 'y', 'r', 'theta']] x, y, r, theta # The substitutions x_in_polar = r*sin(theta) y_in_polar = r*cos(theta) # The general expression for the curvature taken from wikipedia (not too hard to derive) curvature = (x.diff(t)*y.diff(t,t) - y.diff(t)*x.diff(t,t)) / (x.diff(t)**2 + y.diff(t)**2)**(S(3)/2) # After substitution curvature_in_polar = curvature.subs({x:x_in_polar, y:y_in_polar}).doit().simplify() # Now we say: "the parameter is actually theta itself, so theta(t) is just theta" # This is the SYMBOL theta, not the same as the FUNCTION theta stheta = Symbol('theta') curvature_in_polar_parametrized_by_theta = \ curvature_in_polar.subs({theta: stheta, t:stheta}).doit().simplify() print curvature_in_polar_parametrized_by_theta result: (-r(theta)**2 + r(theta)*Derivative(r(theta), theta, theta) - 2*Derivative(r(theta), theta)**2)/(r(theta)**2 + Derivative(r(theta), theta)**2)**(3/2) -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. For more options, visit https://groups.google.com/groups/opt_out.
