Processing math: 100%
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

asked 9 years ago

mirgee gravatar image

Implementing new CF class advice

My goal is to implement Gosper's algorithm for algebraic operations on continued fractions into Sage. To begin with, I would like to implement a functionality to perform a homographic transformation

xax+bcx+d

where x is a CF.

The easiest way to do this is probably to create a new class in sage.rings.continued_fraction that would on inicialization accept the integer constants a,b,c,d and a descendant of ContinuedFraction_base class. The most important method of this class would be next() or iter(), which would read the input x until it can output new term using Gosper's algorithm.

Should this new class be a descendant of ContinuedFraction_base class, or some other? Maybe ContinuedFraction_infinite?

And most importantly, how do I create an instance of this class with proper arguments, when for example (3x+1)/2, where x is a CF, is called from Sage?

Thank you very much for any advice on this!

click to hide/show revision 2
No.2 Revision

Implementing new CF class advice

My goal is to implement Gosper's algorithm for algebraic operations on continued fractions into Sage. To begin with, I would like to implement a functionality to perform a homographic transformation

xax+bcx+d

where x is a CF.

The easiest way to do this is probably to create a new class in sage.rings.continued_fraction sage.rings.continued_fraction that would on inicialization accept the integer constants a,b,c,d and a descendant of ContinuedFraction_base ContinuedFraction_base class. The most important method of this class would be next() or iter()_iter_(), which would read the input x until it can output new term using Gosper's algorithm.

Should this new class be a descendant of ContinuedFraction_base class, or some other? Maybe ContinuedFraction_infinite?

And most importantly, how How do I create an instance of this class with proper arguments, when for example (3x+1)/2, where x is a CF, is called from Sage?

Thank you very much for any advice on this!

click to hide/show revision 3
No.3 Revision

Implementing new CF class advice

My goal is to implement Gosper's algorithm for algebraic operations on continued fractions into Sage. To begin with, I would like to implement a functionality to perform a homographic transformation

xax+bcx+d

where x is a CF.

The easiest way to do this is probably to create a new class in sage.rings.continued_fraction that would on inicialization accept the integer constants a,b,c,d and a descendant of ContinuedFraction_base class. The most important method of this class would be next() or _iter_(), which would read the input x until it can output new term using Gosper's algorithm.

How do I create an instance of this class with proper arguments, when for example (3x+1)/2, where x is a CF, is called from Sage?

Thank you very much for any advice on this!

EDIT: I have just found this link. Hopefully I will find something useful in there.

click to hide/show revision 4
No.4 Revision

Implementing new CF class advice

My goal is to implement Gosper's algorithm for algebraic operations on continued fractions into Sage. To begin with, I would like to implement a functionality to perform a homographic transformation

xax+bcx+d

where x is a CF.

The easiest way to do this is probably to create a new class in sage.rings.continued_fraction that would on inicialization accept the integer constants a,b,c,d and a descendant of ContinuedFraction_base class. The most important method of this class would be next() or _iter_(), which would read the input x until it can output new term using Gosper's algorithm.

How do I create an instance of this class with proper arguments, when for example (3x+1)/2, where x is a CF, is called from Sage?Sage? (Instead of _mul_() being called, than _add_() and so on...)

Thank you very much for any advice on this!

EDIT: I have just found this promising link. Hopefully I will find something , but haven't found anything useful in there.there so far...

click to hide/show revision 5
No.5 Revision

Implementing new CF class advice

My goal is to implement Gosper's algorithm for algebraic operations on continued fractions into Sage. To begin with, I would like to implement a functionality to perform a homographic transformation

xax+bcx+d

where x is a CF.

The easiest way to do this is probably to create a new class in sage.rings.continued_fraction that would on inicialization accept the integer constants a,b,c,d and a descendant of ContinuedFraction_base class. The most important method of this class would be next() or _iter_(), which would read the input x until it can output new term using Gosper's algorithm.

How do I create an instance of this class with proper arguments, when for example (3x+1)/2, where x is a CF, is called from Sage? (Instead of _mul_() being called, than _add_() and so on...)

Simplifying using inbuilt Sage methods and then evaluating the expression as a string using regular expressions somehow (like this) might be a solution, but I am not sure if the best one.

Thank you very much for any advice on this!

EDIT: I have found this promising link, but haven't found anything useful in there so far...