starting to do some shader with Newton fractal I can't understand examples. If I have $$z^{2}+c$$ fractal, it could be presented as a $$(a +b*i)^{2}+c$$ $$a^{2}+2*a*b*i - b^{2}$$ and I will get point with coordinates $$vec2(a^{2} - b^{2}, 2.0*a*b)$$
Now I want to go with $$\frac{2*z^{3}+1}{3*z^{2}}$$ In provided examples is $$float \ \ magnitude = dot(z, z);$$ $$z= \frac{\frac{(2.0 * z + vec2(z.x * z.x - z.y * z.y, -2.0 * z.x * z.y)}{(magnitude * magnitude))}}{3.0}$$ where dot returns the dot product of two vectors, x and y. i.e., x[0]⋅y[0]+x[1]⋅y[1]+...
How to get this result? And how to extrapolate it for example to $$z = z^{4}-1$$ for Newton fractal $$\frac{3*z^{4}+1}{4*z^{3}}$$
Thanks a lot.
If you want separate expressions for real and imaginary parts of complex numbers, you only need to know a few additional things beyond basic algebra:
$$i^2 = -1$$
and
$$ \frac{z}{w} = \frac{z \times \overline{w}}{|w|^2}$$
where
$$ \overline{x + i y} = x - i y$$
and
$$ |w|^2 = w \times \overline{w}$$
The rest is simple algebraic manipulation using associativity, commutativity, distributivity:
$$\begin{aligned} z^2 + c &= (x+iy)^2 + (a+ib) \\&= (x+iy)\times(x+iy)+ (a+ib) \\ &= x \times (x + iy) + iy \times (x + iy) + a + ib \\ &= x \times x + x \times iy + iy \times x + iy \times iy + a + ib \\ &= x^2 + 2 i x y + i^2 y^2 + a + i b \\ &= (x^2 - y^2 + a) + i(2xy + b) \end{aligned}$$
However, this is not a productive thing to do, either working out numerical values by hand, or when writing a computer program. It's usually much better to calculate each basic operation with complex numbers as pairs of numbers numerically, than to try to make a big complicated symbolic expression and then substitute numerical values in at the end.