11.95 Sample ‘pmap

Function pmap draw Poincare map – show intersections of the curve and the surface.

MGL code:

subplot 1 1 0 '<_^':title 'Poincare map sample'
ode r 'cos(y)+sin(z);cos(z)+sin(x);cos(x)+sin(y)' 'xyz' [0.1,0,0] 0.1 100
rotate 40 60:copy x r(0):copy y r(1):copy z r(2)
ranges x y z
axis:plot x y z 'b'
xlabel '\i x' 0:ylabel '\i y' 0:zlabel '\i z'
pmap x y z z 'b#o'
fsurf '0'

C++ code:

void smgl_pmap(mglGraph *gr)
{
	gr->SubPlot(1,1,0,"<_^");
	if(big!=3)	gr->Title("Poincare map sample");
	mglData ini(3);	ini[0]=0.1;
	mglData r(mglODE("cos(y)+sin(z);cos(z)+sin(x);cos(x)+sin(y)","xyz",ini,0.1,100));
	mglData x(r.SubData(0)),y(r.SubData(1)), z(r.SubData(2));
	gr->Rotate(40,60);	gr->SetRanges(x,y,z);
	gr->Axis();	gr->FSurf("0");	gr->Plot(x,y,z,"b");
	gr->Label('x',"\\i x",0);	gr->Label('y',"\\i y",0);	gr->Label('z',"\\i z",0);
	gr->Pmap(x,y,z,z, "b#o");
}

Sample pmap