TypeError: non-integral exponents not supported

Being new to Sage, I can't understand this error "TypeError: non-integral exponents not supported". This is raised by "find_root" in the following code snippet:

R.<x>=RR[]
n=1000
betas=[0.01,0.03,0.05,0.07,0.99,0.91]
#for beta in betas:
#for beta in srange(0.01,0.09,0.02):
for beta in srange(0.91,0.99,0.02):
f=x^n - 3*x^(n-1)+x^(n-2)+x^(n-3)-2*x^(n-beta*n-1)-3^(beta*n)
find_root(f, 1,4);


But what is strange for me is that if I replace the "for" line with one of the commented line, then it works well. So I think there must be some Sage concepts that I haven't been aware of.

edit retag close merge delete

Sort by » oldest newest most voted

Does the following help (if not, ask for more) ?

sage: for beta in srange(0.91,0.99,0.02):
....:     print n-beta*n-1
....:
89.0000000000000
69.0000000000000
48.9999999999999
28.9999999999999


a numerical noise that can be fixed as follows:

sage: for beta in srange(0.91,0.99,0.02):
....:     print round(n-beta*n-1)
89
69
49
29

more

You declare R.<x>=RR[] but this invokes the normal polynomial ring with positive integer exponents. You should use symbolics for your numeric purposes, as tmonteil has shown to you.

In fact, in mathematics there exist polynomial rings with other type of exponents:

more