Dear list,

forgive the (seeming) ignorance of a very nOOb faust learner who just stumbled 
(again) into the world of functional programming...
After watching the majority of the screencast by Romain (thanks!) [1], I wanted 
to implement a, what I thought, simple differential equation system in faust: A 
Lotka-Volterra chaotic attractor (3rd order DE).

I got as far as pasted below but get an error that tells me that I am obviously 
doing something wrong in the array (or vector?) accessing.
If someone could please help me out?


thanks and a wonderful day!
        Till

[1] https://ccrma.stanford.edu/~rmichon/faustWorkshops/course2015/


------------------

The code below throws this error:

ERROR : pattern matching failed, no rule of case {(<xs>,<xxs>,<nn>) => 
take(xxs,nn,1 : -); (<xs>,1) => xs; (<xs>,<xxs>,1) => xs; } matches argument 
list (1,1 : +,0)



/////////////////

import("stdfaust.lib");

// tools
at(i, x) = ba.take(i+1, x);



// chaotic attractor found by Arneodo, Coullet and Tresser
// see Flake (1998): "The Computational Beauty of Nature", p. 187

alpha = hslider("alpha",0,0,1,0.01) : si.smoo;


// A = [[0.5, 0.5, 0.1], [-0.5, -0.1, 0.1], [\alpha, 0.1, 0.1]]

A(0) =   0.5,  0.5, 0.1;
A(1) =  -0.5, -0.1, 0.1;
A(2) = alpha,  0.1, 0.1;


// dx_i/dt = x_i sum_j=1^n (A_ij (1-x_j))

// dx_i/dt
dxdti(x, i) = at(i, x) * sum(j, 3, (at(j, A(i)) * (1 - at(j, x))));

// dx/dt
dxdt(x)     = par(i, 3, dxdti(x, i));


process = 0, 0, 1 : +~ dxdt;


/////////////////


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to