# Thread: Mathematica Help - Inequalities and Maximization

1. ## Mathematica Help - Inequalities and Maximization

What commands should I put into Mathematica if I wanted the following:

Maximize $\displaystyle |a|+|b|+|c|$ if $\displaystyle a,b, \ \text{and} \ c$ are real numbers and $\displaystyle |x|\leq 1 \ \text{and} \ |ax^2+bx+c|\leq 100$.

I got an error message when I input my code. Maybe I don't know how to correctly input the info, or Mathematica can't solve this?

2. Here's what it looks to me:

Code:
In[147]:=
Maximize[{a*x^2 + b*x + c,
{Abs[x] >= 1 && a*x^2 + b*x + c <= 100 &&
Element[{a, b, c}, Reals]}},
{a, b, c, x}]

Out[147]=
{100, {a -> 25, b -> 0, c -> 0, x -> -2}}

3. Sorry, I'm a bit new to Mathematica. What exactly does the syntax
Code:
{100, {a -> 25, b -> 0, c -> 0, x -> -2}}
mean?

Thanks!

4. Originally Posted by Winding Function
Sorry, I'm a bit new to Mathematica. What exactly does the syntax
Code:
{100, {a -> 25, b -> 0, c -> 0, x -> -2}}
mean?

Thanks!
I guess that wth $\displaystyle a=25, b=c=0$ and $\displaystyle x=-2$ you get $\displaystyle \max=100$.
However, you have to type the following
Code:
In[147]:=
Maximize[{Abs[a]+Abs[b]+Abs[c], {Abs[x] =< 1 && Abs[a*x^2 + b*x + c] <= 100 && Element[{a, b, c}, Reals]}}, {a, b, c, x}]
Again thanks to shawsend

5. What does the
Code:
In[147]
syntax mean? Can I omit that, since Mathematica gives me an error when I put that in?

Thanks!

6. Originally Posted by Winding Function
What does the
Code:
In[147]
syntax mean? Can I omit that, since Mathematica gives me an error when I put that in?

Thanks!
you wont type it!
Mathematica puts it itself to indicate how many operations have been done, its just a counter.

In a line just type the following
Code:
Maximize[{Abs[a]+Abs[b]+Abs[c], {Abs[x] =< 1 && Abs[a*x^2 + b*x + c] <= 100 && Element[{a, b, c}, Reals]}}, {a, b, c, x}]

7. Originally Posted by bkarpuz
I guess that wth $\displaystyle a=25, b=c=0$ and $\displaystyle x=-2$ you get $\displaystyle \max=100$.
However, you have to type the following
Code:
In[147]:=
Maximize[{Abs[a]+Abs[b]+Abs[c], {Abs[x] =< 1 && Abs[a*x^2 + b*x + c] <= 100 && Element[{a, b, c}, Reals]}}, {a, b, c, x}]
Again thanks to shawsend
But I thought that one of the conditions of the inequality was that $\displaystyle |x|\leq 1 \ \text{and} \ |ax^2+bx+c|\leq 100$. Did I mess up the code? If so, how, and what is the correct code?

8. Originally Posted by Winding Function
But I thought that one of the conditions of the inequality was that $\displaystyle |x|\leq 1 \ \text{and} \ |ax^2+bx+c|\leq 100$. Did I mess up the code? If so, how, and what is the correct code?

I don't know why it is not working, but the example shawsend gave works, however its not exactly what you need.
I just modified it and it did not work

9. In the original code I posted, I had $\displaystyle |x|\geq 1$. Just change it to $\displaystyle |x|\leq 1$:

In[1]:=
Maximize[{a*x^2 + b*x + c,
{Abs[x] <= 1 && a*x^2 + b*x + c <= 100 &&
Element[{a, b, c}, Reals]}},
{a, b, c, x}]

Out[1]=
{100, {a -> 400, b -> 0, c -> 0, x -> 1/2}}

10. Originally Posted by shawsend
In the original code I posted, I had $\displaystyle |x|\geq 1$. Just change it to $\displaystyle |x|\leq 1$:

In[1]:=
Maximize[{a*x^2 + b*x + c,
{Abs[x] <= 1 && a*x^2 + b*x + c <= 100 &&
Element[{a, b, c}, Reals]}},
{a, b, c, x}]

Out[1]=
{100, {a -> 400, b -> 0, c -> 0, x -> 1/2}}
I really don't see if maximizing $\displaystyle a*x^2 + b*x + c$ is maximizing $\displaystyle |a|+|b|+|c|$ at the same time?

11. I need to maximize $\displaystyle |a|+|b|+|c|$.

The conditions are:

• $\displaystyle a,b, \ \text{and} \ c$ are real numbers

• $\displaystyle |x|\leq 1 \ \text{and} \ |ax^2+bx+c|\leq 100$.

I don't think that
Code:
Maximize[{a*x^2 + b*x + c,
{Abs[x] <= 1 && a*x^2 + b*x + c <= 100 &&
Element[{a, b, c}, Reals]}},
{a, b, c, x}]
worked, since the first line doesn't seem to maximize the right thing.

This:
Code:
In[147]:=
Maximize[{a*x^2 + b*x + c,
{Abs[x] >= 1 && a*x^2 + b*x + c <= 100 &&
Element[{a, b, c}, Reals]}},
{a, b, c, x}]

Out[147]=
{100, {a -> 25, b -> 0, c -> 0, x -> -2}}
did not work because it didn't satisfy the condition that $\displaystyle |x|\leq 1$.

The closest I got was
Code:
Maximize[{Abs[a]+Abs[b]+Abs[c], {Abs[x] =< 1 && Abs[a*x^2 + b*x + c] <= 100 && Element[{a, b, c}, Reals]}}, {a, b, c, x}]
, but this gave me an error message.

12. Ok. I agree. I made a mistake. Looks though then there is no solution:

Code:
In[10]:=
Maximize[{Abs[a] + Abs[b] + Abs[c],
{a*x^2 + b*x + c <= 100 && Abs[x] <= 1 &&
Element[{a, b, c}, Reals]}},
{a, b, c, x}]

During evaluation of In[10]:= Maximize::natt:
The maximum is not attained at
any point satisfying the given
constraints.  >>

Out[10]= {\[Infinity], {a -> Indeterminate,
b -> Indeterminate, c -> Indeterminate,
x -> Indeterminate}}
That makes sense right? For any large positive value of a, I can choose large enough negative values of b and c to make the inequality hold. Or no?

13. Shouldn't a*x^2 + b*x + c be in absolute value code?

14. Originally Posted by Winding Function
Shouldn't a*x^2 + b*x + c be in absolute value code?
I believe that $\displaystyle \max\{|a|+|b|+|c|\}=\infty$ may hold this is why the program gives error

15. Originally Posted by bkarpuz
I believe that $\displaystyle \max\{|a|+|b|+|c|\}=\infty$ may hold this is why the program gives error
I don't get what you said. I was referring to shawsend's post (#12 in this thread). Is a*x^2 + b*x + c supposed to be in absolute value code?

Thanks!

Page 1 of 2 12 Last