def time3(n=5): import swiginac x,y,z = map(swiginac.symbol,'xyz') v,w = map(swiginac.wild,[1,2]) pattern = (v*w)**swiginac.sin(x+w) expr = (x*y**2)**swiginac.sin(x+y**2) pattern = (v*w) expr = (x*y**2) l = [] t1 = clock() while n: m=expr.match(pattern,l) n -= 1 t2 = clock() print l,m assert m=={w:y**2,v:x},`m` print 'time3:',t2-t1 return 100 / (t2-t1)
def time3(n=5): import swiginac x, y, z = map(swiginac.symbol, 'xyz') f = (x / (1 + swiginac.sin(x**(y + x**2)))**2) t1 = clock() while n: f = f.diff(x) n -= 1 t2 = clock() print 'time3:', t2 - t1 return 100 / (t2 - t1)
def time3(n=5): import swiginac x,y,z = map(swiginac.symbol,'xyz') f = (x / (1+swiginac.sin(x**(y+x**2)))**2) t1 = clock() while n: f = f.diff(x) n -= 1 t2 = clock() print 'time3:',t2-t1 return 100 / (t2-t1)
def sin(e): return Expr(_g.sin(e()), e.spatial_symbs, time=e.time)