@@ -310,7 +310,7 @@ def frange(*args, **kwargs):
310
310
>>> frange('lambda x: sqrt(x)', 1, 4) # doctest: +ELLIPSIS
311
311
<__main__.c_double_Array_3 object at ...>
312
312
>>> for i in _:
313
- ... print i
313
+ ... print(i)
314
314
...
315
315
1.0
316
316
1.41421356237
@@ -544,8 +544,8 @@ def fbenchmark(f, var=[Symbol('x')]):
544
544
global cf , pf , psyf
545
545
start = time ()
546
546
cf = clambdify (var , f )
547
- print 'compile time (including sympy overhead): %f s' % (
548
- time () - start )
547
+ print ( 'compile time (including sympy overhead): %f s' % (
548
+ time () - start ))
549
549
pf = lambdify (var , f , 'math' )
550
550
psyf = None
551
551
psyco = import_module ('psyco' )
@@ -560,14 +560,14 @@ def fbenchmark(f, var=[Symbol('x')]):
560
560
t3 = Timer (code , 'from __main__ import psyf as f' )
561
561
else :
562
562
t3 = None
563
- print 'for x = (0, 1, 2, ..., 999)/1000'
564
- print '20 times in 3 runs'
565
- print 'compiled: %.4f %.4f %.4f' % tuple (t1 .repeat (3 , 20 ))
566
- print 'Python lambda: %.4f %.4f %.4f' % tuple (t2 .repeat (3 , 20 ))
563
+ print ( 'for x = (0, 1, 2, ..., 999)/1000' )
564
+ print ( '20 times in 3 runs' )
565
+ print ( 'compiled: %.4f %.4f %.4f' % tuple (t1 .repeat (3 , 20 ) ))
566
+ print ( 'Python lambda: %.4f %.4f %.4f' % tuple (t2 .repeat (3 , 20 ) ))
567
567
if t3 :
568
- print 'Psyco lambda: %.4f %.4f %.4f' % tuple (t3 .repeat (3 , 20 ))
568
+ print ( 'Psyco lambda: %.4f %.4f %.4f' % tuple (t3 .repeat (3 , 20 ) ))
569
569
570
- print 'big function:'
570
+ print ( 'big function:' )
571
571
from sympy import _exp , _sin , _cos , pi , lambdify
572
572
x = Symbol ('x' )
573
573
## f1 = diff(_exp(x)**2 - _sin(x)**pi, x) \
@@ -577,33 +577,33 @@ def fbenchmark(f, var=[Symbol('x')]):
577
577
+ 4 * (10 * pi ** 3 * x ** 2 + 10 * pi ** 2 * x ** 3 + 5 * pi * x ** 4 + 5 * x * pi ** 4 + pi ** 5
578
578
+ x ** 5 )* _exp (123 + x + 2 * x ** 4 - x ** 5 ) - 2 * x ** 3 - 3 * x ** 7
579
579
fbenchmark (f1 )
580
- print
581
- print 'simple function:'
580
+ print ()
581
+ print ( 'simple function:' )
582
582
y = Symbol ('y' )
583
583
f2 = sqrt (x * y ) + x * 5
584
584
fbenchmark (f2 , [x , y ])
585
585
times = 100000
586
586
fstr = '_exp(_sin(_exp(-x**2)) + sqrt(pi)*_cos(x**5/(x**3-x**2+pi*x)))'
587
587
print
588
- print 'frange with f(x) ='
589
- print fstr
590
- print 'for x=1, ..., %i' % times
591
- print 'in 3 runs including full compile time'
588
+ print ( 'frange with f(x) =' )
589
+ print ( fstr )
590
+ print ( 'for x=1, ..., %i' % times )
591
+ print ( 'in 3 runs including full compile time' )
592
592
t4 = Timer ("frange('lambda x: %s', 0, %i)" % (fstr , times ),
593
593
'from __main__ import frange' )
594
594
595
595
numpy = import_module ('numpy' )
596
596
597
- print 'frange: %.4f %.4f %.4f' % tuple (t4 .repeat (3 , 1 ))
597
+ print ( 'frange: %.4f %.4f %.4f' % tuple (t4 .repeat (3 , 1 ) ))
598
598
if numpy :
599
599
t5 = Timer ('x = arange(%i); result = %s' % (times , fstr ),
600
600
'from numpy import arange, sqrt, exp, sin, cos, exp, pi' )
601
- print 'numpy: %.4f %.4f %.4f' % tuple (t5 .repeat (3 , 1 ))
601
+ print ( 'numpy: %.4f %.4f %.4f' % tuple (t5 .repeat (3 , 1 ) ))
602
602
# TODO: integration into fbenchmark
603
603
604
604
if __name__ == '__main__' :
605
605
if __debug__ :
606
- print 'Running tests...' ,
606
+ print ( 'Running tests...' ,)
607
607
numpy = import_module ('numpy' )
608
608
test_cexpr ()
609
609
test_clambdify ()
@@ -614,7 +614,7 @@ def fbenchmark(f, var=[Symbol('x')]):
614
614
test_use_cse ()
615
615
import doctest
616
616
doctest .testmod ()
617
- print 'OK'
617
+ print ( 'OK' )
618
618
print
619
- print 'Running benchmark...'
619
+ print ( 'Running benchmark...' )
620
620
benchmark ()
0 commit comments