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??
hdolhaine
(Hans Dolhaine)
August 28, 2018, 8:46am
2
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}}
Yes, I get this answer from mathematica too. But these are not the Solutions I need.
I want to get this local minimum, but mathematica doesn´t find it. How can I do this??
hdolhaine
(Hans Dolhaine)
August 28, 2018, 9:25am
4
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}]
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]]}]}]
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} *)
fkampas
(Frank Kampas)
August 28, 2018, 2:50pm
7
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])