Assume that payments occur every 6 months, and payments and interest receipts coincide and take a naive approach
payments = {500, 673, 245, 345, 245, 674, 425, 145, 37, 423};
(*made 6 monthly*)
Print["payments required = ", payments];
effectiverate = (1 + .04)^0.5 - 1;
(*compunding every 6 months*)
Print["effectiverate = ", effectiverate];
bondelements = Table[payments[[i]]/(1 + effectiverate)^i, {i, 1, Length[payments]}];
(*investment components to make payments*)
p = Apply[Plus, bondelements];
(*principal investment needed*)
Print["principal investment required = ", p];
output is
payments required = {500,673,245,345,245,674,425,145,37,423}
effectiverate = 0.0198039
principal investment required = 3381.8
Use of standard expressions by Daniel gives another answer
payments = {500, 673, 245, 345, 245, 674, 425, 145, 37, 423};
tvm = TimeValue[Cashflow[payments, 1/2], EffectiveInterest[.04, 0], -1/2];
Print["principal investment required = ", tvm];
principal investment required = 3375.65
But this is reconciled if we use annual compounding in the code, EffectiveInterest[.04,1]
payments = {500, 673, 245, 345, 245, 674, 425, 145, 37, 423};
tvm = TimeValue[Cashflow[payments, 1/2], EffectiveInterest[.04, 1], -1/2];
Print["principal investment required = ", tvm];
principal investment required = 3381.8
It is important to sketch a time-line diagram when timing or amounts become irregular, such as when interest is calculated annually on average balances. Using the Ruffle[list1,list2] command is useful for resolving irregularities in the problem formulation.