sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.42k stars 478 forks source link

Can't multiply continued fractions #20466

Open kcrisman opened 8 years ago

kcrisman commented 8 years ago

There has been some reimplementation on here, so maybe this is no longer true, but this ask.sagemath post anyway points out

sage: x = continued_fraction(pi)
sage: y = 3*x
TypeError: unsupported operand parent(s) for '*': 'Integer Ring' and '<class 'sage.rings.continued_fraction.ContinuedFraction_real'>'

CC: @videlec @slel @sagetrac-tmonteil

Component: number theory

Keywords: continued_fraction

Issue created by migration from https://trac.sagemath.org/ticket/20466

slel commented 8 years ago

Changed keywords from none to continued_fraction

videlec commented 8 years ago
comment:2

See #19120

fchapoton commented 4 years ago
comment:3

maybe we can close as duplicate ?

videlec commented 4 years ago
comment:4

Why would you? #19120 does not implement the full gosper algorithm for (a xy + b x + cy + d) / (e xy + f x + g y + h) but only (ax + b) / (cx + d).

videlec commented 4 years ago
comment:5

Though that could work for 3*x.

fchapoton commented 4 years ago
comment:6

indeed. Y a un algo pour multiplier deux fractions continues quelconques ?

videlec commented 4 years ago
comment:8

Yes, for example http://www.inwap.com/pdp10/hbaker/hakmem/cf.html

fchapoton commented 2 years ago
comment:9

some code in C can be seen here

https://github.com/mjdominus/cf/blob/master/cf_arith.c

and some explanations here

https://www.plover.com/~mjd/cftalk/