0
$\begingroup$

I have a very simple problem that Mathematica is giving a wrong answer to. I want to minimize the following function: $\frac{3+t^2+6\theta +3 \theta^2}{6 t^3}$ in $\theta$ and $t$. Now, plotting the function in 3D I can see that there is a runaway towards $t\rightarrow \infty$, so that $t \rightarrow \infty$ should minimize the function. If I then plot the function in $\theta$ that I get if I plug in extremely large values of $t$, it has a true minimum at $\theta = 1$. So in my heart, I know that the function should be minimized at $(\theta, t) = (\approx-1, \infty)$.

However, if I use FindMinimum, it returns essentially the answer $(\theta, t)=(-\infty, \infty)$. By plugging in some values for $\theta$, I can see that the function really increases with increasingly negative $\theta$, so there really should not be a minimum at $-\infty$! How do I get Mathematica to give me back the correct minimum without imposing some constraint like $\theta>0$ by hand?

$\endgroup$
  • $\begingroup$ f[th_, t_] := (3 + t^2 + 6 th + 3 th^2)/(6 t^3); FindMinimum[f[th, t], {{th, -1}, {t, -1}}] yields {-1.01109*10^9, {th -> -1., t -> -3.29407*10^-10}} $\endgroup$ – MelaGo Oct 14 at 0:41
  • $\begingroup$ The minimum should lie at $t=+\infty$, not negative infinity. $\endgroup$ – naomig Oct 14 at 0:44
  • $\begingroup$ Also, I know I can feed it initial data around which to look for the minimum. I am specifically asking how to avoid this (given that the answer it's giving me is not a minimum anyway) $\endgroup$ – naomig Oct 14 at 0:45
  • $\begingroup$ That minimum is at t=~0, not negative infinity. You can tell just by looking at your function that it has a singularity at t=0. $\endgroup$ – MelaGo Oct 14 at 0:52
  • $\begingroup$ Please show the code you used ("a minimal working code example of your problem or your efforts). $\endgroup$ – Michael E2 Oct 14 at 1:50
1
$\begingroup$
f[th_, t_] := (3 + t^2 + 6 th + 3 th^2)/(6 t^3)

Plot3D[f[th, t], {t, -10, 10}, {th, -10, 10}, AxesLabel -> {t, th}, 
 PlotRange -> {-10, 10}, PlotPoints -> 100]

enter image description here

enter image description here

This is more easily visualized by plotting f in 2D, for a few discrete values of t:

Plot[{f[th, .1], f[th, .5], f[th, 1], f[th, -.1], f[th, -.5], f[th, -1]}, {th, -10, 10}, PlotRange -> {-200, 200}, AxesLabel -> {th, f}]

enter image description here

And zooming in:

enter image description here

The minimum is either ~0, at th=-1, for positive t (approaching 0 as t gets very large), or -Infinity, for negative t.

Plotting the other dimension shows that for positive t, the minimum approaches 0 as t ~ Infinity, and for negative t, the minimum is -Infinity near t=0.

Plot[{f[-1, t], f[-.5, t], f[0, t], f[.5, t], f[1, t]}, {t, -10, 10}, PlotRange -> {-10, 10}, AxesLabel -> {t, f}]

enter image description here

$\endgroup$

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