Thank you so much! That works in this case, but eventually I would want to change the utility function to something like
U1(x) = -a*e^(-x*1/a)
U2(x) = 1/(-x^3)
I imagine that it would work with U2(x), but not so much with U1(x). I also couldn’t use your trick, since the derivative of an exponential is an exponential. Do you know of anything else I could try?