ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 03 Apr 2019 18:59:37 -0500Maximize nonlinear function with linear constraintshttps://ask.sagemath.org/question/46008/maximize-nonlinear-function-with-linear-constraints/I would like to have Sage maximize 60 * 5^{x0} *4^{x1} * 3^{x2}, where x0, x1, x2 are nonnegative integers such that
x0+x1+x2=2k-3
and
x1+2*x2 >= 3k-3,
where k is any nonnegative integer such that 3<= k <=20. I would like to create a loop so that Sage does this for me for each of these values of k.
I know that Sage has a tool called minimize_constrained, but I can't find a tool called "maximize_constrained". Please help! Thank you in advance :-)Wed, 03 Apr 2019 18:13:14 -0500https://ask.sagemath.org/question/46008/maximize-nonlinear-function-with-linear-constraints/Answer by slelievre for <p>I would like to have Sage maximize 60 * 5^{x0} *4^{x1} * 3^{x2}, where x0, x1, x2 are nonnegative integers such that</p>
<p>x0+x1+x2=2k-3
and
x1+2*x2 >= 3k-3,</p>
<p>where k is any nonnegative integer such that 3<= k <=20. I would like to create a loop so that Sage does this for me for each of these values of k. </p>
<p>I know that Sage has a tool called minimize_constrained, but I can't find a tool called "maximize_constrained". Please help! Thank you in advance :-)</p>
https://ask.sagemath.org/question/46008/maximize-nonlinear-function-with-linear-constraints/?answer=46009#post-id-46009Hint: maximize f by minimizing (-f).Wed, 03 Apr 2019 18:59:37 -0500https://ask.sagemath.org/question/46008/maximize-nonlinear-function-with-linear-constraints/?answer=46009#post-id-46009