[Python] How can I define a mathematical function in SymPy?

Discussão em 'Python' iniciado por Stack, Setembro 13, 2025.

  1. Stack

    Stack Membro Participativo

    I've been trying this now for hours. I think I don't understand a basic concept, and that's why I couldn't answer this question to myself so far.

    I'm trying to implement a simple mathematical function, like this:

    f(x) = x**2 + 1


    After that, I want to derive that function.

    I've defined the symbol and function with:

    x = sympy.Symbol('x')
    f = sympy.Function('f')(x)


    Now I'm struggling with defining the equation to this function f(x). Something like f.exp("x**2 + 1") is not working.

    How could I get a printout to the console of this function after it's finally defined?

    Continue reading...

Compartilhe esta Página