Syntax of Maximum of $ax^2+bx+c$ in MAPLE

52 Views Asked by At

I want to obtain a maximum value of an expression including parameter constants. Can someone provide me the syntax in MAPLE for evaluating maximum of

1.$ax^2+bx+c$ where a,b,c are constants and x is variable.

2.$ax^2+bx+c$-dy where a,b,c,d are constants and x,y are variable. Thanks in advance.

2

There are 2 best solutions below

4
On

the result is $$\left\{ \begin{array}{cc} \{ & \begin{array}{cc} c & (b=0\land a=0)\lor (b=0\land a<0) \\ \frac{4 a c-b^2}{4 a} & (b>0\land a<0)\lor (b<0\land a<0) \\ \infty & \text{True} \\ \end{array} \\ \end{array} ,\left\{x\to \begin{array}{cc} \{ & \begin{array}{cc} -\frac{b}{2 a} & (b>0\land a<0)\lor (b<0\land a<0) \\ 0 & (b=0\land a=0)\lor (b=0\land a<0) \\ \text{Indeterminate} & \text{True} \\ \end{array} \\ \end{array} \right\}\right\}$$

0
On

Make use of the assume facility to make $a$, $b$ and $c$ constants and then use the maximize functional. The additional condition x=-infinity..infinity below translates to $x\in \mathbb R$ so as to avoid complex $x$.

assume(a::real,b::real,c::real);
maximize(a*x^2+b*x+c,x = -infinity..infinity) ;#assuming a>0;

Output:

$ \max \left( \operatorname{signum} \left( a\!\sim \right) \infty ,-1/4\,{\frac {{b\!\sim}^{2 }}{a\!\sim}} \right) +c\!\sim $