Exemplo n.º 1
0
def test_infinities():
    assert oo.evalf(chop=True) == inf
    assert (-oo).evalf(chop=True) == ninf
Exemplo n.º 2
0
                   Function, Poly, PurePoly, pi, root, log, exp, Dummy, Abs)
from sympy.solvers.inequalities import (reduce_inequalities,
                                        solve_poly_inequality as psolve,
                                        reduce_rational_inequalities,
                                        solve_univariate_inequality as isolve,
                                        reduce_abs_inequality,
                                        _solve_inequality)
from sympy.polys.rootoftools import rootof
from sympy.solvers.solvers import solve
from sympy.solvers.solveset import solveset
from sympy.abc import x, y

from sympy.utilities.pytest import raises, slow, XFAIL


inf = oo.evalf()


def test_solve_poly_inequality():
    assert psolve(Poly(0, x), '==') == [S.Reals]
    assert psolve(Poly(1, x), '==') == [S.EmptySet]
    assert psolve(PurePoly(x + 1, x), ">") == [Interval(-1, oo, True, False)]


def test_reduce_poly_inequalities_real_interval():
    assert reduce_rational_inequalities(
        [[Eq(x**2, 0)]], x, relational=False) == FiniteSet(0)
    assert reduce_rational_inequalities(
        [[Le(x**2, 0)]], x, relational=False) == FiniteSet(0)
    assert reduce_rational_inequalities(
        [[Lt(x**2, 0)]], x, relational=False) == S.EmptySet
Exemplo n.º 3
0
                   Function, Poly, PurePoly, pi, root, log, exp, Dummy, Abs,
                   Piecewise)
from sympy.solvers.inequalities import (reduce_inequalities,
                                        solve_poly_inequality as psolve,
                                        reduce_rational_inequalities,
                                        solve_univariate_inequality as isolve,
                                        reduce_abs_inequality,
                                        _solve_inequality)
from sympy.polys.rootoftools import rootof
from sympy.solvers.solvers import solve
from sympy.solvers.solveset import solveset
from sympy.abc import x, y

from sympy.utilities.pytest import raises, XFAIL

inf = oo.evalf()


def test_solve_poly_inequality():
    assert psolve(Poly(0, x), '==') == [S.Reals]
    assert psolve(Poly(1, x), '==') == [S.EmptySet]
    assert psolve(PurePoly(x + 1, x), ">") == [Interval(-1, oo, True, False)]


def test_reduce_poly_inequalities_real_interval():
    assert reduce_rational_inequalities([[Eq(x**2, 0)]], x,
                                        relational=False) == FiniteSet(0)
    assert reduce_rational_inequalities([[Le(x**2, 0)]], x,
                                        relational=False) == FiniteSet(0)
    assert reduce_rational_inequalities([[Lt(x**2, 0)]], x,
                                        relational=False) == S.EmptySet
Exemplo n.º 4
0
"""
Created on Mon Jun 24 09:48:39 2019

@author: arianafm
"""

from sympy import pi, E, oo, cos
#E : Euler
#oo : Infinito
radio = 5
#Sin el evalf la operación queda expresada únicamente.
area = pow((pi.evalf() * radio), 2)
print(area)
#5**3
print(E.evalf())
print(oo.evalf())

# V A R I A B L E S  S I M B Ó L I C A S
#a
#Símbolos
x = Symbol('x')
y = Symbol('y')
print(x)
print(y)
#Muchos símbolos a la vez
a, b, c = symbols('a,b,c')
print(a, b, c)

#Te devuelve una tupla que va desde q hasta w
variables = var('q:w')
print(variables)