Chaos Scripts

Accueil Forums Scripts Chaos Scripts

  • Ce sujet contient 3 réponses, 3 participants et a été mis à jour pour la dernière fois par Anonyme, le il y a 8 années et 6 mois.
4 sujets de 1 à 4 (sur un total de 4)
  • Auteur
    Messages
  • #2245 Répondre
    IanniX
    Maître des clés

    Hi all,

    I’m trying to use Iannix for the production of graphical scores based on the output of chaotic differential equations. For a test I am trying to implement and map the Lorenz equations in some form. My plan right now is to use a for() loop to iterate some number of Euler approximations of the functions and use the output of x, y, and z to generate curves, linesegments, triggers, ect… I’m coming to an anonymous parse error on the line where I instantiate my for loop. Would it be appropriate to post my code, as it is, here? I’ve really hit a wall. My Javascript is not so good so I may be making some glaring mistakes. Thanks.

    #2757 Répondre
    Anonyme
    Inactif

    Yes ! But please copy/paste your code in your post 🙂

    #2758 Répondre
    Anonyme
    Inactif

    Sorry for the lateness of my response. I am still interested in learning how to do this. Here is my code:

    //Script “Lorenz Graph”
    //Insert requests for global variables:
    function onConfigure() {
    title(“Lorenz attractor”);
    ask(“General”, “initial x”, “xo”, 0);
    ask(“General”, “initial y”, “yo”, 0);
    ask(“General”, “Initial z”, “zo”, 0);
    ask(“Parameters”, “sigma”, “s”, 10);
    ask(“Parameters”, “beta”, “b”, 2.66666);
    ask(“Parameters”, “row”, “p”, 28);
    ask(“Euler”, “Delta t”, “dt”,.01);
    ask(“Euler”, “Number of Steps”, “r”, 10);

    var x = xo;
    var y = yo;
    var z = zo;
    var i;
    }

    //Insert code to create score:
    function onCreate() {
    run(“clear”);
    run(“zoom 100”);
    run(“center 0 0”);
    run(“rotate 0 0 0”);
    run(“registerTexture background 0 0 0 0 ./Tools/background.jpg”);

    //Add curve
    run(“add curve 1001”);
    run(“setPos current ” + xo + ” ” + yo + ” ” + zo);
    run(“setPointAt current 0 ” + xo + ” ” + yo + ” ” + zo);
    for(var index = 0; index <= r; index++)
    {
    i = index;
    //evaluate Euler method
    x = xo + ( s * ( y – x )) * dt;
    y = yo + ( x* ( p – z ) – y ) * dt;
    z = zo + ( x * y – b * z ) * dt;
    //create line at xo, yo, zo to x, y, z
    DrawEul(x, y, z);
    //set new initial values
    xo = x;
    yo = y;
    zo = z;
    }
    run(“add cursor 1”);
    run(“setCurve current lastCurve”);
    run(“setSpeed current auto 100”);

    }
    //Custom function
    function DrawEul(ex, wy, ze) {
    //run(“setPointAt current pNum ” + exo + ” ” + wyo + ” ” + zeo);
    run(“setPointAt current pNum ” + ex + ” ” + wy + ” ” + ze);
    }

    #2759 Répondre
    Anonyme
    Inactif

    Ok, you have some different mistakes in your code. x0/y0/z0 have to be declared in onCreate function. Moreover, the setPointAt JavaScript syntax was wrong.
    Here is the correct code… but all points are on (0, 0, 0)…
    Fon’t forget you can trace your code by using console(“hello world”); function (and log trace appear in “Received messages” in IanniX.

    //Script "Lorenz Graph"
    //Insert requests for global variables:
    function onConfigure() {
    title("Lorenz attractor");
    ask("General", "initial x", "xo", 0);
    ask("General", "initial y", "yo", 0);
    ask("General", "Initial z", "zo", 0);
    ask("Parameters", "sigma", "s", 10);
    ask("Parameters", "beta", "b", 2.66666);
    ask("Parameters", "row", "p", 28);
    ask("Euler", "Delta t", "dt",.01);
    ask("Euler", "Number of Steps", "r", 10);

    }

    //Insert code to create score:
    function onCreate() {
    var x = xo;
    var y = yo;
    var z = zo;
    var i;

    run("clear");
    run("zoom 100");
    run("center 0 0");
    run("rotate 0 0 0");
    run("registerTexture background 0 0 0 0 ./Tools/background.jpg");

    //Add curve
    run("add curve 1001");
    run("setPos current " + xo + " " + yo + " " + zo);
    run("setPointAt current 0 " + xo + " " + yo + " " + zo);
    for(var index = 0; index <= r; index++) {
    //evaluate Euler method
    x = xo + ( s * ( y - x )) * dt;
    y = yo + ( x* ( p - z ) - y ) * dt;
    z = zo + ( x * y - b * z ) * dt;
    i = index;
    //create line at xo, yo, zo to x, y, z
    console(x + " " + y + " " + z);
    DrawEul(index, x, y, z);
    //set new initial values
    xo = x;
    yo = y;
    zo = z;
    }
    run("add cursor 1");
    run("setCurve current lastCurve");
    run("setSpeed current auto 100");

    }

    //Custom function
    function DrawEul(index, ex, wy, ze) {
    //run("setPointAt current pNum " + exo + " " + wyo + " " + zeo);
    run("setPointAt current " + index + " " + ex + " " + wy + " " + ze);
    }
4 sujets de 1 à 4 (sur un total de 4)
Répondre à : Chaos Scripts
Vos informations:





© IanniX Association

Qu'est-ce que IanniX ? | Téléchargement | Showcase | Forum | Recherche | À propos