• May 08, 2021, 05:24:16 PM

### Author Topic:  Smooth Coloring for Sine Fractal?  (Read 234 times)

0 Members and 1 Guest are viewing this topic.

#### fractaleye

• Fractal Freshman
• Posts: 2
• creator of Fractal Eye
##### Smooth Coloring for Sine Fractal?
« on: June 09, 2020, 07:17:40 PM »
Hi y'all!

Recently I was reading "On Fractal Coloring Techniques" by Jussi Harkonen...
http://jussiharkonen.com/files/on_fractal_coloring_techniques%28lo-res%29.pdf

... and have been trying to extend the smooth coloring technique from Chapter 3 Section 3 to the fractal
$$z_{n+1} = \sin(z_n) + c$$
and have been struggling with it! It seems that the general idea is to approximate the final radius $$|z_N|$$ in terms of the initial radius $$|z_0|$$, then use a lower bound and upper bound for the final radius to achieve an interpolation between iteration bands. In the case of the Mandelbrot set, the lower bound is the bailout radius $$R$$ and the upper bound is $$R^2$$. This is relatively straightforward for the Mandelbrot set because as $$|z_n|$$ gets larger, $$|z_{n+1}| \approx |z_n|^2$$ which gives the approximation $$|z_N| \approx |z_0|^{2N}$$. Such an approximation is much more difficult to create for the sine fractal because the radius at each iteration is dependent on both the radius and the angle of previous iteration, not to mention that dealing algebraically with inverse tangents and nested trig functions is a nightmare in and of itself!! Would love if anyone could help me with this, or figure out if it's even possible! I know there are other smooth colorings like Exponential Smoothing but I am particularly interested in this method for future use with Triangle Inequality Average, Curvature Average, and Stripe Average colorings.

If it helps, these are some basic properties of $$\sin(z)$$:
$$\sin(z) = \sin(x)\cosh(y) + i\cos(x)\sinh(y)$$
$$|\sin(z)| = \sqrt{\cosh^2(y) - \cos^2(x)}$$
$$\textrm{Arg}(\sin(z)) = \textrm{atan2}(\cos(x)\sinh(y), \sin(x)\cosh(y))$$   which is calculated from
$$\tan^{-1}(\cot(x)\tanh(y))$$

#### marcm200

• 3d
• Posts: 959
##### Re: Smooth Coloring for Sine Fractal?
« Reply #1 on: June 09, 2020, 07:44:01 PM »
As the complex sine is defined as an infinite sum of monomials: Would it be feasible to use an approximation of that sort, say the first 5 or so terms and use the normal polynomial Julia set smooth coloring? Or would the error of the not-evaluated terms make things impossible and be responsible for the problems you're mentioning?

#### fractaleye

• Fractal Freshman
• Posts: 2
• creator of Fractal Eye
##### Re: Smooth Coloring for Sine Fractal?
« Reply #2 on: June 09, 2020, 11:11:08 PM »
As the complex sine is defined as an infinite sum of monomials: Would it be feasible to use an approximation of that sort, say the first 5 or so terms and use the normal polynomial Julia set smooth coloring? Or would the error of the not-evaluated terms make things impossible and be responsible for the problems you're mentioning?

It seems like this works for the most part!! I wrote a custom sine function that uses different series approximations based on the value of $$x_n$$ to avoid as much of the series inaccuracies as possible. Then I use the traditional formula:
$$N - \ln(\frac{1}{2}\ln(|z_N|)) / \ln(p)$$
Instead of using a constant for p like with the Mandelbrot set (p = 2), I calculated the divergence per pixel as:
$$p = \frac{\ln(|z_N|)}{\ln(|z_{N - 1}|)}$$
which yields surprisingly good results!!!

The only real issue now is that the discontinuities are still noticeable with smaller bailout radius like 1e6 and for whatever reason my implementation creates weird artifacts at bailout radius any higher than this :/

The first two images are the series approximation smoothing technique with bailout radius 1e6. The other two are using the smoothing value with the Stripe Average coloring with bailout radius 1e6 and 1e9 respectively. Higher bailout would almost certainly improve results if they didn't create those artifacts!!

#### gerrit

• 3f
• Posts: 2407
##### Re: Smooth Coloring for Sine Fractal?
« Reply #3 on: June 09, 2020, 11:58:37 PM »
As the complex sine is defined as an infinite sum of monomials: Would it be feasible to use an approximation of that sort, say the first 5 or so terms and use the normal polynomial Julia set smooth coloring? Or would the error of the not-evaluated terms make things impossible and be responsible for the problems you're mentioning?
I have used $$e^z \approx (1+z/M)^M$$ for big M and you can use that on sin which is just two exponentials.
Usually looks good even for smallish M and is easy to evaluate.

#### marcm200

• 3d
• Posts: 959
##### Re: Smooth Coloring for Sine Fractal?
« Reply #4 on: June 10, 2020, 12:09:17 PM »
Have you tried p being the degree of your approximation polynomial? The author here https://www.iquilezles.org/www/articles/mset_smooth/mset_smooth.htm shows a nice degree.7 Julia set with smooth coloring.

If you follow a point's orbit that eventually produces the artefacts, but this time you do it with interval arithmetics and outward rounding: How large is the resulting complex interval around the true iterate? If it is only a few mantissa bits wide, I'd say that numerical error accumulation is not the (main) source of the artefacts.

A speculation: As the sign of the sine sum terms alternates, maybe using an approximation with a fixed number of terms introduces a bias towards the accumulation of error as it always ends in the same sign? Maybe using an even number of terms at one iterational step and an odd number the next and then switch back can undo this (partially)?

### Similar Topics

###### Smooth coloring for z->exp(z)+c

Started by shapeweaver on Fractal Mathematics And New Theories

5 Replies
485 Views
March 04, 2020, 12:33:54 PM
by claude
###### Smooth 1D coloring

Started by Spyke on Fractal Mathematics And New Theories

9 Replies
1071 Views
June 11, 2019, 06:09:48 PM
by Spyke
###### Smooth 1D coloring

Started by Spyke on Image Threads

19 Replies
1245 Views
April 25, 2020, 01:56:34 PM
###### Smooth histogram coloring failure

Started by Smolt on Programming

3 Replies
474 Views
August 23, 2019, 03:47:41 AM
by Duncan C
###### Help wanted: Domain coloring for Ultra Fractal

Started by FractalAlex on UltraFractal

2 Replies
88 Views
March 31, 2021, 04:07:19 AM
by gerrit