This tutorial was written by Toby who was a mailing list member for quite a while.
The compiler provides a way for FE users to write and use their own formulae in the program. We'll take a look at how to do
this. First, however, let me add this disclaimer: I am no expert and make no claim to the completeness of this information. I
can only give you a guide based on my limited experience.
First it is necessary to have the compiler software downloaded and installed. This is available on the FE download site as
"User Formula Compiler". This should be downloaded and unzipped into the folder in which your FE program lives. But before we
get into the practical steps of getting a formula into FE here is a quick overview on writing formulae themselves.
FORMULAE
The fractal formulae in FE consist of two variables (c and z), functions and parameters. User-defined formulae are more
limited in structure than many of the built-in formulae, but still offer endless possibilities for fun and exploration.
You can write as many c's and z's as you want, but you are limited to four parameters and two changeable functions (although
you can add specific functions to any variable term). Just what does this mean? Let's start with the classic Mandelbrot
equation, which is:
z=z*z+c
Notice that in this there is neither function nor parameter, just z's and c's (note: the compiler isn't case-sensitive, you
can use either caps or small letters).
Here is a variation: z = z*z*z + c. Another: z = z*z ^ 1/(c*c).
Essentially any basic formula consists of some combination of z's and c's connected by the standard arithmetic operators-you
can add, subtract, multiply, divide or exponentiate your variables by using the following symbols : + - * / ^.
(However..you need to be aware of the parenthezation in your formula.
Take a look at the last term in the second variation above. 1/(c*c) mean one divided by c squared. If I had left out the
parentheses it would have been 1/c*c--1/c times c, or c divided by c which is simply 1. That wouldn't have worked at all.)
Let's start with the second variation above, to wit: z = z*z^1/(c*c).
This is a simple formula, without functions or parameters. You can add functions and parameters wherever you like: Here is
an example using that basic formula:
z = fn1(z)*(z-p1)^fn2(1/c*c+p2)
That looks a lot more complicated but basically all we have done is to add two functions and two parameters. Take a look: we
have applied function 1 (fn1) to the first z, added a parameter (p1) to be subtracted from the second z, applied function 2
(fn2) to the whole "c" term (1/c*c) while adding a parameter (p2) to the second "c" in that term. Note that there is a
difference in which these are written-a function always modifies a term (which follows it directly in parentheses). No
arithmetic operators are involved as with parameters. This is only one possibility, and there are many more, for example:
z = fn1(z*z-p1)^fn2(1/c*c+p2)
z = fn1((z)*(z-p1)^fn2(1/c*c+p2))
z = fn1(z)*(z/p1)^(fn2(1/c^p2)*(c))+p2
All of these will give somewhat different results.
Now let's see how to get this formula into FE:
USING THE COMPILER
First open the "Select Fractal" window and go to the "User formula" tab.
Hit the "clear" button: instead of clearing the window it will write the skeleton code for the compiler. To me this is all
just mumbo-jumbo and if you understand it more power to you, but even if you don't it doesn't matter...
Now click the little button that has the "square root of a" symbol. This opens the FE parser that will write your formula in
a code that the compiler can understand. Thanks to Kyle McCord for that--without it I'd be completely lost. By default the
standard Mandelbrot equation is in there: z*z+c. You should delete that and write whatever combination of c's and z's your
heart desires; numbers are also OK. In our case we will write:
fn1(z)*(z-p1)^fn2(1/c*c+p2)
Note that the "z =" part of the equation should not be written-it is implied and if you do write it you will get an error
message.
After you have done this click the button marked "Convert-output to clipboard". The parser window will disappear, but the
information needed remains in the computer clipboard, out of sight.
The parser itself has three options "Indent Output, "Modify Z" and "Close on conversion". The first doesn't seem to have any
practical value (it works either way) and the last just closes the window after you convert. Modify Z looks like it should
remain checked, otherwise it seems to very much simplify the way the fractal is rendered, and none of the parameters or
functions seems to work. Perhaps someone who knows what it is about can clue us all in...
But anyway, after you have "converted" and "output to clipboard" it is time to paste the parsed equation in the skeleton
code. This is simple: just go near the bottom of the skeleton code in the main window (five lines above the end) until you
see this:
// write the formula here
Add a blank line by putting your cursor after the word "here" and hitting the enter key. Now place your cursor on the blank
line that you just created and hit the "Ctrl" and "V" keys (standard windows "paste" command). Your formula should appear,
followed by a bunch more lines of mumbo-jumbo. All you have to do now is to hit the "compile" button and FE should digest
your formula and you can see what you have wrought! [blare of trumpets]
(In case of trouble read "A few additional notes" below)
One thing that is worth noting is that when you use the "User formula" function the "Select Fractal" window always displays
the two function windows and the four parameter windows, but these are only active for the functions and parameters you have
written into the formula. This is different from the "implemented" (built-in) formulae, which display only the windows of
active parameters and functions.
A NOTE ABOUT FUNCTIONS
Although it is only possible to have two changeable functions in a formula (in which the functions which apply can be changed
by selecting any in the drop-down windows)-it is possible to have an unlimited number of "hardwired" functions. All you need
to do is to select any of the functions listed and write it before any term you would like. So for example we could modify
our pet formula like this, for example:
z = fn1(z)*catan(z-p1)^fn2(1/cabs(c)*ccos(c)+p2)
Of course these added functions cannot be changed unless you rewrite the formula.
A FEW ADDITIONAL NOTES
You may get an error message "DLL not compiled! May be an error in code".
This often happens if you specify a term or letter that the compiler doesn't recognize, like an "x" instead of a "z" or
"atan" instead of "catan". If you want to see how the compiler deals with what you wrote you have the option of leaving the
black DOS window open after you compile. Next to the parser button there is a button with a rectangular icon normally used to
represent a DOS exe file. If you click this on the compiler window stays open and the fractal doesn't begin to be drawn until
you close it manually. If you leave it unchecked the compiler window closes automatically. Next to that is a button to open
an editing window if you want to edit your equation, but that is really only for people who know what they are doing--you
won't need that if you use the parser.
Also: you can't just change the equation by changing the text line of the equation in the main window after it is
compiled--you need to clear, write the new equation in the parser, convert, paste and compile. Otherwise many changes won't
take effect.
|
|