From 2f7edc08fc8ac7e3c815c1385f2c25a22b683c74 Mon Sep 17 00:00:00 2001 From: Forrest Hilton Date: Wed, 5 Jul 2023 00:18:53 -0500 Subject: [PATCH 1/2] fix: mandelbrot_plot crashes when given polynomials with parametric critical points --- .../complex_dynamics/mandel_julia_helper.pyx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx b/src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx index 987308e5cb1..2b05648239a 100644 --- a/src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx +++ b/src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx @@ -680,6 +680,15 @@ cpdef polynomial_mandelbrot(f, parameter=None, double x_center=0, sage: f = z^4 - z + c sage: polynomial_mandelbrot(f, pixel_count=100) 100x100px 24-bit RGB image + + :: + + sage: from sage.dynamics.complex_dynamics.mandel_julia_helper import polynomial_mandelbrot + sage: B. = CC[] + sage: R. = B[] + sage: f = z^2*(z-c) + c + sage: polynomial_mandelbrot(f, pixel_count=100) + 100x100px 24-bit RGB image """ cdef: @@ -763,8 +772,9 @@ cpdef polynomial_mandelbrot(f, parameter=None, double x_center=0, df = f.derivative(z).univariate_polynomial() critical_pts = df.roots(multiplicities=False) constant_c = True - except PariError: + except (PariError, TypeError): constant_c = False + critical_pts = [] # If c is in the constant term of the polynomial, then the critical points # will be independent of c. From 7906e8860164da2a7da73ba6f0a6564c451b890c Mon Sep 17 00:00:00 2001 From: Forrest Hilton Date: Thu, 27 Jul 2023 14:27:08 -0500 Subject: [PATCH 2/2] redundant line --- src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx b/src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx index 2b05648239a..62788943b09 100644 --- a/src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx +++ b/src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx @@ -774,7 +774,6 @@ cpdef polynomial_mandelbrot(f, parameter=None, double x_center=0, constant_c = True except (PariError, TypeError): constant_c = False - critical_pts = [] # If c is in the constant term of the polynomial, then the critical points # will be independent of c.