[Python] How to get an actual expression for the derivative of the lambert W function using...

Discussão em 'Python' iniciado por Stack, Julho 22, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to convert sympy expression into plot-able numerical functions so that I can use matplotlib. I did not want to use numerical differentiation methods, hence the use of sympy in the first place. I am using the lambert W function in the form of sym.LambertW inside on of the expressions and when taking its derivative, I am getting Derivative(...) inside my expression. The problem with this is that sympy's numerical converter lambdify() is giving errors when I try to use it on such expressions. How to get rid of Derivative(...) so that I can use lamdify() and plot the derivative using matplotlib?

    def f(x):
    return sym.re(LambertW(x))

    x = sym.symbols('x')
    der_x = sym.diff(f(x),x)

    print(der_x)


    Output: - Derivative(re(LambertW(x)), x)

    Continue reading...

Compartilhe esta Página