[Python] Declaring a new math function using NumPy

Discussão em 'Python' iniciado por Stack, Março 14, 2025.

  1. Stack

    Stack Membro Participativo

    A simple issue:

    Why does

    import numpy as np
    f = np.sin(x)
    print(f(0.3))


    return an error; whereas

    import numpy as np
    print(np.sin(0.3))


    does not?

    Suppose, for instance I wanted to store f as:

    f(x) = sin(x) + 2*sin(3.4*x)


    How would I go about this?

    Continue reading...

Compartilhe esta Página