from research import *
from algebra import Matrix
s=begin(1158,'Recover the shared amplitudes from complementary totals','Do the regular and two cumulative totals jointly determine the fixed-support model?',{},['C1157'])
d=json.loads((ROOT/'model/postflood_total_measurements.json').read_text());A=Matrix([d['regular_total_row'],d['SP_life_total_row'],d['LXX_life_total_row']]);obs=Matrix([650,-120,454]);v=list(A.inv()*obs)
a=artifact('model/postflood_total_parameter_recovery.json',json.dumps(clean({'matrix':A.tolist(),'totals':[650,-120,454],'determinant':A.det(),'parameters':v,'qualification':'the complete source masks are already held; these totals do not recover where row changes occur'}),indent=2)+'\n')
finish(s,{'total_parameter_recovery':a,'determinant':A.det(),'parameters':v},'The three complementary totals recover100,60,27 exactly within the fixed-support model. Their success depends on the located source patterns; totals alone cannot justify that pattern.','Demonstrate the source-location information that this recovery still requires.',{'rank3':A.rank()==3,'exact_parameters':v==[100,60,27]})
