Cannot find the maximum value of a function
Try this:
MaxValue[a Sin[x] + b Cos[x] /. x -> 2 ArcTan[t] // TrigExpand, t, Reals]
MaxValue[{y, Reduce[{y == a Sin[x] + b Cos[x], #}, y, {x}, Reals]}, y]& /@
{Xor[a == 0, b == 0], a!=0 && b!=0} // FullSimplify
This is essentially what b.g did, except by using Max instead of the second derivative constraint we get the result without rewriting the original expression.
f[x_] = a Sin[x] + b Cos[x];
Simplify[
Max[f[x] /. Solve[ {f'[x] == 0 }, x] ],
Assumptions -> {Element[a, Reals], Element[b, Reals],
Element[C[1], Integers]}]
Sqrt[a^2 + b^2]
I'm a bit puzzled why the conditional expression on C[1]
doesn't simplify out
on its own when the C[1]
is gone from the expression..?
You can use a more down to earth method :
func = Sqrt[a^2 + b^2] Sin[x + f];
sol = First@Solve[{D[func, {x, 1}] == 0, D[func, {x, 2}] < 0,
f \[Element] Reals, a \[Element] Reals, b \[Element] Reals}, x, Reals];
Simplify[func /. sol, Assumptions -> C[1] \[Element] Integers]
(* Sqrt[a^2 + b^2] *)