Earlier quoted context omitted.
numpy is great for vectorizable calculations, but many calcs (particularly for long-term life contingent risks, i.e. reserves), are not vectorizable except in the most simplistic cases.
Thanks - sorry I'm struggling a bit - wouldn't they be vectorizable across the portfolio or across scenario for stochastic calculations. Maybe it's because of different backgrounds (mine in UK) but I'm can't recall seeing the deeply nested function calls that you're alluding to.
fundValue(t+1) = if t > 0 fundValue(t) - charges(t) + intCred(t) else initialPrem
charges(t) = netAmtAtRisk(t) * costOfInsurance(t) + riderCosts(t) + policyFee(t)
netAmtAtRisk = (FaceAmt - fundValue(t))
Now think layering on decrements
surrenderMargin(t) = lapseDecrement(t) * (surrenderCharge(t) * fundValue(t))
mortalityMargin(t) = mortalityDecrement(t) * netAmtAtRisk(t)
investmentMargin(t) = (earnedRate(t) - intCred(t)) * assetBase(t)
Now think layering on calcs necessary to calculate the assetBase (e.g. reserves + required capital)...