Re: [sage-support] sagemath x python numpy. Why sage was slower than python?

2016-03-23 Thread jmarcellopereira
Cython using this code? using % Cython does not work quarta-feira, 23 de março de 2016 11:26:16 UTC-3, jmarcell...@ufpi.edu.br escreveu: indeed, using RDF time is reduced: > > %time > > x = srange(1,10,*RDF(0.01)*) > > for k in range(1,len(x)): > > if abs(sin(x[k])*x[k]^2 + cos

Re: [sage-support] sagemath x python numpy. Why sage was slower than python?

2016-03-23 Thread jmarcellopereira
indeed, using RDF time is reduced: %time x = srange(1,10,*RDF(0.01)*) for k in range(1,len(x)): if abs(sin(x[k])*x[k]^2 + cos(x[k])*x[k]^2 + x[k] + cos(sin(x[k]))^2) < 0.0001: print("Valor(y):",sin(x[k])*x[k]^2+cos(x[k])*x[k]^2+x[k]+cos(sin(x[k]))^2," . Raiz(x):

Re: [sage-support] sagemath x python numpy. Why sage was slower than python?

2016-03-23 Thread Jeroen Demeyer
Arithmetic in RR is slower than arithmetic with native C types. If you use RDF instead of RR, Sage will be faster than numpy, especially if you use methods instead of global functions: sage: import numpy as np sage: np1 = np.float64('1'); RR1 = 1.0; RDF1 = RDF(1) sage: timeit('np.sin(np1)', num

[sage-support] sagemath x python numpy. Why sage was slower than python?

2016-03-23 Thread jmarcellopereira
sage code: %time x = srange(1,10,0.01); for k in range(1,len(x)): if abs(sin(x[k])*x[k]^2 + cos(x[k])*x[k]^2 + x[k] + cos(sin(x[k]))^2) < 0.0001: print("Valor(y):",sin(x[k])*x[k]^2+cos(x[k])*x[k]^2+x[k]+cos(sin(x[k]))^2," . Raiz(x): ",x[k]) print("fim") out: 158.45s --