Message Boards Message Boards

0
|
5097 Views
|
6 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Get the local minimum of a function?

Posted 6 years ago

Hi, I am new in the community. I want to find a local Minimum of the following function

h = (A*Sin[o*t] - (A*Sin[o*t + p] - f))   

My steps to solve the problem:

h1 = D[h, t]   
lsg = Solve[h1 == 0, t] /. {A -> 1, p -> \[Pi]/4, o -> 2*\[Pi]*1} // N  

But I don´t get the correct local Minimums from Solve[...]. How can I solve the equation to find the local Minima??

POSTED BY: Tobias Köhler
6 Replies
In[15]:= h = (A Sin[o t] - (A Sin[o t + p]));

In[16]:= h1 = D[h, t];

In[17]:= r = 
 Reduce[h1 == 0 /. {A -> 1, p -> Pi/4, o -> 2 Pi}, t, Reals]

Out[17]= C[1] \[Element] 
  Integers && (t == (-2 ArcTan[
       2/Sqrt[2 - Sqrt[2]] + Sqrt[2]/(-2 + Sqrt[2])] + 2 \[Pi] C[1])/(
    2 \[Pi]) || 
   t == (2 ArcTan[2/Sqrt[2 - Sqrt[2]] - Sqrt[2]/(-2 + Sqrt[2])] + 
     2 \[Pi] C[1])/(2 \[Pi]))

In[27]:= fr = FullSimplify[r]

Out[27]= C[1] \[Element] 
  Integers && (1/16 + t == C[1] || t == 7/16 + C[1])
POSTED BY: Frank Kampas
Posted 6 years ago

Thank you :-) it works

POSTED BY: Tobias Köhler

Use a bulid-in function to this:

 A = 1;
 p = Pi/4;
 o = 2 Pi;
 FindMinimum[{(A Sin[o t] - (A Sin[o t + p] - 1)), 0 <= t <= 3/2}, {t, 1}]
 (* {0.234633, {t -> 0.9375} *)
 sol = FindMinimum[{(A Sin[o t] - (A Sin[o t + p] - 1))}, {t, 1}]
  (* {0.234633, {t -> 0.9375} *)
 Plot[(A Sin[o t] - (A Sin[o t + p] - 1)), {t, 0, Pi}, 
 Epilog -> {Red, PointSize[0.02], Point[{t /. sol[[2]], sol[[1]]}]}]

enter image description here

Symbolic solution:

 Minimize[{(A Sin[o t] - (A Sin[o t + p] - 1)), 0 <= t <= 3/2}, t]
  (* {1 - Sin[\[Pi]/4 - 
      2 ArcTan[2/Sqrt[2 - Sqrt[2]] + Sqrt[2]/(-2 + Sqrt[2])]] - 
    Sin[2 ArcTan[
       2/Sqrt[2 - Sqrt[2]] + Sqrt[2]/(-2 + Sqrt[2])]], {t -> (\[Pi] - 
      ArcTan[2/Sqrt[2 - Sqrt[2]] + Sqrt[2]/(-2 + Sqrt[2])])/\[Pi]}} *)
  %//N
  (* {0.234633, {t -> 0.9375} *)
POSTED BY: Mariusz Iwaniuk
h = (A Sin[o t] - (A Sin[o t + p] - f)) /. {A -> 1., p -> Pi/4, 
   o -> 2 Pi}
h1 = D[h, t]
FindRoot[h1 == 0, {t, 1}]
POSTED BY: Hans Dolhaine
Posted 6 years ago

Yes, I get this answer from mathematica too. But these are not the Solutions I need. enter image description here
I want to get this local minimum, but mathematica doesn´t find it. How can I do this??

POSTED BY: Tobias Köhler

Did you mean this?

In[1]:= h = (A Sin[o t] - (A Sin[o t + p] - f))
h1 = D[h, t];
lsg = Solve[h1 == 0, t] /. {A -> 1, p -> Pi/4, o -> 2 Pi} // N

Out[1]= f + A Sin[o t] - A Sin[p + o t]

During evaluation of In[1]:= Solve::ifun: Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information. >>

Out[3]= {{t -> -0.4375}, {t -> 0.4375}, {t -> -0.0625}, {t -> 0.0625}}
POSTED BY: Hans Dolhaine
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