rs1909 / knut

A numerical continuation software
GNU General Public License v3.0
3 stars 0 forks source link

handling of power ^ is wrong #4

Open rs1909 opened 2 years ago

rs1909 commented 2 years ago

This does not work:

vfname()=fingers;
time()=t;
period(T)=0.1;

par(omega) = 2;

par(gamma)=0.7;
par(alpha)=0.0;
par(beta)=0.0;
par(a)=0;
par(b)=0;

dot(x1) = v1;
dot(v1) = -omega^2*x1 + (gamma - alpha*x1^2 - beta*v1^2)*v1 + 0*(a + b*(x1-x2)^2)*(v1-v2);
dot(x2) = v2;
dot(v2) = -omega^2*x2 + (gamma - alpha*x2^2 - beta*v2^2)*v2 + 0*(a + b*(x2-x1)^2)*(v2-v1);
init(x1) = 0;
init(v1) = 0;
init(x2) = 0;
init(v2) = 0;

as opposed to expanding the ^ into products, when it works:

vfname()=fingers;
time()=t;
period(T)=0.1;

par(omega) = 1.0;
par(gamma)=0.7;
par(alpha)=0.0;
par(beta)=0.0;
par(a)=0.0;
par(b)=0.0;

dot(x1) = v1;
init(x1) = 0.0;
dot(v1) = (-omega*omega)*x1 - (gamma - alpha*x1*x1 - beta*v1*v1)*v1 + (a + b*(x1-x2)*(x1-x2))*(v1-v2);
init(v1) = 0.0;
dot(x2) = v2;
init(x2) = 0.0;
dot(v2) = (-omega*omega)*x2 - (gamma - alpha*x2*x2 - beta*v2*v2)*v2 + (a + b*(x2-x1)*(x2-x1))*(v2-v1);
init(v2) = 0.0;