I’m currently using Julia to perform utility optimization on an n-period model with one stock implementing a buy-and-hold strategy. I want to generalize my program to find the optimal number of shares for any general utility function U(x) of the form
U(x) = 1/\beta * x^\beta
Where x represents the terminal capital at time n. I’m using the PolynomialRoots packages to find the roots of the expected value of U(x) (E[U(x)], x is of type Polynomial), but I’m running into an issue where I can’t raise the Polynomial type to a power. I was able to work around this when using specific integer values (just by doing x * x * x instead of x^3, etc.), but now that I want to generalize it I’m stuck on how to do it for non-integer values like 1/2, 1/3, etc. Ideally, I would be able to do this for any rational value of \beta.
Any help/tips would be much appreciated! Thanks for your time.