11.36 Sample ‘daisy

Example of subfunctions and summation in textual formulas.

MGL code:

title 'Advanced formulas'
new b 256 256 'dsum(fn1(_i*pi/5),10)\exp(-64*(x*cos(_1)-y*sin(_1))^2-16*(0.5+y*cos(_1)+x*sin(_1))^2)'
crange b:dens b 'BbwrR'

C++ code:

void smgl_daisy(mglGraph *gr)
{
	if(big!=3)	gr->Title("Advanced formulas");
	mglData b(256,256);
	gr->Fill(b,"dsum(fn1(_i*pi/5),10)\\exp(-64*(x*cos(_1)-y*sin(_1))^2-16*(0.5+y*cos(_1)+x*sin(_1))^2)");
	gr->SetRange('c',b);	gr->Dens(b,"BbwrR");
}

Sample daisy