Creditors, banks and bank regulators should evaluate whether a borrower is likely to default. I apply several techniques in the extensive mathematical literature of stochastic optimal control/dynamic programming to derive an optimal debt in an environment where there are risks on both the asset...