# EXAMPLE 2 # compile the C program example.c # creating example.so # gcc -fpic -shared -o example.so example.c # In XPP click on File-Edit-Load Library # example.so # and pick either lv, vdp, duff as the function. # x'=xp y'=yp # these are dummies holding the RHS xp=0 yp=0 export {x,y,a,b,c,d,t} {xp,yp} par a=1,b=1,c=1,d=1 done ------------------ Cut below, save as example.c ------------------------- #include /* some example functions */ lv(double *in,double *out,int nin,int nout,double *var,double *con) { double x=in[0],y=in[1]; double a=in[2],b=in[3],c=in[4],d=in[5]; double t=in[6]; out[0]=a*x*(b-y); out[1]=c*y*(-d+x); } vdp(double *in,double *out,int nin,int nout,double *var,double *con) { double x=in[0],y=in[1]; double a=in[2],b=in[3],c=in[4],d=in[5]; double t=in[6]; out[0]=y; out[1]=-x+a*y*(1-x*x); } duff(double *in,double *out,int nin,int nout,double *var,double *con) { double x=in[0],y=in[1]; double a=in[2],b=in[3],c=in[4],d=in[5]; double t=in[6]; out[0]=y; out[1]=x*(1-x*x)+a*sin(b*t)-c*y; }