Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apply_homography unstable for continued fraction #32086

Open
kliem opened this issue Jun 29, 2021 · 1 comment
Open

apply_homography unstable for continued fraction #32086

kliem opened this issue Jun 29, 2021 · 1 comment

Comments

@kliem
Copy link
Contributor

kliem commented Jun 29, 2021

sage -t --long --random-seed=9349834848432 src/sage/rings/continued_fraction.py
**********************************************************************
File "src/sage/rings/continued_fraction.py", line 1189, in sage.rings.continued_fraction.ContinuedFraction_base.apply_homography
Failed example:
    for _ in range(100):
        cf = choice(CF)
        forward_value = choice([True, False])
        a = ZZ.random_element(-30, 30)
        b = ZZ.random_element(-30, 30)
        c = ZZ.random_element(-30, 30)
        d = ZZ.random_element(-30, 30)
        if not c and not d:
            continue
        cf_gosper = cf.apply_homography(a, b, c, d, forward_value)
        x = cf.value()
        cf_hom = continued_fraction((a*x + b) / (c*x + d))
        for i in range(30):
            try:
                assert cf_gosper[i] == cf_hom[i]
            except:
                break
Exception raised:
    Traceback (most recent call last):
      File "/srv/public/kliem/sage/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 714, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/srv/public/kliem/sage/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 1133, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.rings.continued_fraction.ContinuedFraction_base.apply_homography[10]>", line 10, in <module>
        cf_gosper = cf.apply_homography(a, b, c, d, forward_value)
      File "/srv/public/kliem/sage/local/lib/python3.7/site-packages/sage/rings/continued_fraction.py", line 1249, in apply_homography
        return continued_fraction(lazy_list(_i), value)
      File "/srv/public/kliem/sage/local/lib/python3.7/site-packages/sage/rings/continued_fraction.py", line 2627, in continued_fraction
        return ContinuedFraction_infinite(x, value)
      File "/srv/public/kliem/sage/local/lib/python3.7/site-packages/sage/rings/continued_fraction.py", line 2056, in __init__
        k = w[i]
      File "sage/misc/lazy_list.pyx", line 807, in sage.misc.lazy_list.lazy_list_generic.__getitem__ (build/cythonized/sage/misc/lazy_list.c:5101)
        return self.get(key)
      File "sage/misc/lazy_list.pyx", line 651, in sage.misc.lazy_list.lazy_list_generic.get (build/cythonized/sage/misc/lazy_list.c:4628)
        raise IndexError("lazy list index out of range")
    IndexError: lazy list index out of range

In #29979, a doctest was marked not tested because of this.

CC: @slel

Component: commutative algebra

Keywords: continued fraction homography

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

@kliem kliem added this to the sage-9.4 milestone Jun 29, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.4, sage-9.5 Aug 22, 2021
@mwageringel

This comment has been minimized.

@slel slel changed the title apply_homography unstable for continue fraction apply_homography unstable for continued fraction Sep 23, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.5, sage-9.6 Dec 18, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.6, sage-9.7 May 3, 2022
@mkoeppe mkoeppe modified the milestones: sage-9.7, sage-9.8 Sep 19, 2022
@mkoeppe mkoeppe removed this from the sage-9.8 milestone Jan 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants