from research import *
from algebra import Matrix
s=begin(1185,'Compare complete row recovery with two head differences','Can regular and cumulative totals distinguish the same five coefficients?',{},['C1182'])
d=json.loads((ROOT/'model/whole_genealogy_five_model.json').read_text());rows=d['matrix'];H=Matrix([[sum(F(rows[i][j]) for i in range(k,38,2)) for j in range(5)] for k in [0,1]]);out=list(H*Matrix(d['values']));ns=[list(v) for v in H.nullspace()]
a=artifact('model/whole_genealogy_head_information.json',json.dumps(clean({'head_matrix':H.tolist(),'values':out,'rank':H.rank(),'kernel_basis':ns,'scope':'common-row MT/LXX, Cainan OFF for comparison; labels and source terminal common'}),indent=2)+'\n')
finish(s,{'head_information':a,'head_differences':out,'rank':H.rank(),'lost_dimensions':len(ns)},'The two heads see12.5u and3u+lambda+2a+e+n. Their values1250 and430 leave three coefficient directions invisible, even though all local row changes are recoverable from five named observations.','Check whether the four-amplitude restriction restores that missing information.',{'expected_heads':out==[1250,430],'rank2':H.rank()==2,'kernel3':len(ns)==3})
