Hello, list.

In Wolfram Alpha, -x^2 is interpreted as -(x^2), while in Faust it results
in (-x)^2.

This difference came out while implementing Van der Pol's equation:

m=2.6;
h=0.01;
u(1)=1;
u(2)=1;
u(n+1) = (h * m * u(n) ^ 3 + (-h ^ 2 - h * m + 2) * u(n) - u(n - 1)) / (h *
m * u(n) ^ 2 - h * m + 1);
n starting from 2.

which I implemented as:

import("stdfaust.lib");
m=2.6;
h=.01;
vanderpol(init1, init2) = loop ~ _
with {
loop(fb) = (h * m * (fb + init1_) ^ 3 + (-1 * h ^ 2 - h * m + 2) * (fb +
init1_) - (fb' + init2_ + init1_')) /
(h * m * (fb + init1_) ^ 2 - h * m + 1)
with {
init1_ = init1 - init1';
init2_ = init2 - init2';
};
};
process = vanderpol(1, 1);

Empirically, I could see that with Faust's interpretation of -h^2, the
system is unstable, while implementing -(h^2) results in the correct
oscillatory behaviour.

Is either of the two interpretations mathematically more correct than the
other?

Ciao,
Dario

Dr Dario Sanfilippo
http://dariosanfilippo.com
_______________________________________________
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to