What method is complex_number_to_cmap_rgb using to generate its values?
Note: Throughout my question I will be abbreviating complex_number_to_cmap_rgb
as ztc_rgb
. This is not what you should enter if you want to test my code. Use the full and actual name, as I do not want people claiming I am using a non-existent method.
I have 2 questions rolled into 1:
- What method is
ztc_rgb
using to generate values? - How is it impacting my code?
For #1, I have looked at the documentation for ztc_rgb
on SageMath's reference manual (I am using version 10.0 in Ubuntu 22.04.2 on WSL). All I see is info on various ways of displaing argument and magnitude using contours and the like. I want to know what ztc_rgb
is doing under the hood, as that ties into #2.
For #2, This is the code that I'm running, with f=np.poly1d([1,0,0,-1])
($x^3-1$) replacing f=np.poly1d([1,0,0,0,1,0,-1])
:
import numpy as np
f = np.poly1d([1,0,0,0,1,0,-1]) #x^6 + x^2 - 1
fp = np.polyder(f)
c = 700
x = np.linspace(-1,1,c)
y = np.linspace(-1,1,c)
xx,yy = np.meshgrid(x,y)
z = xx+yy*1j
for i in range(8):
z = z - (f(z)/fp(z))
z
n = z.ravel()
n = n.tolist()
from sage.plot.complex_plot import complex_to_cmap_rgb
k = complex_to_cmap_rgb([n], cmap='plasma')
b = k.reshape(c,c,3)
plt.imshow(b)
I get blobs ($x^3-1$) and squiggly lines ($x^6+x^2-1$) in portions of the plot (unable to add images). Can someone tell what's going on, and how I can fix it?
Edit: I think I have fixed my 2nd question, however I will leave this question open for the first.
Look at the code