Say I want to calculate the maximum value of a simple function of two variables:
f[r_, t_]:= r Cos[t]^3 (1 + r Sin[t])
with respect to the variable t
. For a specific value of r
there is no problem. Executing
MaxValue[{f[.1, t], 0 <= t <= 2 Pi[]}, t]
immediately returns 0.00100166
. My problem arises when I want an arbitrary positive real value for r
, so as to get a function of one variable. I tried a couple of variations of
Assuming[r > 0,
Evaluate@MaxValue[{Num[r, t], 0 <= t <= 2 Pi[]}, t]
]
but all I get in return is the comically unhelpful
MaxValue[{r Cos[t]^3 (1 + r Sin[t]) , 0 <= t <= 2 Pi[]}, t]
I know I can code a simple algorithm that finds the 0s of the derivatives and then looks at the various values to find the biggest. But this is an expensive symbolic manipulation software, I don't think it's too much to ask that some function can do this.
Solve[D[r Cos[t]^3 (1 + r Sin[t]), t] == 0, t]
andSolve[D[r Cos[t]^3 (1 + r Sin[t]), t] == 0 && 0 <= t <= 2 \[Pi], t]
and ponder the dependence of the solution set onr
, it might become clearer whyMaximize
has trouble solving the problem generically. $\endgroup$