3

I am trying to minimise a function (surface area of an irregular box) subject to a certain constraint (fixed volume of box):

{Minimize[
   {Sqrt[107.8] π s Sin[θ] + 4 s Sqrt[107.8] + 107.8, -623.6 + 107.8 s Cos[θ] + 
      20.7654 s^2 Cos[θ] Sin[θ] + (π s^3 Cos[θ] Sin[θ]^2)/3 == 0},
   {s, θ}]}

Mathematica returns this:

{{-5562.72, {s -> -128.739, θ -> -3.21881}}}

However, I require positive values for surface area, s (slant length) and θ. Is there any way to do this?

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
gerald ek
  • 33
  • 2

1 Answers1

2

All you need to do is conjoin the additional constraints θ > 0, s > 0 to the one you have already stated. Like so.

Minimize[
 {Sqrt[107.8] π s Sin[θ] + 4 s Sqrt[107.8] + 107.8,
  -623.6 + 107.8 s Cos[θ] + 20.7654 s^2 Cos[θ] Sin[θ] + 
     (π s^3 Cos[θ] Sin[θ]^2)/3 == 0 && θ > 0 && s > 0},
 {s, θ}]

{343.438, {s -> 5.14342, θ -> 0.131681}}

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
  • Thanks! That was exactly what I was looking for. Also, is there a way to reveal the "step by step" approach that Mathematica took to find the solution? – gerald ek Mar 12 '18 at 15:45
  • @geraldek. I'm using Mathematica 11.1. It can't do that. From Stephen Wolfram's video introducing 11.3, I got the impression that 11.3 supports step-by-step evaluation for some kinds of expressions and that support for more would appear in future versions. – m_goldberg Mar 12 '18 at 19:54
  • @geraldek. I'm glad you find my answer useful. Please consider accepting it. You can do that by clicking on the check mark that appears on the left of the answer below the down arrow. – m_goldberg Mar 12 '18 at 19:56