0
$\begingroup$

I'm writing a bit of code for a project. I am attempting to find the minimum x-value for a function, which I did get, but Mathematica still threw an error at me. My code is as following:

F[t_] := ((1/8)*(((0.1*t) - 3)^5)) - 0.5*(((0.1*t) - 3)^3)
G[t_] := ((0.1*t) - 3)^2
S[t_] := Sqrt[((F'[t])^2) + ((G'[t])^2)]
FindMinimum[S[t], {t, 30}]

The result yielded this output:

FindMinimum::lstol: The line search decreased the step size to within the tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient decrease in the function. You may need more than MachinePrecision digits of working precision to meet these tolerances. {0., {t -> 30.}}

I did attempt to work with certain syntax portions, but I am a bit lost as of now. Any suggestions would be greatly appreciated.

$\endgroup$

closed as off-topic by Michael E2, Bob Hanlon, MarcoB, José Antonio Díaz Navas, m_goldberg Apr 21 '18 at 1:53

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Michael E2, Bob Hanlon, MarcoB, José Antonio Díaz Navas, m_goldberg
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    $\begingroup$ S[30] is 0. and the minimum cannot be lower than that, so FindMinimum is hardly needed here. $\endgroup$ – ilian Apr 19 '18 at 23:38
4
$\begingroup$
F[t_] = ((1/8)*(((0.1*t) - 3)^5)) - 0.5*(((0.1*t) - 3)^3) // 
   Rationalize;

G[t_] = ((0.1*t) - 3)^2 // Rationalize;

S[t_] = Sqrt[((F'[t])^2) + ((G'[t])^2)] // Simplify;

Minimize[S[t], t]

(* {0, {t -> 30}} *)

NMinimize[S[t], t, WorkingPrecision -> 25] // N

(* {7.77079*10^-14, {t -> 30.}} *)

As stated in the documentation "FindMinimum[f, {x, x0, x1}] searches for a local minimum in f using x0 and x1 as the first two values of x, avoiding the use of derivatives."

FindMinimum[S[t], {t, 29, 31}]

(* {0., {t -> 30.}} *)

The Plot shows why the derivative is a problem at t == 30

Plot[S[t], {t, 0, 60}]

enter image description here

$\endgroup$
  • $\begingroup$ Yes, I forgot to put a left and right bound on FindMinimum. Thanks for the clarification. $\endgroup$ – Apple Cola Apr 20 '18 at 0:01
1
$\begingroup$

NMinimize solves your problem directly(global minimum)

NMinimize[S[t], {t, 30}]
(*{4.47035*10^-9, {t -> 30.}}*)
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.