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
--
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
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):
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
Hello!
Thanks! I wasn't aware of libgap! One more followup question. Say I want to
compute the orbits of the CubeGraph of order 10. The description of
respective automorphism group seems to be to heave for libgap
sage: G = graphs.CubeGraph(10)
sage: G.relabel()
sage: A = G.automorphism_gr
On Wednesday, March 23, 2016 at 11:10:42 PM UTC, Jernej wrote:
>
> Hello!
>
> Thanks! I wasn't aware of libgap! One more followup question. Say I want
> to compute the orbits of the CubeGraph of order 10. The description of
> respective automorphism group seems to be to heave for libgap
>
> ==