# Revision history [back]

### Continued fraction expansion of quadratic irrationals

Let me emphasize that I am very new to sage and to computing in general, but I did research as much as I can before asking this question.

It is well know that that quadratic irrationals has eventually periodic expansion. I really tried to find a function that gives me the period of a given quadratic irrational. The best I could find was in this forum: http://www.mail-archive.com/sage-support@googlegroups.com/msg04201.html

It explains that you can get using GAP the PrePeriod+Period. It has two disadvantages: the first, you can't get the pure period, i.e., without the preperiod, and the second is that it is defined using the polynomial and only the ones with one positive root works.

I tried to look also in PARI and didn't find anything. I did see that it is written that sage itself does not have this function.

My question: Is there a way (via packages that are contained in sage) to find the period of a given quadratic irrational?

Thanks a lot! Menny

### Continued fraction expansion of quadratic irrationals

Let me emphasize that I am very new to sage and to computing in general, but I did research as much as I can could before asking this question.

It is well know that that quadratic irrationals has eventually periodic continued fraction expansion. I really tried to find a function that gives me the period of a given quadratic irrational. The best I could find was in this forum: http://www.mail-archive.com/sage-support@googlegroups.com/msg04201.html

It explains that you can get using GAP the PrePeriod+Period. It has two disadvantages: the first, you can't get the pure period, i.e., without the preperiod, and the second is that it is defined using the input is not the number itself but the polynomial and only the ones with one it solve. If this polynomial has many positive root works.roots it is a problem...

I tried to look also in PARI and didn't find anything. I did see that it is written that sage itself does not have this function.

Let me also remark that such algorithm exist. My question: Is there a way (via packages that are contained in sage) to find the period of a given quadratic irrational?

Thanks a lot! Menny