Here is a formula like the one you were doing.
MandelFoamPT {
init:
z = sqrt(-1/2)
complex w = sqrt(1/2)
loop:
complex wo = w
w = w/z
z = z^2 + wo^2 + #pixel
bailout:
|z| <= @bailout
perturbinit:
#dz = 0
w = sqrt(1/2)
perturbloop:
wo = w
w = w/#z;
#dz = 2*#z*#dz + sqr(#dz) + sqr(wo) + #dpixel
default:
title = "MandelFoamPT"
center = (0, 0)
float param bailout
caption = "Bailout value"
default = 1e16
endparam
}
This runs but the perturbation doesn't ever apply. This is because the term sqr(wo) in the perturb loop is large. Refer to the help file under "Perturbation equations" where it says
In short, if your formula can be reduced so all terms are small (in the order of dz or dc), it will work with perturbation calculations.
You would have to be able to rewrite the perturbloop changing the sqr(wo) term somehow so that it is small, perhaps using a "dw" that is small. It doesn't look to me as if this is possible, as w changes a lot from iteration to iteration, but maybe there is a way.
Some formulas just don't work with perturbation.
_
Here is a formula like the one you were doing.
````
MandelFoamPT {
init:
z = sqrt(-1/2)
complex w = sqrt(1/2)
loop:
complex wo = w
w = w/z
z = z^2 + wo^2 + #pixel
bailout:
|z| <= @bailout
perturbinit:
#dz = 0
w = sqrt(1/2)
perturbloop:
wo = w
w = w/#z;
#dz = 2*#z*#dz + sqr(#dz) + sqr(wo) + #dpixel
default:
title = "MandelFoamPT"
center = (0, 0)
float param bailout
caption = "Bailout value"
default = 1e16
endparam
}
````
This runs but the perturbation doesn't ever apply. This is because the term sqr(wo) in the perturb loop is large. Refer to the help file under "Perturbation equations" where it says
> In short, if your formula can be reduced so all terms are small (in the order of dz or dc), it will work with perturbation calculations.
You would have to be able to rewrite the perturbloop changing the sqr(wo) term somehow so that it is small, perhaps using a "dw" that is small. It doesn't look to me as if this is possible, as w changes a lot from iteration to iteration, but maybe there is a way.
Some formulas just don't work with perturbation.
_