[Python] How Can I Find the Range of a Function in Sympy

Discussão em 'Python' iniciado por Stack, Setembro 17, 2024.

  1. Stack

    Stack Membro Participativo

    I'm getting started with Sympy and I have some questions. I have a function and I would like to find the domain (all possible x values for f) and the range (all possible y values for f) of that function, I have already been able to get the function domain using continuous_domain but I can't find a way of getting the range.

    This is an example function:

    from sympy import *
    from sympy import Symbol, S
    from sympy.calculus.util import continuous_domain

    x = Symbol("x")
    f = sin(x)/x
    domain = continuous_domain(f, x, S.Reals)
    print(domain)


    Is there any way in Sympy to get the range of a function, if not, how would you accomplish this task?

    Continue reading...

Compartilhe esta Página