1 | initial version |
This is faster:
mylimit=100
x=var('x')
a=var('a',n=mylimit)
fun1=sum(
[sum(
[sum(
[sum([a[k]*x^(n+1)/RDF(((i+2)*(2*j+1)*(2*(n-k-i)+1))) for k in range(n-i-j+1)])
for j in range(i+1)])
for i in range(n+1)])
for n in range(mylimit)])
with numerically negligible differences (I hope)
2 | No.2 Revision |
This is faster:
mylimit=100
x=var('x')
a=var('a',n=mylimit)
fun1=sum(
[sum(
[sum(
[sum([a[k]*x^(n+1)/RDF(((i+2)*(2*j+1)*(2*(n-k-i)+1))) for k in range(n-i-j+1)])
for j in range(i+1)])
for i in range(n+1)])
for n in range(mylimit)])
with numerically negligible differences (I hope)
For those who don't like SR:
mylimit=100
R = PolynomialRing(QQ,'a',mylimit)
a = R.variable_names()
P = PolynomialRing(QQ,list(a)+['x'])
a = P.gens()[:mylimit]
x = P.gens()[mylimit]
fun1=sum(
[sum(
[sum(
[sum([a[k]*x^(n+1)/((i+2)*(2*j+1)*(2*(n-k-i)+1)) for k in range(n-i-j+1)])
for j in range(i+1)])
for i in range(n+1)])
for n in range(mylimit)])
3 | No.3 Revision |
This is faster:
mylimit=100
x=var('x')
a=var('a',n=mylimit)
fun1=sum(
[sum(
[sum(
[sum([a[k]*x^(n+1)/RDF(((i+2)*(2*j+1)*(2*(n-k-i)+1))) for k in range(n-i-j+1)])
for j in range(i+1)])
for i in range(n+1)])
for n in range(mylimit)])
with numerically negligible differences (I hope)
For those who don't like SR:
mylimit=100
R = PolynomialRing(QQ,'a',mylimit)
a = R.variable_names()
P = PolynomialRing(QQ,list(a)+['x'])
PolynomialRing(QQ,[f'a{i}' for i in range(mylimit)]+['x'])
a = P.gens()[:mylimit]
x = P.gens()[mylimit]
fun1=sum(
[sum(
[sum(
[sum([a[k]*x^(n+1)/((i+2)*(2*j+1)*(2*(n-k-i)+1)) for k in range(n-i-j+1)])
for j in range(i+1)])
for i in range(n+1)])
for n in range(mylimit)])