Hi everybody, I am pretty new to symbolic math and Sage but I love it!!!!.
I am trying create a function which returns an tangent line at a given point (xpoint) in a function f(x) already known as follows: var('x') f(x): x**2 def tangent(xpoint): def secant(xpoint): # function of the form f(x) = a + bx df = f.differentiate(x) m = df(xpoint) # slope is the derivative of the function in that point a = f(xpoint) - m*(xpoint) # coordinate return g(x) = a + m*x however this returns \none and I cannot use it later. I guess I am doing something essentially wrong from the pythonic point of view, but I cannot figure out how to create this function to call it later in a interactive cell with @interact. def plot_example(r=range_slider(0,10,step_size=1),xtangent=(2,(0..10)),xsecant=(7,(0..10))): show(plot(tangent(xtangent))) Thank you very much for your help, and my apologizes in advance if the question is too trivial. Jose. --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---