reb
Class REB_CayleyMandel

Object
  extended by common:Generic
      extended by common:Formula
          extended by common:ConvergentFormula
              extended by reb:REB_CayleyMandel

class 
ConvergentFormula:REB_CayleyMandel

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_CayleyMandel(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_CayleyMandel(Generic pparent)
      ConvergentFormula.ConvergentFormula(pparent)
    endfunc
 
   ; initialize the formula
   complex func Init(complex pz)
     ConvergentFormula.Init(pz)
     m_c = pz
     fz = 0
     fzp = 0
     fzp2 = 0
     oldz = 0
     m_iterations = 0
     pz = 0
     return pz
   endfunc
 
   complex func Iterate(complex pz)
     ConvergentFormula.Iterate(pz)
     oldz = pz
     fz = pz^3 - m_c*pz - m_c + 1
     fzp = 3*pz^2 - m_c
     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
    complex m_c
 
 default:
   title = "Cayley Mandel"
   int param v_cayleymandel
     caption = "Version (Cayley Mandel)"
     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_cayleymandel < 101
   endparam
   float param p_bailout
     caption = "Bailout value"
     default = 1e-12
   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
 }
 


Constructor Summary
REB_CayleyMandel()
           
REB_CayleyMandel(Generic pparent)
          constructor
 
Method Summary
 complex Init(complex pz)
          initialize the formula
 complex Iterate(complex pz)
          Produce the next value in the sequence
 
Methods inherited from class common:ConvergentFormula
GetLowerBailout, IsBailedOut
 
Methods inherited from class common:Formula
GetPrimaryExponent, GetUpperBailout
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

REB_CayleyMandel

public REB_CayleyMandel(Generic pparent)
constructor


REB_CayleyMandel

public REB_CayleyMandel()
Method Detail

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)
Description copied from class: ConvergentFormula
Produce the next value in the sequence

As long as the sequence has not bailed out, this function will be continually called to produce sequence values.

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