1 | initial version |

Preparsing as your first link is mostyl impossible because the expression `(3∗x+1)/2`

could appear with various types of `x`

, and it would be very hard from the parser to infer how to deal with it with just knowing a small string.

The problem is that you do not want to override the addition and multiplication, but if you want to write `(3∗x+1)/2`

, the interpreter will start by doing `3*x`

as a multiplication. So what you have to do is to define the action of a homography (taken as a whole) on a continued fraction.

For this, you can either define an `apply_homography`

method in the `ContinuedFraction_*`

classes where your algorithm can be applied (the highest in the hierarchy is the best to avoid repetitions).

Otherwise, if you have many methods to develop about homographies (not only Gosper algorithm), you can create a `Homography`

class and define a product `h * cf`

to be understood as the action of the homography `h`

on the continued fraction `cf`

.

2 | No.2 Revision |

Preparsing as your first link is mostyl impossible because the expression `(3∗x+1)/2`

could appear with various types of `x`

, and it would be very hard from the parser to infer how to deal with it with just knowing a small string.

The problem is that you do not want to override the addition and multiplication, but if you want to write `(3∗x+1)/2`

, the interpreter will start by doing `3*x`

as a multiplication. So what you have to do is to define the action of a homography (taken as a whole) on a continued fraction.

For this, you can either define an

method in the ~~apply_homography~~apply_homography(self, matrix)`ContinuedFraction_*`

classes where your algorithm can be applied (the highest in the hierarchy is the best to avoid repetitions).

Otherwise, if you have many methods to develop about homographies (not only Gosper algorithm), you can create a `Homography`

class and define a product `h * cf`

to be understood as the action of the homography `h`

on the continued fraction `cf`

.

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.