(self, n=None, re_min=-1, im_min=-1, re_max=1, im_max=1)
return None
Return self evaluated, if possible, replacing free symbols with
        random complex values, if necessary.

        The random complex value for each free symbol is generated
        by the random_complex_number routine giving real and imaginary
        parts in the range given by the re_min, re_max, im_min, and im_max
        values. The returned value is evaluated to a precision of n
        (if given) else the maximum of 15 and the precision needed
        to get more than 1 digit of precision. If the expression
        could not be evaluated to a number, or could not be evaluated
        to more than 1 digit of precision, then None is returned.

        Examples
        ========

        >>> from sympy import sqrt
        >>> from sympy.abc import x, y
        >>> x._random()                         # doctest: +SKIP
        0.0392918155679172 + 0.916050214307199*I
        >>> x._random(2)                        # doctest: +SKIP
        -0.77 - 0.87*I
        >>> (x + y/2)._random(2)                # doctest: +SKIP
        -0.57 + 0.16*I
        >>> sqrt(2)._random(2)
        1.4

        See Also
        ========

        sympy.utilities.randtest.random_complex_number
Return self evaluated, if possible, replacing free symbols with
        random complex values, if necessary.
Return self evaluated if possible replacing free symbols with random complex values if necessary .
def _random(self, n=None, re_min=-1, im_min=-1, re_max=1, im_max=1):
        """Return self evaluated, if possible, replacing free symbols with
        random complex values, if necessary.

        The random complex value for each free symbol is generated
        by the random_complex_number routine giving real and imaginary
        parts in the range given by the re_min, re_max, im_min, and im_max
        values. The returned value is evaluated to a precision of n
        (if given) else the maximum of 15 and the precision needed
        to get more than 1 digit of precision. If the expression
        could not be evaluated to a number, or could not be evaluated
        to more than 1 digit of precision, then None is returned.

        Examples
        ========

        >>> from sympy import sqrt
        >>> from sympy.abc import x, y
        >>> x._random()                         # doctest: +SKIP
        0.0392918155679172 + 0.916050214307199*I
        >>> x._random(2)                        # doctest: +SKIP
        -0.77 - 0.87*I
        >>> (x + y/2)._random(2)                # doctest: +SKIP
        -0.57 + 0.16*I
        >>> sqrt(2)._random(2)
        1.4

        See Also
        ========

        sympy.utilities.randtest.random_complex_number
        """

        free = self.free_symbols
        prec = 1
        if free:
            from sympy.utilities.randtest import random_complex_number
            a, c, b, d = re_min, re_max, im_min, im_max
            reps = dict(list(zip(free, [random_complex_number(a, b, c, d, rational=True)
                           for zi in free])))
            try:
                nmag = abs(self.evalf(2, subs=reps))
            except TypeError:
                # if an out of range value resulted in evalf problems
                # then return None -- XXX is there a way to know how to
                # select a good random number for a given expression?
                # e.g. when calculating n! negative values for n should not
                # be used
                return None
        else:
            reps = {}
            nmag = abs(self.evalf(2))

        if not hasattr(nmag, '_prec'):
            # e.g. exp_polar(2*I*pi) doesn't evaluate but is_number is True
            return None

        if nmag._prec == 1:
            # increase the precision up to the default maximum
            # precision to see if we can get any significance

            from sympy.mpmath.libmp.libintmath import giant_steps
            from sympy.core.evalf import DEFAULT_MAXPREC as target

            # evaluate
            for prec in giant_steps(2, target):
                nmag = abs(self.evalf(prec, subs=reps))
                if nmag._prec != 1:
                    break

        if nmag._prec != 1:
            if n is None:
                n = max(prec, 15)
            return self.evalf(n, subs=reps)

        # never got any significance
        return None
def _random ( self , n = None , re_min = - 1 , im_min = - 1 , re_max = 1 , im_max = 1 ) : free = self . free_symbols prec = 1 if free : from sympy . utilities . randtest import random_complex_number a , c , b , d = re_min , re_max , im_min , im_max reps = dict ( list ( zip ( free , [ random_complex_number ( a , b , c , d , rational = True ) for zi in free ] ) ) ) try : nmag = abs ( self . evalf ( 2 , subs = reps ) ) except TypeError : # if an out of range value resulted in evalf problems # then return None -- XXX is there a way to know how to # select a good random number for a given expression? # e.g. when calculating n! negative values for n should not # be used return None else : reps = { } nmag = abs ( self . evalf ( 2 ) ) if not hasattr ( nmag , '_prec' ) : # e.g. exp_polar(2*I*pi) doesn't evaluate but is_number is True return None if nmag . _prec == 1 : # increase the precision up to the default maximum # precision to see if we can get any significance from sympy . mpmath . libmp . libintmath import giant_steps from sympy . core . evalf import DEFAULT_MAXPREC as target # evaluate for prec in giant_steps ( 2 , target ) : nmag = abs ( self . evalf ( prec , subs = reps ) ) if nmag . _prec != 1 : break if nmag . _prec != 1 : if n is None : n = max ( prec , 15 ) return self . evalf ( n , subs = reps ) # never got any significance return None