- 注册时间
- 2007-12-28
- 最后登录
- 1970-1-1
- 威望
- 星
- 金币
- 枚
- 贡献
- 分
- 经验
- 点
- 鲜花
- 朵
- 魅力
- 点
- 上传
- 次
- 下载
- 次
- 积分
- 12787
- 在线时间
- 小时
|
发表于 2012-2-28 12:03:19
|
显示全部楼层
连分数作为基本类型,或许是可行的,不过我不建议这样做,在许多方面,用连分数作为变量类型都显得太复杂了。
在 mathworld的continued fraction 条目中,有如下描述
Gosper has invented an algorithm for performing analytic addition, subtraction, multiplication, and division using continued fractions. It requires keeping track of eight integers which are conceptually arranged at the polyhedron vertices of a cube. Although this algorithm has not appeared in print, similar algorithms have been constructed by Vuillemin (1987) and Liardet and Stambul (1998).
Gosper's algorithm for computing the continued fraction for (ax+b)/(cx+d) from the continued fraction for x is described by Gosper (1972), Knuth (1998, Exercise 4.5.3.15, pp. 360 and 601), and Fowler (1999). (In line 9 of Knuth's solution, $x_k larr min(|__A//C__|)$
should be replaced by $x_k larr min(|__A//C__|,|__(A+B)//(C+D)__|)$ Gosper (1972) and Knuth (1981) also mention the bivariate case $(axy+bx+cy+d)//(Axy+Bx+Cy+D)$
不过,从这段摘要性的内容,我并没有搞明白其具体实现,如果你有兴趣,可研读之。 |
|