Exemple #1
0
def test_sin():
    """ evaluate sin(n*pi/6), n=0...100
    """
    n = 101
    while n:
        n -= 1
        sin(n * pi / 6)
Exemple #2
0
def test_sin():
    """ evaluate sin(n*pi/6), n=0...100
    """
    n = 101
    while n:
        n -= 1
        sin(n*pi/6)
Exemple #3
0
def time1(n=1):
    from sympycore import Symbol, sin
    x,y,z,v,w = map(Symbol,'xyzvw')
    pattern = (2+v)*(v*w)**sin(x+w)
    expr = (2+x)*(x*y**2)**sin(x+y**2)
    t1 = clock()
    while n:
        m=expr.match(pattern,v,w)
        n -= 1
    t2 = clock()
    assert m=={w:y**2,v:x},`m`
    return 100 / (t2-t1)
Exemple #4
0
def time2(n=1):
    from sympy import Symbol, sin, Wild
    x,y,z = map(Symbol,'xyz')
    v,w = map(Wild,'vw')
    pattern = (2+v)*(v*w)**sin(x+w)
    expr = (2+x)*(x*y**2)**sin(x+y**2)
    t1 = clock()
    while n:
        m=expr.match(pattern)
        n -= 1
    t2 = clock()
    assert m=={w:y**2,v:x},`m`
    #print 'time2:',t2-t1
    return 100 / (t2-t1)
Exemple #5
0
def time1(n=5):
    from sympycore import Symbol, sin
    x, y, z = map(Symbol, 'xyz')
    f = (x / (1 + sin(x**(y + x**2)))**2)
    t1 = clock()
    while n:
        f = f.diff(x)
        n -= 1
    t2 = clock()
    return 100 / (t2 - t1)
Exemple #6
0
def time1(n=5):
    from sympycore import Symbol, sin
    x,y,z = map(Symbol,'xyz')
    f = (x / (1+sin(x**(y+x**2)))**2)
    t1 = clock()
    while n:
        f = f.diff(x)
        n -= 1
    t2 = clock()
    return 100 / (t2-t1)
Exemple #7
0
def time2(n=5):
    from sympy import Symbol, sin
    x, y, z = map(Symbol, 'xyz')
    f = (x / (1 + sin(x**(y + x**2)))**2)
    t1 = clock()
    while n:
        f = f.diff(x)
        n -= 1
    t2 = clock()
    #print 'time2:',t2-t1
    return 100 / (t2 - t1)
Exemple #8
0
def time2(n=5):
    from sympy import Symbol, sin
    x,y,z = map(Symbol,'xyz')
    f = (x / (1+sin(x**(y+x**2)))**2)
    t1 = clock()
    while n:
        f = f.diff(x)
        n -= 1
    t2 = clock()
    #print 'time2:',t2-t1
    return 100 / (t2-t1)
Exemple #9
0
START_REVISION = 300

from sympycore import Symbol, Add, sin
x, y, z = map(Symbol, 'xyz')

f1 = 4 * x**3 + sin(y)**2 * x**2 + x + 1
f2 = (x / (1 + sin(x**(y + x**2)))**2)


def test_diff1():
    """ f=f.diff(x), 5x, f=(x/(1+sin(x**(y+x**2)))**2)
    """
    i = 5
    f = f2
    while i:
        f = f.diff(x)
        i -= 1


def test_diff2():
    """ f.diff(x, 5), f=(x/(1+sin(x**(y+x**2)))**2)
    """
    i = 5
    f = f2
    while i:
        i -= 1
    f = f.diff(x, 5)


def test_integrate():
    """ f = f.integrate(), 100x, f=4*x**3+sin(y)**2*x**2+x+1
Exemple #10
0
START_REVISION=300

from sympycore import Symbol, Add, sin
x,y,z = map(Symbol,'xyz')

f1 = 4*x**3 + sin(y)**2*x**2 + x + 1
f2 = (x / (1+sin(x**(y+x**2)))**2)

def test_diff1():
    """ f=f.diff(x), 5x, f=(x/(1+sin(x**(y+x**2)))**2)
    """
    i = 5
    f = f2
    while i:
        f = f.diff(x)
        i -= 1

def test_diff2():
    """ f.diff(x, 5), f=(x/(1+sin(x**(y+x**2)))**2)
    """
    i = 5
    f = f2
    while i:
        i -= 1
    f = f.diff(x, 5)

def test_integrate():
    """ f = f.integrate(), 100x, f=4*x**3+sin(y)**2*x**2+x+1
    """
    i = 100
    ff = f1