Logo by reallybigname - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Support us via Flattr FLATTR Link
 
*
Welcome, Guest. Please login or register. April 19, 2024, 03:34:21 PM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: Swap Functions  (Read 610 times)
0 Members and 1 Guest are viewing this topic.
HazardHarry
Forums Freshman
**
Posts: 14


« on: June 18, 2017, 03:22:35 AM »

Just like my last topic, I doubt I'm the first to come up with this. Hopefully I'll make up for that by including some example code and pictures. Each example picture includes the equivalent Mandelbrot Set in the upper-left hand corner, a Julia Set spread in the upper-right, and two Julia Set examples underneath.

I'm using Z^2 + C as the basis for all of these examples, but you'll get interesting results no matter what equation you use them on. Also, I only show two types of conditional swap functions below (swapIfRealIsLessThanImaginary and swapIfRealIsLessThanImaginary), but there are tons of different types of conditions you can create.

-----


Swap:
Swap the real and imaginary parts of a given complex number. If you have 3 + 5i, it becomes 5 + 3i.

Code:
static Complex swap(Complex in) {
return new Complex(in.imag, in.real);
}

swap(Z^2 + C):




swap(Z^2) + C:



-----


Swap If Real Is Less Than Imaginary:
Swap the real and imaginary parts of a given complex number if the real part is less than the imaginary part.

Code:
static Complex swapIfRealIsLessThanImaginary(Complex in) {

Complex out = in;

if(in.real < in.imag) {
out = new Complex(in.imag, in.real);
}

return out;
}

swapIfRealIsLessThanImaginary(Z^2 + C):




swapIfRealIsLessThanImaginary(Z^2) + C:



-----


Swap If Real Is Greater Than Imaginary:
Swap the real and imaginary parts of a given complex number if the real part is greater than the imaginary part.

Code:
static Complex swapIfRealIsGreaterThanImaginary(Complex in) {

Complex out = in;

if(in.real > in.imag) {
out = new Complex(in.imag, in.real);
}

return out;
}

swapIfRealIsGreaterThanImaginary(Z^2 + C):




swapIfRealIsGreaterThanImaginary(Z^2) + C:


Logged
SamTiba
Safarist
******
Posts: 83


« Reply #1 on: June 18, 2017, 10:12:12 PM »

I like the implementation of swapIfRealIsLess(and so on)!
Really cool idea to play around with the original formula in a simple way.
Logged

Some of my images: Pinterest
Dinkydau
Fractal Senior
******
Posts: 1616



WWW
« Reply #2 on: June 21, 2017, 01:28:22 PM »

Some of those julias a pretty cool.
Logged

Gerson
Forums Freshman
**
Posts: 18


« Reply #3 on: June 21, 2017, 04:24:41 PM »

Liked it. Which software did you use to do that?
Logged
HazardHarry
Forums Freshman
**
Posts: 14


« Reply #4 on: June 22, 2017, 05:57:54 PM »

@SamTiba & @Dinkydau - Thanks!

@Gerson - It's software that I wrote. I plan on releasing it for free sometime, but before I do I need to do a major user-friendliness overhaul on it.

*edit*
I was looking at the Wikipedia article for the Burning Ship Fractal earlier and noticed that the Conditional Swap functions seem to share a lot in common with it. "swapIfRealIsLessThanImaginary(Z^2) + C" in particular looks like a slightly more "sunken" Burning Ship.

When I have some time later I'll compile some images that show off the similarities between the Julia sets of the equations.
« Last Edit: June 24, 2017, 03:21:10 PM by HazardHarry, Reason: Noticed a similarity between the Conditional Swap and Burning Ship equations. » Logged
0xbeefc0ffee
Forums Freshman
**
Posts: 17



« Reply #5 on: June 25, 2017, 04:01:42 AM »

Such a novel idea is bound to have lots of potential
Logged
Gerson
Forums Freshman
**
Posts: 18


« Reply #6 on: June 26, 2017, 07:10:54 PM »

Good news. Let me know when you release it.
Logged
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Hyperchaotic functions (new) Theories & Research Charleswehner 3 1243 Last post December 12, 2006, 04:06:41 PM
by gandreas
Wave functions Non-Fractal related Chit-Chat Jameses 3 1718 Last post January 21, 2011, 02:05:37 AM
by Jameses
Ray Marching Distance Functions Programming asimes 13 7890 Last post November 11, 2014, 08:16:20 PM
by asimes
The Mandeldude is getting a brain swap Images Showcase (Rate My Fractal) lapinot 0 521 Last post February 20, 2015, 02:36:57 PM
by lapinot
Formula Tab Swap feature request 0Encrypted0 0 5225 Last post March 28, 2015, 10:37:14 PM
by 0Encrypted0

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.126 seconds with 24 queries. (Pretty URLs adds 0.006s, 2q)