11.70 Sample ‘keep

Function keep conserve initial phase along specified direction(s).

MGL code:

yrange 0 pi
new !a 100 300 'exp(-6*x^2+10i*(x+y^2))'subplot 2 1 0 '':box
dens real(a) 'BbwrR'
text 1.1 0.5 '	o' 'a'keep a 'y' 50
subplot 2 1 1 '':box
dens real(a) 'BbwrR'

C++ code:

void smgl_keep(mglGraph *gr)
{
	gr->SetRange('y',0,M_PI);
	mglDataC a(100,300);	gr->Fill(a,"exp(-6*x^2+10i*(x+y^2))");
	gr->SubPlot(2,1,0,"");	gr->Box();
	gr->Dens(a.Real(),"BbwrR");
	gr->Puts(1.1,0.5,"\\to","a");
	a.Keep("y",50);
	gr->SubPlot(2,1,1,"");	gr->Box();
	gr->Dens(a.Real(),"BbwrR");
}

Sample keep