# Minimizing a function with a constant $l > 0$

I'm VERY new to Mathematica and would like some help with minimizing a function.

$$f(x) = \frac{1}{2} \sqrt{\frac{\left(l^4+x^4\right)^2}{l^4 x^2}}$$

I want to find which $$x-value$$ (probably depending on $$l$$) yields the lowest function value, where $$l > x > 0$$.

Mathematica input for function:

1/2 Sqrt[(l^4 + x^4)^2/(l^4 x^2)]


### What I tried:

Minimize[1/2 Sqrt[(l^4 + x^4)^2/(l^4 x^2)], {x}]

Manipulate[
Plot[1/2 Sqrt[(l^4 + x^4)^2/(l^4 x^2)], {x, 0, l}], {l, 1, 10}]


Output:

• Please post the code you already tried Dec 18 '14 at 23:43
• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! Dec 18 '14 at 23:43
• Plot[1/2 Sqrt[(x (l + x)^2)/l] /. l -> 1, {x, 0, 1}] Dec 18 '14 at 23:47
• The output you're getting seems the right answer. What do you expect? Dec 18 '14 at 23:51
• @B.Lee plot instead from -0.9 to 0.9, you will see that your expression is symmetric under x->-x. So if there's a minimum at +0.759 there is also one at -0.759. You might also try Solve[D[1/2 Sqrt[(l^4 + x^4)^2/(l^4 x^2)], x] == 0, x]. Dec 19 '14 at 0:13

The output looks fine to me. It is, however, relatively complicated. Consider the following simpler example

Minimize[x (x - c), x]
(* Out: {-c^2/4, {x -> c/2}} *)


Thus, there is a minimum value of $y=-c^2/4$ at $x=c/2$, as expected. Now, let's complicate things slightly.

Minimize[c x (x - c), x]


This is a piecewise expression, which is necessary since the result depends crucially on whether $c$ is positive, negative, or zero. Your problem has generated a piecewise expression for the same reason. You've also got a further complication since Mathematica has returned Root expressions. This is is often necessary. For example, the solutions of $x^5-x-1=0$ cannot be easily expressed in terms of radicals. That explains the following cryptic output:

Solve[x^5 - x - 1 == 0, x, Reals]
(* Out: {x -> Root[-1 - #1 + #1^5 &, 1]}} *)


Thus, the one real solution is the first root of $-1-x+x^5$. Doesn't seem very useful, but you can evaluate this numerically.

N[%]
(* Out: {{x -> 1.1673}} *)


Now, your solution is expressed in terms of the roots of a fourth degree polynomial, and we can get an alternative formulation which might be more to your liking. I'm not sure. Here goes, though:

minInfo = Minimize[1/2 Sqrt[(l^4 + x^4)^2/(l^4 x^2)], {x}] //.


A bit better, I guess. It's much better, if you plug in a specific value:

minInfo /. l -> 3
(* Out: {-2 3^(1/4), {x -> 3^(3/4)}} *)


I emphasize that you could have plugged numbers in anyway, as Beli showed in his answer.

• WOW! You are.. You are the best! You have no idea how long it's taken me to understand this. I would give you +3 if I could! Dec 19 '14 at 0:20
• @B.Lee An accept is ample and you're welcome. Maybe Beli could bounty it, as he has 64K these days. :) Dec 19 '14 at 0:22
• @MarkMcClure You've got my +1. My kids already took control of their inheritance. Dec 19 '14 at 0:57
Manipulate[
p = {x, s@x} /. Last@Minimize[{s@x, l > x > 0}, {x}];
Plot[s@x, {x, 0, l}, Epilog -> {PointSize[Large], Point@p}, PlotLabel -> p], {l, 1, 10},
Initialization :> {s@x_ := 1/2 Sqrt[(l^4 + x^4)^2/(l^4 x^2)]}]


Since you give the constraint l > x > 0, you should make use of that constraint

f[x_] = 1/2 Sqrt[(l^4 + x^4)^2/(l^4 x^2)];

min = FullSimplify[
Minimize[{f[x], l > x > 0}, x], l > x > 0]


min[[1]] == Simplify[f[x /. min[[2]]], l > 0]


True

f'[x] /. min[[2]]


0

Simplify[(f''[x] /. min[[2]]) > 0, l > 0]


True

• Thank you. I discovered the equation you got, and figured it didn't print that one out from the start because I hadn't specified the constraints. This helped me see how to apply constraints. Dec 19 '14 at 15:27

here is another way to approach the problem...

• Please post code, not images whenever possible. Thanks a lot! Dec 19 '14 at 14:38