#!/usr/bin/octave -qf

global tmax  = 5;
tstep = 0.1;

function y = I(r)
	y = 0.0;
	if (r < 2.0)
		y = 1;
	endif
endfunction

function y = Ig(x)
	global tproj
	r = sqrt(x^2 + tproj^2);
	y = I(r);
endfunction

function InitIg(t)
	global tproj
	tproj = t;
endfunction

function y = Pt(t)
	global tmax
	InitIg(t);
	[y, ier, nfun, err] = quad("Ig", -tmax, tmax);
endfunction

for tm = 0 : tstep : tmax
	ym = Pt(tm);
	printf("%20.9f%20.9f\n", tm, ym);
endfor

