Click here for the answer

compound[P_,R_,n_] := P*E^(n*Log[1+R]);