Skip to content

Commit 2f7edc0

Browse files
committed
fix: mandelbrot_plot crashes when given polynomials with parametric critical points
1 parent 853d070 commit 2f7edc0

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx

Lines changed: 11 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,8 +772,9 @@ 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
777+
critical_pts = []
768778

769779
# If c is in the constant term of the polynomial, then the critical points
770780
# will be independent of c.

0 commit comments

Comments
 (0)