I have a problem. I tried using perturbation theory for the Magnet Mandelbrot type I fractal, but after going a quadrillion zooms, the image becomes... well, you know what happens.

The code:

```
Magnet1Mandelbrot {
;
; Magnetic Mandelbrot set type 1. Use Switch Mode to select a
; magnetic Julia set.
;
init:
z = @start
c = #pixel
x = real(z)
y = imag(z)
i = sqrt(-1)
loop:
z = ((z^2 + c - 1) / (2*z + c - 2))^2
bailout:
|z| <= @bailout && |z - 1| >= @lowerbailout
$IFDEF VER60
perturbinit:
#dz = 0
dc = #dpixel
perturbloop:
#dz = ((2*z*#dz^2+c*#dz^2-2*#dz^2+2*z^2*#dz+2*c*z*#dz-4*z*#dz-2*c*#dz+2*#dz-z^2*dc+2*z*dc-dc)*(2*z*#dz^2+c*#dz^2-2*#dz^2+6*z^2*#dz+2*c*z*#dz-4*z*#dz+2*c*#dz-2*#dz+z^2*dc+2*z*dc+2*c*dc-3*dc+4*z^3+2*c*z^2-4*z^2+4*c*z-4*z+2*c^2-6*c+4))/((2*z+c-2)^2*(2*#dz+dc+2*z+c-2)^2)
$ENDIF
default:
title = "Magnet 1 (Mandelbrot)"
helpfile = "Uf*.chm"
helptopic = "Html\formulas\standard\magnet.html"
magn = 0.5
maxiter = 100
periodicity = 0
param start
caption = "Perturbation"
default = (0, 0)
hint = "Starting value for each point. You can use this to \
'perturb' the fractal. Use (0, 0) for the classic set."
endparam
param bailout
caption = "Bailout value"
default = 100.0
min = 1
$IFDEF VER40
exponential = true
$ENDIF
hint = "This parameter defines how soon an orbit bails out while \
iterating. Larger values give smoother outlines; smaller values \
generally produce more interesting shapes around the set."
endparam
param lowerbailout
caption = "Convergent bailout value"
default = 0.00005
min = 0
$IFDEF VER40
exponential = true
$ENDIF
hint = "This parameter defines how soon a convergent orbit bails out while \
iterating. Smaller values give more precise results but usually \
require more iterations."
endparam
switch:
type = "Magnet1Julia"
seed = pixel
bailout = bailout
}
```

I have a problem. I tried using perturbation theory for the Magnet Mandelbrot type I fractal, but after going a quadrillion zooms, the image becomes... well, you know what happens.
![6318fc526be8a.png](serve/attachment&path=6318fc526be8a.png)
The code:
````
Magnet1Mandelbrot {
;
; Magnetic Mandelbrot set type 1. Use Switch Mode to select a
; magnetic Julia set.
;
init:
z = @start
c = #pixel
x = real(z)
y = imag(z)
i = sqrt(-1)
loop:
z = ((z^2 + c - 1) / (2*z + c - 2))^2
bailout:
|z| <= @bailout && |z - 1| >= @lowerbailout
$IFDEF VER60
perturbinit:
#dz = 0
dc = #dpixel
perturbloop:
#dz = ((2*z*#dz^2+c*#dz^2-2*#dz^2+2*z^2*#dz+2*c*z*#dz-4*z*#dz-2*c*#dz+2*#dz-z^2*dc+2*z*dc-dc)*(2*z*#dz^2+c*#dz^2-2*#dz^2+6*z^2*#dz+2*c*z*#dz-4*z*#dz+2*c*#dz-2*#dz+z^2*dc+2*z*dc+2*c*dc-3*dc+4*z^3+2*c*z^2-4*z^2+4*c*z-4*z+2*c^2-6*c+4))/((2*z+c-2)^2*(2*#dz+dc+2*z+c-2)^2)
$ENDIF
default:
title = "Magnet 1 (Mandelbrot)"
helpfile = "Uf*.chm"
helptopic = "Html\formulas\standard\magnet.html"
magn = 0.5
maxiter = 100
periodicity = 0
param start
caption = "Perturbation"
default = (0, 0)
hint = "Starting value for each point. You can use this to \
'perturb' the fractal. Use (0, 0) for the classic set."
endparam
param bailout
caption = "Bailout value"
default = 100.0
min = 1
$IFDEF VER40
exponential = true
$ENDIF
hint = "This parameter defines how soon an orbit bails out while \
iterating. Larger values give smoother outlines; smaller values \
generally produce more interesting shapes around the set."
endparam
param lowerbailout
caption = "Convergent bailout value"
default = 0.00005
min = 0
$IFDEF VER40
exponential = true
$ENDIF
hint = "This parameter defines how soon a convergent orbit bails out while \
iterating. Smaller values give more precise results but usually \
require more iterations."
endparam
switch:
type = "Magnet1Julia"
seed = pixel
bailout = bailout
}
````