[sage-support] Re: Question regarding speeding up of code

2007-12-11 Thread Martin Albrecht
You need to define a polynomial ring: sage: P. = PolynomialRing(RR) sage: f=x^24+34*x^12+45*x^3+9*x^18 +34*x^10+ 32*x^21 sage: time for i in range(1): a=f(x=RR.random_element()) CPU times: user 0.31 s, sys: 0.00 s, total: 0.31 s Wall time: 0.32 sage: def g(y): : return y^24+34*y

[sage-support] Re: Question regarding speeding up of code

2007-12-11 Thread William Stein
On Dec 11, 2007 8:34 AM, Rishikesh <[EMAIL PROTECTED]> wrote: > 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? Make your function f be a polynomia