1
$\begingroup$

So, I want to, say, find a maximum value of $|x_1x_3+x_1x_4+x_2x_3-x_2x_4|$ in a unit cube in 4D; how do I do that?

I've tried

NMaximize[Abs[a*c + a*d + b*c - b*d], {a, b, c, d } in Cuboid[{0, 0, 0, 0}]],

but it said that

a in Cuboid[{0,0,0,0}] is not a valid variable;

I also tried doing

Maximize[Abs[a* c + b* c + a *d - b* d], {{a, 0, 1}, {b, 0, 1}, {c, 0, 1}, {d, 0, 1}} ],

but did not prevail as well.

What is the correct syntax for this?

$\endgroup$
1
$\begingroup$
NMaximize[
 Abs[a*c + a*d + b*c - b*d], {a, b, c, d} \[Element] 
  Cuboid[{0, 0, 0, 0}]]

(* {2., {a -> 1., b -> 1., c -> 1., d -> 1.}} *)

$\endgroup$
  • $\begingroup$ Oh, so that's how you write $\in$... Thanks! $\endgroup$ – Akiiino May 17 '16 at 18:11
  • $\begingroup$ @Akiiino. Alternatively, hit the escape button, type elem, and hit the escape button again. $\endgroup$ – march May 17 '16 at 18:14
  • $\begingroup$ @Akiiino... gosh, so not even an upvote? $\endgroup$ – David G. Stork May 17 '16 at 18:14
  • $\begingroup$ @DavidG.Stork sort of waiting for the site to allow me to accept the answer... But yeah, definitely no upvote now $\endgroup$ – Akiiino May 17 '16 at 18:16

Your Answer

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

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