import json
from pathlib import Path
O=Path(__file__).parent
r=.10
def npv(v):return sum(x/(1+r)**i for i,x in enumerate(v))
a=[-7,1.2,2.8,5.4];b=[-3.5,1.5,1.5,2];low=[-7,.4,1.2,3]
pricecut=[-7,.4,1.6,3.8]
high_at1=-6+4/1.1+7/1.1**2;low_at1=-6+1/1.1+2/1.1**2
out=dict(immediateA=dict(cash=a,npv=npv(a)),coreB=dict(cash=b,npv=npv(b)),lowA=dict(cash=low,npv=npv(low)),priceCutA=dict(cash=pricecut,npv=npv(pricecut)),staged=dict(highContinuationNPV=high_at1,lowContinuationNPV=low_at1,npvAtPriorHalf=-1+.5*max(0,high_at1)/1.1,npvAtPriorPointSix=-1+.6*max(0,high_at1)/1.1,probabilityToMatchB=(npv(b)+1)*1.1/high_at1),expectedImmediateAtHalf=.5*npv(a)+.5*npv(low))
(O/'mba700-outputs.json').write_text(json.dumps(out,indent=2));print(json.dumps(out,indent=2))
