Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I managed to speed it up a bit by using fast_callable, but annoyingly the function contour_plot does not take CDF, only RDF. Note that if I change RDF in the definition of F to CDF, countour_plot complains.

ff(z) =(z^3)/3 - Z*z 
ffr(z) = ff(z).real()
f = fast_callable(ff, domain=CDF, vars='z')
fr = fast_callable(ffr, domain=CDF, vars='z')                 
P=complex_plot(fr, (-5,5), (-5,5), plot_points=200)  
Roots=derivative(ff(z),z).roots(ring=CDF)    
R = [(Roots[i][0].real(),Roots[i][0].imag()) for i in range(len(Roots))]
F = fast_callable(ff(x+I*y).imag(), vars = ('x','y'),domain=RDF)
COL=["blue","purple", "orange","green", "black"]
cont=[F(R[i][0],R[i][1]) for i in range(len(R))]
C = contour_plot(F, (x,-5,5), (y,-5,5), contours=tuple(cont), fill=false, cmap = COL)
return P+point(R,zorder=2) + point((Z.real(),Z.imag()),zorder=1,size=50,color="yellow")+ C

image:example