Power-wealth investment with running utility (source code)

= Power-wealth investment with running utility
{title2=$\pi^*/W=(\mu-r)/((1-\gamma)\sigma^2)$}

For a <self-financing portfolio> earning both running reward $e^{-\rho t}W^\gamma$ and terminal reward $W_T^\gamma$, $0<\gamma<1$, with no consumption withdrawals, <Hamilton-Jacobi-Bellman equation> gives $J(W,t)=A(t)W^\gamma$ and the displayed constant risky fraction. The coefficient satisfies $A'+\kappa A+e^{-\rho t}=0$, $A(T)=1$, where $\kappa=\gamma r+\gamma(\mu-r)^2/(2(1-\gamma)\sigma^2)$. Its positive solution is $e^{\kappa(T-t)}+\int_t^T e^{\kappa(s-t)-\rho s}ds$. Risk aversion is $1-\gamma$; increasing $\gamma$ raises risky investment and can require borrowing.