Ask Your Question
1

TypeError: non-integral exponents not supported

asked 2015-05-05 04:47:27 -0500

Léo gravatar image

updated 2015-05-05 11:11:13 -0500

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.

Thanks for your help!

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted
1

answered 2015-05-05 11:09:02 -0500

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:

edit flag offensive delete link more
1

answered 2015-05-05 05:20:42 -0500

tmonteil gravatar image

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
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-05-05 04:47:27 -0500

Seen: 253 times

Last updated: May 05 '15