5

Is there a way, using sympy, to figure out (some) properties of a function, thought of as a real function?

For example, if

>>> x = Symbol('x', real=True)
>>> f = Lambda(x, sqrt((x-2)/(x+2)))

then something like

>>> f.domain()
(-oo, -2) U [2, oo)
>>> f.image()  # there is "imageset", but it is not expanding on the set of reals
[0, 1) U (1, oo)
>>> f.is_injective()
True
>>> f.is_bounded()
False
>>> f.is_even  # currently returns None
False

Some of this is implemented in Wolfram Alpha.

Bach
  • 6,145
  • 7
  • 36
  • 61
  • Some of these properties are likely not implemented. Others have a different meaning, for example is_even is used to query integer parity. – Francesco Bonazzi Jul 11 '16 at 07:13

1 Answers1

3

Some of these are implemented in sympy.calculus.util and sympy.calculus.singularities, although they aren't exported to from sympy import * yet, so you'd have to import them manually. The functionality for some of them is still limited, so you may not yet get an answer.

asmeurer
  • 86,894
  • 26
  • 169
  • 240