Browse Search Popular Register Upload Rules User list Login:
Search:
Complex Function Toolbox

Image:
screenshot of the scene

Author: FRA32

Group: Default

Filesize: 0.91 MB

Date added: 2017-02-10

Rating: 6.5

Downloads: 5950

Views: 1125

Comments: 23

Ratings: 4

Times favored: 0

Made with: Algodoo v2.1.0

Tags:

Scene tag

So here's a true story on how I got the idea for this:
Once during a math lesson about essential spacial vector addition, which was boring for me, I was thinking about mathematical stuff. These thoughts then went over to the Feigenbaum diagram and took a turn to the fact that the Diagram has an appearance in the mandelbrot fractal (You can see both in my scenes). I began thinking on why that connection may exist and how I could prove it. Suddendly I got an idea on how this connection may be existent, and after some paper tests and formulas in my calculator, I found out that Functions of the type ((x*x+x)*x+x)*x+x)... take the form of the diagram, which explains the connection. At home I started coding a program with the task of running the common logistic equation x=r*x*(1-x) and map all points below 2. Interrestingly enough I did not get the fractal, but only its left half mirrored, meaning the logistic function's diagram did in fact not have the "true" connection, but only the feigenbaum diagram itself which was created out of coincidence by both formulas. I checked what would come out with the mandelbrot formula, which did result in the "correct" image. Since the program completed it's task, I started experimenting. After all, an algorithm able to map recursive functions as complex images is not something you have everyday. After enhancing it a lot, and then having the idea of copying the result to algodoo, this came out.

The more interresting part:
How do you use this scene? In the center, you have a 40x40 grid of pixels mapping over a 5x5 area of a complex Function. Complex functions are normal functions running with complex numbers instead as both the parameter and result. This would result in a 4D graph, which is reduced to 2D by replacing the result number with a color depending on the angle(hue) and absolute value(brightness) of the result (further explanation to these values in my Complex numbers explained scene). Additionally, these functions can be recursive. Inside the code box you have the code mapping the function, a huge selection of mathematic operations, and the function itself. To write your own complex function, go to the "_interface" variable. It is the only region you should edit, since everything else was made for you. Write your function by first declaring the starting value of _z in the first line(all complex numbers are written as [x,y]). This can be a number(usually [0,0]), or a variable like _x, for example in julia sets. Then continue with the for-loop. Should you not want a recursive function, just ignore values like _z and only work with _x or other parameters you added.
Now you can write the actual function using the given _operations. I recommend to do 1 operation per line to keep your function ordered, but it is not necessary.
Here are some info's about all operations:

abs: The absolute value of the complex number; In: 1 Complex number, Out: 1 Real number
cosine: The cosine value of the number; In: 1 Complex number, Out: 1 Complex number
dividedBy: Divides the first number by the second; In: 2 Complex numbers, Out: 1 Complex number
exponential: Takes e to the power of your number; In: 1 Complex number, Out: 1 Complex number
inverse: Calculates the inverse of the number; In: 1 Complex number, Out: 1 Complex number;
---log---: Calculates the natural logarithm(opposite of exponential) of the number; In: 1 Complex number, Out: 1 Complex number
minus: Subtracts the second number from the first; In: 2 Complex numbers, Out: 1 Complex number
plus: Adds the two numbers; In: 2 Complex numbers, Out: 1 Complex number
---power---: Takes the complex number to the power of the real number; In: 1 Complex number, 1 Real number, Out: 1 Complex number
sine: The sine value of the complex number; In: 1 Complex number, Out: 1 Complex number
tangent: The tangent value of the number; In: 1 Complex number, Out: 1 Complex number
times: Calculates the scalar multiple of the 2 numbers; In: 2 Complex numbers, Out: 1 Complex number

A list of all operations is inside the scene for lookup.

Should you find interresting functions, have questions or suggestions for a scene, post it in the comments to let me know! I will check your function in my java program and if it looks cool i'll add the HD version to the scene! Also be so nice and take the time to rate the scene in order to make it last a little longer. Of course it is impossible to make hi-res-images of the most beautifull functions here, but it enables some playing around nontheless!
Also please note that power and log dont work yet since I need a source for the natural logarithm and wasnt able to find one. Should algodoo not have one, I will need to find a universal algorithm to approximate it.

Some formulas:

|Before the for func.| _z = [0,0];
_z = _plus(_power(_z,2),_x) - Mandelbrot:D

|Before the for func.| _z = _x; c = [some complex number];
_z = _plus(_power(_z,2),c); - Julia fractals!

|Before the for func.| _z = [0,0];
_z = _times(_cosine(_z),_sine(_x)) - The thumbnail function(which is really cool if you have my java program to render it HD)


|Before the for func.| _z = _x;
_z = _dividedBy(_x, _minus(_z, _inverse(_z))) - Function with lots of 0-Points and ∞-Point

|Before the for func.| _z = [0.5,0];
_z = _times(_times(_x,_z),_minus([1,0],_z)) - Feigenbaum Equation and the mandelbrot half!
Last edited at 2017/02/11 12:08:48 by FRA32
Please log in to rate this scene
edit
Similar scenes
Title: the most pointless thing ever made (read discription)
Rating: 5.6
Filesize: 75.97 kB
Downloads: 1077
Comments: 13
Ratings: 4
Date added: 2011/03/12 16:52:27
Made with: Phun
Rating: rated 5.6
download
Title: [LCS] MiniCPU v1
Rating: 5
Filesize: 278.58 kB
Downloads: 580
Comments: 1
Ratings: 1
Date added: 2010/05/25 17:18:07
Made with: Algodoo before v1.8.5
Rating: rated 5
download
Title: FRA32 Presents: The most useless Function ever seen!
Rating: 5
Filesize: 11.18 kB
Downloads: 641
Comments: 13
Ratings: 1
Date added: 2016/03/11 16:25:16
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Etch a Sketch(Real and Complex)
Rating: 5.4444
Filesize: 113.42 kB
Downloads: 897
Comments: 2
Ratings: 3
Date added: 2016/04/24 12:52:49
Made with: Algodoo v2.1.0
Rating: rated 5.4
download
Title: Garage Door|somewhat COMPLEX?
Rating: 1.6667
Filesize: 25.61 kB
Downloads: 413
Comments: 0
Ratings: 3
Date added: 2008/10/29 00:31:20
Made with: Phun
Rating: rated 1.7
download
Title: Script follower
Rating: 5
Filesize: 48.97 kB
Downloads: 815
Comments: 1
Ratings: 1
Date added: 2014/06/28 03:31:05
Made with: Algodoo v2.1.0
Rating: rated 5
download
O_______________________________________________O omg u creat ever!!!!!!! :) 100000000000000000 / 10
its so good to have a high-skill mathematician in our algodoo-communtiy. Thanks for this good work and for the functions within!
:tup: :tup:
Rest: see my note from 11.2.2017
Last edited at 2017/02/11 20:20:45 by DrBalk
The only thing I understood from this scene is... that your Windows is not activated :lol:
Holy cow! All that math is making my head spin! :lol: But I don't need to understand it in order to appreciate it. I know for certain that math is beautiful, and whoever can appreciate it for its intrinsic beauty understands all they really need to understand about it! :*) That's why nature is so beautiful. Math is everywhere and math is everything. When God gave us math, He gave us beauty. :angel:
Wow,this is amazing, Your must be great at scripting, I am not as good, The only 2 things in scripting that i'm good at is teleporters and the "TimeToLive" scripting.
good job, your definely one of the masters of algobox:)
Xray,you're a master too, I just viewed your Skee Ball Game and it's amazing,
Unfortchantly, i'm not too good, but your master FRA32 and Xray
@The Linkage

Aaah I tried so hard and got so far, but in the end, the freaking windows message still got screenshot(It's some sort of error we can't fix due to lost code)
@DrBalk
I once looked into the tailor-approach while making the scene, however it only works from 0-2 if I remember correctly. I'll see if these links of yours can bring me a solution ^^
@WyattTheMarbleRacer
Scripting is something you have to be familiar with. You can only work with it if you can compare it to a "friend". You have seen it often enough, done things often enough with it, and thus always can make new things with it without major problems. Always look at the scripts of others and try them out yourself! Then change them, see what impact your changes have, and thus understand the meaning of the script. And finally, put them together yourself! See if you can combine what you've learned into something that does something cool, just like you intended it to do! And if it does not do it like you wanted it, but it's still cool, find out about your error and see if the effect can be used to your advantage.
Always follow these steps, and with enough determination, you can become a small "script master" in algodoo too. After all, marble races really lack cool and original scripts, and if you actually learn how to use it, you could make really cool stuff.:D
FRA, Wanna see my 30th Junk Chipper?
Nice work (as usual). :tup: :tup:

Regarding "I need a source for the natural logarithm", Algodoo uses math.log for the natural log and math.log10 for the base 10 log.
@s_noonan
Thank you so much for this! I updated the scene with the working power and log operators now. It turned out that the logarithm wasn't the only problem in those 2, but also the atan function which aparently did not override their variable with math.pi/2 in case of 0 for some reason. But now everything works.
@Pootis-Man
I already saw it, after all I check the scenes of the people I like even if I can't see them on the news page anymore. Keep it up, and try to add some more fancy scripting:D
I usually use:

math.atan2(y,x) returns the angle [-pi,+pi] of the vector [x,y]

Enter "math." in the console and then press Tab to see all the math functions.
Lol, meanwhile i finished ( bit too late :blush: ) to get the logarithm-calculation by pure thyme without math-function;)
If anyone wants to see:

scene.my.intln2of:=(a,b)=>{
{a>2}?{c=a/2.0;d=b+1;scene.my.intln2of(c,d)}:{[a,b]}}

which returns [a/2^highestpowerof2,highestpowerof2]
then
scene.my.logar:=(k)=>{m=scene.my.intln2of(k,0); q=m(0);r=m(1);
t=q^0.125;
x=t-1;
xx=x*x;
xxx=xx*x;­
xxxxxx=xxx*xxx;
z=x-xx/2+xxx/3-xxx*x/4+xxx*xx/5-x­xxxxx/6+xxxxxx*x/7-xxxxxx*xx/8+xxxxxx*xxx/9;
resu=­r*0.6931471806+8*z;
}

which gives e.g. ln(1.999)= 0.69264704
nice in comparison to the real 0.692647055
or ln(12345)=9.421007
nice in comparison to the real 9.4210064

@noonan:
your function would give getLn(12345)=9.4644775
The reason is that for big numbers, the 10th root of a number n
gives 1+y and y is not THAT small, so the Taylorexpansion
deviates a bit from the real thing. Thats why i first
looked for the hightest power of 2 which is smaller then n,
and afterwards worked with the roots. Can you implement the thing in your program in a single function?

I learned this way to use recursive functions and quick Taylor-series.
Thanks for the incentive to learn more about thyme by your request :tup:
If someone can tell me how to implement the two functions i used for it into just one single function, i would be glad. :)
Last edited at 2017/02/25 13:54:29 by DrBalk
The following is based on the first term of the Maclaurin series for log(1 + x):

scene.my.getLn := (x)=>{
x1 := x;
for(10, (i)=>{
x1 = x1 ^ 0.5
});
1024.0 * (x1 - 1.0)
}

scene.my.getLn(2.0) yields 0.69335938 which is 0.003% off from the true value of 0.693147181

The way this works is it takes the square root of x 10 times in order to get it close to 1.0. Next, it subtracts 1.0 from the number since ln(1 + someSmallNumber) is approximately someSmallNumber. Next it multiplies the result by 2^10 since ln(x^n) = n * ln(x).

P.S. That's the way we used to do natural logs on a four function calculator.
Last edited at 2017/02/11 22:10:56 by s_noonan
Those are some juicy formulas you two got there! It always fills me with joy to see people actually care about mathematics. Where I am, everyone just finds it boring or just plain does not understand it.

Should I upload another animated scene about the complex formulas and the color rendering of these function? Or should I upload some type of scene in general? I need to know what you guys would like since I always need ages for new ideas ^^
I am VERY impressed by people who have the ability to understand the higher forms of mathematics (like you, DrBalk, s_noonan, kilinich, and a few other Algodoo users). I keep hoping that you guys hang around here and don't leave like so many other talented people have done over the past few years.

Now, concerning your request for suggestions: Is THIS something that you might be interested in playing around with? If you can make interesting "pictures" of common objects via math equations, it might spark some interest in the younger folk here on Algobox. :)

On second thought, this idea might be too simple for you, since it is just basic programming. But maybe you can think of other ways to make interesting pictures or 3D sculptures using math!
Last edited at 2017/02/22 17:23:08 by Xray
@Xray: i looked at the pictures, indeed it would be good to motivate younger people for math, so thanks for the pictures;) My experiences with programming an d math to motivate were: "best if one can do things one cant do before or with less effort", so loops for positioning 50 lasers in algodoo, with sin and cos you can positionate them in a circle, with log you find out about the exponential decreasing light in water of a depth x, with the complex number i you can very easyly derive the addition-theorems for sin and cos.

@FRA32: Do you know the connection between holomorphic functions and their Laurent-develompemt? So the user could set points ( circles ) at some places
z in the complex plain, which correspond to negative exponents of z^n, where n might be displayed by different colors of the circle.
@DrBalk
Sorry, but I haven't heard these 2 terms before. Of course I instantly looked up what they meant, but of course the connection is still unknown to me.

@XRay I could make a scene enabling one to "draw" using functions. The issue is that you would need the users to properly experiment with mathemaitcal functions and parameters in order to get the lines one wants, and *cough* most people on algobox aren't patient enough for this ^^
The scene itself is already prepared, I am currently working on making an example and then maybe upload the scene.
If you are interested in Laurent-series of holomorphic functions, look at the
section
"Laurentreihenentwicklung einer holomorphen Funktion"
in
http://www.mathematik.uni-ulm.de/ReineMath/Mathe-Online/kurse/ft/03-singularitaeten/01/r/index.html
and in youtube you can see the introduction to residues ( complex analysis there ) at
https://www.youtube.com/watch?v=_3p_E9jZOU8
;)
the residues are highly important in any particle-physics-calculation, e.g. "self-energy" , see for this e.g.
http://isites.harvard.edu/fs/docs/icb.topic473482.files/18-renormalization.pdf
There you use the residues to get rid of infinities, which "cancel each other" to give a "renormalizated" result.
Thats Great My Friend;)
@War Games
Thanks My Friend;)
*knock knock*
Do you hear me?
STOP BLOWING UP HEADS!
actaully you know what?
I'd like you to meet Terry, he's our
*whooooooBOOM!*
just joking
Now step back children, this forum's insurance policy does not cover blown minds.
My head went supernova