I have couple of  versions of computing the same function below
f is a polynomial. g is function which returns the same value as f
for given number. g is 10 times faster. Can it be made closer?
See code below

Rishi

{{{id=133|
var('x')

f=x^24+34*x^12+45*x^3+9*x^18 +34*x^10+ 32*x^21

def g(y):
    return y^24+34*y^12+45*y^3+9*y^18 +34*y^10+ 32*y^21
}}}

{{{id=134|
%time
for i in range(10000):
    a=f(x=RR.random_element())
///
CPU time: 14.69 s,  Wall time: 14.99 s
}}}

{{{id=135|
%time
for i in range(10000):
    a=g(y=RR.random_element())
///
CPU time: 1.66 s,  Wall time: 1.68 s
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to