Imaginary numbers and fractals.

Nov 6, 2007 at 10:37pm

Imaginary numbers and fractals.

Is it possible to use complex and imaginary numbers within Max MSP or Jitter so that they can be used in equations to draw fractals and the like?

I’ve tried the expr object with functions that include sqrt(-1) and the lcd object but I’m not getting very far.

Thanks

Rhys

#34496
Nov 6, 2007 at 10:56pm

You have to represent complex numbers as a pair of numbers and
accordingly adjust the various basic operators to operate in a complex
manner.

wes

On 11/6/07, Rhys Perkins wrote:
>
> Is it possible to use complex and imaginary numbers within Max MSP or Jitter so that they can be used in equations to draw fractals and the like?
>
> I’ve tried the expr object with functions that include sqrt(-1) and the lcd object but I’m not getting very far.
>
> Thanks
>
> Rhys
>

#116533
Nov 7, 2007 at 11:00am

I had once considered building a set of math objects for handling complex arithmetic. There was a start with the lp.c2p~ and lp.p2c~ objects I built back in the days before cartopol~ and poltocar~ existed. But the project that I would have needed complex math for never got beyond the drawing board and I didn’t see a dire need for the objects.

It wouldn’t be hard at all to write a set of complex math objects in C. Or Java. For that matter, it wouldn’t be that hard to patch together a set of objects. Here’s an example of complex square. Comments, error checking, handling async input, etc. left to the reader. (It is admittedly these tedious details that I tend to find more convenient to handle in C, but some people like patching this stuff, too.)

#N comlet Float: imaginary component;
#P outlet 188 151 15 0;
#N comlet Float: real component;
#P outlet 92 151 15 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 92 127 27 196617 – 0.;
#P newex 188 97 27 196617 + 0.;
#P newex 188 72 30 196617 * 1.;
#P newex 275 67 30 196617 * 1.;
#N comlet Float: imaginary component;
#P inlet 275 37 15 0;
#P newex 92 70 30 196617 * 1.;
#N comlet Float: real component;
#P inlet 92 40 15 0;
#P connect 0 0 1 0;
#P fasten 0 0 1 1 97 60 117 60;
#P fasten 0 0 4 0 97 60 193 60;
#P connect 5 0 8 0;
#P connect 6 0 7 0;
#P fasten 3 0 6 1 280 121 114 121;
#P connect 1 0 6 0;
#P connect 4 0 5 0;
#P fasten 4 0 5 1 193 93 210 93;
#P fasten 2 0 4 1 280 59 213 59;
#P connect 2 0 3 0;
#P fasten 2 0 3 1 280 59 300 59;
#P window clipboard copycount 9;

#116534
Nov 7, 2007 at 1:15pm

Indeed, they would be easy to create in Java.

What would an addition/multiplication object take?
Perhaps four inlets,
real-1, imag-1 real-2, imag-2?

then output real(1*2), imag(1*2)

Actually, looking at it, its easy to see how you could adapt the existing max objects – you just have
real(1*2) = (real-1*real-2) – (imag-1*imag-2)
etc..

I guess the more complex fractal program might be worth coding in Java. You could have the kind of recursive functions easily defined there with an array for the pixels.

#116535
Nov 7, 2007 at 4:50pm

#116536
Nov 7, 2007 at 5:28pm

it’s harmless. an opendialog bug

Matthias Schneider-Hollek wrote: ever had that ?

from my max window

was in timer proc
was in timer proc
was in timer proc
was in timer proc
was in timer proc
was in timer proc
was in timer proc

———————————
Yahoo! Answers – Get better answers from someone who knows. Tryit now.

#116537
Nov 7, 2007 at 5:30pm

On 7 nov. 07, at 17:50, Matthias Schneider-Hollek wrote:

> was in timer proc

It’s an harmless debug post:

http://www.cycling74.com/forums/index.php?
t=msg&goto=105563&rid=0&S=fb7ca98dd5732ae37cae8053572a48ff&srch=was+in
+timer+proc#msg_105563

ej

#116538
Nov 7, 2007 at 8:03pm

Alternately, you might want to pass each complex value as a duple (2-item list). The convention would halve the number of inlets/outlets. OTOH, you have to pack/unpack inside each abstraction. Trade-offs, trade-offs…

How did the “timer proc” thread get in here?

#116539
Nov 8, 2007 at 1:26pm

merci

thanks

Am 07.11.2007 um 18:30 schrieb Emmanuel Jourdan:

> On 7 nov. 07, at 17:50, Matthias Schneider-Hollek wrote:
>
>> was in timer proc
>
> It’s an harmless debug post:
>

#116540

You must be logged in to reply to this topic.