Skip to content

Commit f85e7b8

Browse files
author
Release Manager
committed
gh-35900: complex_dynamics, fix: mandelbrot_plot throws exception for z^2*(z-c) + c to re-produce the crash: R.<z,c> = CC[] f = z^2*(z-c) + c mandelbrot_plot(expand(f),parameter=c) ### 📚 Description Essential, the modified function has a fast case and a slow case. It tests which one it's working with in a way that will crash if it's the slow case. [The documentation](https://doc.sagemath.org/html/en/reference/dynamics/ sage/dynamics/complex_dynamics/mandel_julia.html#sage.dynamics.complex_d ynamics.mandel_julia.mandelbrot_plot) strongly implies that this would work, so no documentation change. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. It should be `[x]` not `[x ]`. --> - [x] I have created tests covering the changes. URL: #35900 Reported by: Forrest Hilton Reviewer(s): Alexander Galarraga
2 parents 66baa6a + 7906e88 commit f85e7b8

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,15 @@ cpdef polynomial_mandelbrot(f, parameter=None, double x_center=0,
680680
sage: f = z^4 - z + c
681681
sage: polynomial_mandelbrot(f, pixel_count=100)
682682
100x100px 24-bit RGB image
683+
684+
::
685+
686+
sage: from sage.dynamics.complex_dynamics.mandel_julia_helper import polynomial_mandelbrot
687+
sage: B.<c> = CC[]
688+
sage: R.<z> = B[]
689+
sage: f = z^2*(z-c) + c
690+
sage: polynomial_mandelbrot(f, pixel_count=100)
691+
100x100px 24-bit RGB image
683692
"""
684693

685694
cdef:
@@ -763,7 +772,7 @@ cpdef polynomial_mandelbrot(f, parameter=None, double x_center=0,
763772
df = f.derivative(z).univariate_polynomial()
764773
critical_pts = df.roots(multiplicities=False)
765774
constant_c = True
766-
except PariError:
775+
except (PariError, TypeError):
767776
constant_c = False
768777

769778
# If c is in the constant term of the polynomial, then the critical points

0 commit comments

Comments
 (0)