read Applications;

LocalDatas2 := op(LocalDatas):
tLD := 0;
LocalDatas := proc() global tLD; local R,tta;
	tta := time();
	R := LocalDatas2(args);
	tLD := tLD + time() - tta;
	R
end:
# Only took 7% of CPU time in this file.
#
# Most of the time is in PolySols
# But when you have degree-bounds then it
# should be possible to do this one step at
# a time.
#
# Or: you compute the PolySols as sequences.
# Say you have your matrix M and you start
# with vectors v[q,k] with q in some non-singular p+Z
# Then you get tau(v) = M*v which means that v[q+1, *]
# are written in terms of v[q, *]. Repeat this but then
# at each entry of v[q+{0,1,2,..}, *] you get a linear
# combination of v[q, *]. Then applying Delta^n gives
# you linear equations for the v[q, *].

L8 := `LREtools/LCLM`(tau-1/x, tau-2/(x+3), tau+1/(x+2), tau-x, tau-2*x, tau-3*x/(x-2), tau+2*x/(x+3), tau+(x-1/2)):
L8 := collect(primpart(L8,tau),tau,factor):
BBP(L8,1);


La := (x-2)^2 * tau^7 + 3*tau^3-x*tau + x^2;
G := (x-3)*tau^5 + x^3*tau^3-4*tau^2+(x-1)*tau+5*(x+2);
Lb := collect(primpart(`LREtools/rightdivision`(`LREtools/LCLM`(La,G), G)[1],tau),tau,factor);

L4 := `LREtools/LCLM`(tau^3-x, tau^3-x*tau-1);

L := collect(primpart(`LREtools/LCLM`(
        (x-1)*tau^3 - 3*tau^2 - x*tau + 2*x,
        (x+1)*tau^3 - (x-1)*tau^2 - tau  -x)
,tau),tau,factor);

_Env_ratsols_only := true;
ProjectiveHom(La, Lb);
ProjectiveHom(L4, L4);
ProjectiveHom(L, L);
_Env_ratsols_only := false;

BBP(L, 3);
