1
$\begingroup$

I'm trying to solve this (rather basic) maximization problem using Mathematica: $$ \left\{ \begin{aligned} \sqrt2 s &= 2d\\ r^2 &= x^2+d^2\\ h(x) &= r+x\\ A(x) &= s^2\\ V(x) &= \frac{1}{3}A(x)h(x)=\frac{1}{3}s^2(r+x) \end{aligned} \right. $$ where $0<d<r$ and $0<x<r$.

I tried the following;

First I tried to calculate $s$ as function of $r$ and $x$;

 Solve[{Sqrt[2] s == 2 d, x^2 + d^2 == r^2, 0 < d < r, 0 < x < r}, {s, d}]

That returned

 {{s -> ConditionalExpression[Sqrt[2] Sqrt[r^2 - x^2], r > 0 && 0 < x < r], 
 d -> ConditionalExpression[Sqrt[r^2 - x^2], r > 0 && 0 < x < r]}}

which I don't understand as I have already given the constraints in the Solve command.

A simple fix is

 s[x_] = s /. Solve[{Sqrt[2] s == 2 d, x^2 + d^2 == r^2, 0 < d < r, 0 < x < r}, {s, d}][[1]] // Normal

but I don't understand the need for it.

To continue,

 A[x_] := s[x]^2
 h[x_] := r + x
 V[x_] := 1/3 A[x] h[x]

defines $V(x)$.

Now, classic analysis we find when $V'(x)=0$;

 Solve[{V'[x] == 0, 0 < x < r}, x]

and again I get an “odd” answer;

 {{x -> ConditionalExpression[r/3, r > 0]}}

I thought I made that clear in the Solve command, and

 Maximize[{V[x], 0 < x < r}, x]

gives an even more so “odd” answer (not shown).

Is there anyone that can show me the correct commands to get "neat and plain" output from Mathematica without restraints in the answers? TIA.

$\endgroup$
0

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.