Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected SFFE behaviour #218

Open
trathborne opened this issue Aug 16, 2021 · 0 comments
Open

Unexpected SFFE behaviour #218

trathborne opened this issue Aug 16, 2021 · 0 comments

Comments

@trathborne
Copy link

Describe the bug
I am trying to write Meltybrot in SFFE for use with XaoS. It looks like this:
https://www.cesoid.com/fractal#al=meltybrot

The algorithm is hidden in minified JavaScript there, but here it is in MathMap syntax:

Ax = 0;
Ay = 0;
Ax2 = 0;
Ay2 = 0;

while ((Ax2+Ay2) < 4) && (a_count < a_max) do
  Ay = 2*Ax*Ay + if a_count % 2 then x else y end;
  Ax = Ax2-Ay2 + x;
  Ax2 = Ax*Ax;
  Ay2 = Ay*Ay;
  a_count = a_count + 1;
end;

In the two-real-number process of computing z²+c, y and x are swapped on alternate iterations via if a_count % 2 then x else y end;

This is a cool enough fractal that I will probably just try to add it natively, but I'm trying to figure out if I have misunderstood something about SFFE syntax.

To Reproduce
This renders a plain old Mandelbrot set as expected:
(powi(re(z),2)-powi(im(z),2)+re(c))+(2*re(z)*im(z)+im(c))i

This is close to, but not quite the Meltybrot rendered by the website or MathMap:
(powi(re(z),2)-powi(im(z),2)+re(c))+(2*re(z)*im(z)+(re(c)*((cos(n*3.14159265358979)+1)/2))+(im(c)*((cos((n+1)*3.141592653589793)+1)/2)))i
To alternately swap the final term im(c) I'm using cos() as a proxy for mod() because SFFE doesn't have mod() or if(). Logic: (cos(even*pi)+1)/2 == 1 and (cos(odd*pi)+1)/2 == 0

Expected behavior
I expected the picture you'll see at the website, but got something slightly weirder.

Screenshots
Web:
web-melty
XaoS:
xaos-melty

Desktop (please complete the following information):

  • OS: Linux
  • Latest XaoS from git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant