This is part seven of the Beginners Guide to Writing Fractal formulas. you can do this tutorial at any time. After a nice rest of our little gray cells we embark on a wild excursion to Switch land. The switch feature allows you to expand the mandel type catalogue into individual Julia type mappings. Or simply stated you can search through your mandel map and see a preview of what the Julia map looks like. click and a Julia mapping comes up. UF has a special section that you can add to a formula after the default section called Switch. I added the switch to our formula and it was way to complicated so I figured I'd make a new fractal for the tutorial. That way I won't loos anyone. In preparation: Start UF Click the edit icon to edit the formula Create two new formula shells one called Ftswitch7M and one called Ftswitch7J So you should have: Ftswitch7M{ Init: Loop: Bailout: Default: } and Ftswitch7J{ Init: Loop: Bailout: Default: } Theses two formulas will be our switch formulas. The switch section is an addon to the end of the formula that looks like the following. Switch: Type = "Ftswitch7J" Other assignments The Type assignment is important because this tells UF what formula to look at and load to do the switch. Lets add a Switch section at the end of our formulas. And make the switch formula connections. Ftswitch7M{ Init: Loop: Bailout: Default: Switch: Type = "Ftswitch7J } and Ftswitch7J{ Init: Loop: Bailout: Default: Switch: Type = "Ftswitch7M } Now lets make up a fractal formula Lets pick an equation to use. (once again a hs algebra book) y = a*b*x/(a^2+x^2) called a serpentine curve Let me see if I can remember what to do... Replace my x with a z y = a*b*z/(a^2+z^2) Replace my y with a z z = a*b*z/(a^2+z^2) Pretty easy, now lets put that into the loop section of the M formula only. Lets initialize the z to #pixel and replace the a's with #pixel. Lets do this in our M formula. So it looks like this: Ftswitch7m{ init: z=#pixel LOOP: z = #pixel*b*z/(#pixel^2+z^2) Bailout: Default: Switch: Type = "Ftswitch7J" } Lets make b user selectable by adding a param block in the default section. Param brad hint = "this is the radius of the circle\ That is tangent to the serpentine curve. Caption = "B Radius" Default = (1.0,0.0) Endparam Lets add above the param block into our formulas default section and put the definition B = @brad In the init section. Lastly lets put the bailout in. |z|<4 (good place to start out anyways) The formula should look like this: Ftswitch7m{ init: b= @brad z=#pixel LOOP: z = #pixel*b*z/(#pixel^2+z^2) Bailout: |z| < 4 Default: Param brad hint = "this is the radius of the circle\ That is tangent to the serpentine curve." Caption = "B in abz/(sqr(a)+sqr(z))" Default = (1.0,0.0) endparam Switch: type = "Ftswitch7J" } Lets save our work make sure we turn on strict type checking and load the M formula to see if its ok. Lets do that. Everything should be very nice at this point. What are we switching anyways? Normally the constant that gets switched is the constant that is being added or operated on by the basic iteration formula. For clarification the mandelbrot map after every iteration terminates has the C initialized to the next pixel value. The Julia map has the C value initialized to the same start value, after every terminated iteration. How does this apply to our formula? In our formula z = #pixel*b*z/(#pixel^2+z^2) The #pixel value is reinitialized to the current starting pixel at every iteration. This is the variable that we want to Julia switch switch. What exactly do we want that switch to do? We want to tell uf, when we click the switch icon, is: What formula do I load for this switch Whats the name of the variable to switch and what value will it have in the switched formula? What other variables do I need to carry over to the switched formula So lets look at our switch section Ftswitch7m{ . . . Switch: type = "Ftswitch7J" } We've told it what the switch formula is already so lets tell it what the variable name is and what value we want it to pass along. In our case it's the value of the pixel as the cursor moves over our image. Ftswitch7m{ . . . Switch: type = "Ftswitch7J" flop = #pixel } And now we need to carry over whatever variables we are currently using. Ftswitch7m{ . . . Switch: type = "Ftswitch7J" flop = #pixel brad = brad } and that is it now we have to finish the J formula and were done. Lets look at the J formula right now. Ftswitch7J{ INIT: LOOP: BAILOUT: DEFAULT: Switch: type = "Ftswitch7M" } Wholely crud there's nothing there...what do we do now? Lets populate the sections just like we did the m formula. The init section will stay the same b and z need to be initialized. Ftswitch7j{ init: b= @brad z=#pixel In the loop section we need to change the #pixel entries to @flop LOOP: z = @flop*b*z/(@flop^2+z^2) The bailout section will stay the same. Bailout: |z| < 4 The default section will remain the same. Default: Param brad hint = "this is the radius of the circle\ That is tangent to the serpentine curve." Caption = "B in abz/(sqr(a)+sqr(z))" Default = (1.0,0.0) endparam The switch section is all that remains. We know the name of the switch back formula We don't need to send the flop value back We do need to send the brad variable back. Switch: type = "Ftswitch7M" brad = brad } So your J formula should now look like: Ftswitch7J{ init: b= @brad z=#pixel LOOP: z = @flop*b*z/(@flop^2+z^2) Bailout: |z| < 4 Default: Param brad hint = "this is the radius of the circle\ That is tangent to the serpentine curve." Caption = "B in abz/(sqr(a)+sqr(z))" Default = (1.0,0.0) endparam Switch: type = "Ftswitch7M" brad = brad } Lets save our work. Reload the M formula Click the switch botton (the little arrow on top of the manle map) and enjoy the julias this formula is excellent for finding weird julias.