reb
Class REB_CayleyJulia
Object
common:Generic
common:Formula
common:ConvergentFormula
reb:REB_CayleyJulia
class
- ConvergentFormula:REB_CayleyJulia
Based upon a formula of Mark Townsend.
In addition to the the well-known Newton's method for determining roots of
polynomials, three additional methods can be used: Householder's method,
Halley's method and Schroder's Method. All three are described in Mathworld.
This formula has seven additional methods which are hybrid methods.
One of the unique characteristics of this convergent formula is the presence
of multiple julia sets similar to the classical julia sets. For this formula
they are much smaller and hard to find. The julia sets can be found with the
Newton, Mixed 1, Mixed 2, Mixed 3 and Mixed 4 convergence methods.
Ultra Fractal Source
Toggle UF Source Code Display
class REB_CayleyJulia(common.ulb:ConvergentFormula) {
; Based upon a formula of Mark Townsend. <br>
; <p>
; In addition to the the well-known Newton's method for determining roots of
; polynomials, three additional methods can be used: Householder's method,
; Halley's method and Schroder's Method. All three are described in Mathworld.
; This formula has seven additional methods which are hybrid methods.
; <p>
; One of the unique characteristics of this convergent formula is the presence
; of multiple julia sets similar to the classical julia sets. For this formula
; they are much smaller and hard to find. The julia sets can be found with the
; Newton, Mixed 1, Mixed 2, Mixed 3 and Mixed 4 convergence methods.
public:
import "common.ulb"
; constructor
func REB_CayleyJulia(Generic pparent)
ConvergentFormula.ConvergentFormula(pparent)
endfunc
; initialize the formula
complex func Init(complex pz)
ConvergentFormula.Init(pz)
fz = 0
fzp = 0
fzp2 = 0
oldz = 0
m_iterations = 0
return pz
endfunc
; call for each iterated point
complex func Iterate(complex pz)
ConvergentFormula.Iterate(pz)
complex seed = 0
if @converge == 0 || @converge == 1 || @converge == 2 || @converge == 3 || \
@converge == 4 || @converge == 5 || @converge == 6
seed = @p10
elseif @converge == 7
seed = @p17
elseif @converge == 8
seed = @p18
elseif @converge == 9
seed = @p19
elseif @converge == 10
seed = @p110
endif
oldz = pz
fz = pz^3 - seed*pz - seed + 1
fzp = 3*pz^2 - seed
fzp2 = 6*pz
if @converge == 0 ; Newton
pz = pz - fz/fzp
elseif @converge == 1 ; Householder
pz = pz - fz/fzp*(1 + fz*fzp2/(2*fzp^2))
elseif @converge == 2 ; Halley
pz = pz - 2*fz*fzp/(2*fzp^2 - fz*fzp2)
elseif @converge == 3 ; Schroder
pz = pz - fz*fzp/(fzp^2 - fz*fzp2)
elseif @converge == 4 ; Ho custom
pz = pz - fz/fzp*(1 + fz*fzp2/(@custom*fzp^2))
elseif @converge == 5 ; Ha custom
pz = pz - 2*fz*fzp/(@custom*fzp^2 - fz*fzp2)
elseif @converge == 6 ; H_S custom
pz = pz - @custom*fz*fzp/(@custom*fzp^2 - fz*fzp2)
elseif @converge == 7 ; Mixed 1
if m_iterations % 2 == 0
pz = pz - fz/fzp*(1 + fz*fzp2/(2*fzp^2))
else
pz = pz - fz/fzp
endif
elseif @converge == 8 ; Mixed 2
if m_iterations % 2 == 0
pz = pz - 2*fz*fzp/(2*fzp^2 - fz*fzp2)
else
pz = pz - fz/fzp
endif
elseif @converge == 9 ; Mixed 3
if m_iterations % 2 == 0
pz = pz - fz*fzp/(fzp^2 - fz*fzp2)
else
pz = pz - fz/fzp
endif
elseif @converge == 10 ; Mixed 4
if m_iterations % 2 == 0
pz = pz - @custom*fz*fzp/(@custom*fzp^2 - fz*fzp2)
else
pz = pz - fz/fzp
endif
endif
return pz
endfunc
protected:
complex fz
complex fzp
complex fzp2
complex oldz
default:
title = "Cayley Julia"
int param v_cayleyjulia
caption = "Version (Cayley Julia)"
default = 101
hint = "This version parameter is used to detect when a change has been made to the formula that is incompatible with the previous version. When that happens, this field will reflect the old version number to alert you to the fact that an alternate rendering is being used."
visible = @v_cayleyjulia < 101
endparam
float param p_bailout
caption = "Bailout value"
default = 1e-12
endparam
param p10
caption = "Julia seed"
default = (0.360968017578125,0.00074462890625)
visible = (@converge == 0 || @converge == 1 || @converge == 2 || @converge == 3 || \
@converge == 4 || @converge == 5 || @converge == 6)
endparam
param p17
caption = "Julia seed"
default = (0.31216913789,1.38719537118)
visible = @converge==7
endparam
param p18
caption = "Julia seed"
default = (0.0973120321799,1.15430065766)
visible = @converge==8
endparam
param p19
caption = "Julia seed"
default = (0.127944,0.186804)
visible = @converge==9
endparam
param p110
caption = "Julia seed"
default = (-0.009955549007286, 0.9678595903229)
visible = @converge==10
endparam
heading
caption = "Convergence Methods"
endheading
param converge
caption = "Convergence Method"
default = 0
enum = "Newton" "Householder" "Halley" "Schroder" "Ho Custom" \
"Ha Custom" "H_S Custom" "Mixed1" "Mixed2" "Mixed3" "Mixed4"
endparam
float param custom
caption = "H_S Constant"
default = 1.5
visible = @converge==4 || @converge==5 || @converge==6 || @converge==10
endparam
param p_power
caption = "Power"
default = (3,0)
visible = false
endparam
}
Methods inherited from class Object |
|
REB_CayleyJulia
public REB_CayleyJulia(Generic pparent)
- constructor
REB_CayleyJulia
public REB_CayleyJulia()
Init
public complex Init(complex pz)
- initialize the formula
- Overrides:
Init
in class ConvergentFormula
- Parameters:
pz
- seed value for the sequence; for a normal fractal formula, this will be #pixel
- Returns:
- first value in the sequence; this corresponds to #z in a fractal formula
Iterate
public complex Iterate(complex pz)
- call for each iterated point
- Overrides:
Iterate
in class ConvergentFormula
- Parameters:
pz
- previous value in the sequence; corresponds to #z in a fractal formula. Note that you should always use this value for computing the next iteration, rather than a saved value, as the calling code may modify the returned value before passing it back to the next Iterate() call.
- Returns:
- the next value in the sequence