11.67 Sample ‘indirect

Comparison of subdata vs evaluate/

MGL code:

subplot 1 1 0 '':title 'SubData vs Evaluate'
new in 9 'x^3/1.1':plot in 'ko ':box
new arg 99 '4*x+4'
evaluate e in arg off:plot e 'b.'; legend 'Evaluate'
subdata s in arg:plot s 'r.';legend 'SubData'
legend 2

C++ code:

void smgl_indirect(mglGraph *gr)
{
	gr->SubPlot(1,1,0,"");	gr->Title("SubData vs Evaluate");
	mglData in(9), arg(99), e, s;
	gr->Fill(in,"x^3/1.1");	gr->Fill(arg,"4*x+4");
	gr->Plot(in,"ko ");		gr->Box();
	e = in.Evaluate(arg,false);	gr->Plot(e,"b.","legend 'Evaluate'");
	s = in.SubData(arg);	gr->Plot(s,"r.","legend 'SubData'");
	gr->Legend(2);
}

Sample indirect