Forums > Gen

### Iteration – Tinkerbell Map help

Apr 28 2012 | 1:36 am

Fairly simple question, but I’m new to gen~ and fairly new to trying to do logic in Max. I’m trying to implement the Tinkerbell map in Max/Gen (http://en.wikipedia.org/wiki/Tinkerbell_map), but I seem to be having trouble actually moving the equation along an iteration as the parameters all stay the same, but the equation repeats itself. Here is what I have so far (the math might not be correct, I’m pretty bad). I was thinking I might need a sig~ to somehow move the gen~ along?

This is the code for the equation in java

int time = 0, iterations = 50000;
double x = -0.72, y = -0.64;
double a = 0.9, b = -0.6013, c = 2.0, d = 0.5;
while (time < iterations) {
double oldX = x;
x = Math.pow(x,2)-Math.pow(y,2)+a*x+b*y;
y = 2*oldX*y+c*oldX+d*y;
out.write(x+" "+y+"n"); //writing data to a txt file to be read by Mathematica
time++;
}

``````
-- Pasted Max  Patch, click to expand. --

```
```
Apr 30 2012 | 3:32 pm

There’s nothing here that suggests to me that you need a signal input at all.

At the moment, while loops aren’t implemented. So I’d suggest that you take a look at the counter example in the gen examples folder and use that – "starting" the object would, then, kick out the whole list of values. The actual calculation stuff is fine, save that you don’t really need to have a separate prevx history object – "history X -0.64" should initialize the x value for starters.

Viewing 2 posts - 1 through 2 (of 2 total)

Forums > Gen