Message Boards Message Boards

1
|
711 Views
|
8 Replies
|
8 Total Likes
View groups...
Share
Share this post:

Minimize doesn't work for a given function

Posted 2 months ago

I'm trying to minimize the function V(phi) using the code below

a =.
f =.
th =.
mu =.
md =.
V[phi_] := -2 * (mu Cos[phi + th/2] + md Cos[phi - th/2])
Minimize[V[phi], phi]

But the output is just the command itself!

Out: Minimize[-2 (md Cos[phi - th/2] + mu Cos[phi + th/2]), phi]

What am I doing wrong?

8 Replies

Parametric minimization seems to be supported only in the algebraic case. You can algebrize your trigonometric problem, though:

subst = {Cos[phi] -> x, Sin[phi] -> y};
TrigExpand[V[phi]] /. subst
Minimize[{%, x^2 + y^2 == 1}, {x, y}]
% /. Map[Reverse, subst]
% // Simplify
POSTED BY: Gianluca Gorni
Posted 2 months ago

Very smart idea!

POSTED BY: Denis Ivanov
Posted 2 months ago

Well, we can use mathematical analysis.
If we want to find $\min$ of $-2 \cdot f$ then we need to find $\max$ of $f$.
So it is root of first derivative with negative second derivative.
I rewrote your expression a little for simplicity, so we try this:

Clear[a, b, t, V];
V[x_] := a Cos[x + t/2] + b Cos[x - t/2];

And if we run next code, in 15-20 sec (on average laptop) we get big dump, but with meaningful and useful results:

goal = D[V[x], x];
secDeriv = D[V[x], {x, 2}];
Reduce[goal == 0 && secDeriv < 0 && 0 <= x <= 2 \[Pi], x, Reals]
POSTED BY: Denis Ivanov

Thanks man!! It's so weird that you cannot just use Minimize/Maximize

Posted 2 months ago

Well, I like Mathematica, in many ways it's cool thing! So I report this issue as bug,
looks like problem in trig functions.

POSTED BY: Denis Ivanov
Posted 2 months ago

This is very strange. Even

Minimize[{Cos[x + a/2], {0 <= x <= 2\[Pi], 0 < a < 1}}, x]

not work. There are similar question on MSE: [1] [2] The answers suggest add a to variables of minimization:

Minimize[{Cos[a/2 + x], {0 <= x <= 2\[Pi], 0 < a < 1}}, {a, x}]
Out: {-1, {a -> 9/34, x -> 1/68 (-9 + 68 \[Pi])}}

But this is bad cheating, cause we need parametric solution!
In docs there is example with fully parametric solution for ax^2+b x + c.
I'm going to post revisited question on MSE and query for Support team.

POSTED BY: Denis Ivanov
Posted 2 months ago

I'm not sure what you expect when you don't have any constraints on the other symbols used in V. No matter what value you try for phi, md and mu could dominate and make the result arbitrarily large or small.

POSTED BY: Eric Rimbey

Right. How do I add the constraints? I tried to use

`$Assumptions =  th >= 0 && mu >= 0 && md >= 0`

but without much success...

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract