Page 1 of 2 12 LastLast
Results 1 to 15 of 19

Math Help - Mathematica Help - Inequalities and Maximization

  1. #1
    Banned
    Joined
    Sep 2008
    Posts
    47

    Mathematica Help - Inequalities and Maximization

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

    Maximize |a|+|b|+|c| if a,b, \ \text{and} \ c are real numbers and |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?

    Could someone please help me? Thanks in advance!
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Super Member
    Joined
    Aug 2008
    Posts
    903
    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}}
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Banned
    Joined
    Sep 2008
    Posts
    47
    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!
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Senior Member bkarpuz's Avatar
    Joined
    Sep 2008
    From
    R
    Posts
    481
    Thanks
    2
    Quote Originally Posted by Winding Function View Post
    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 a=25, b=c=0 and x=-2 you get \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
    Follow Math Help Forum on Facebook and Google+

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

    Thanks!
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Senior Member bkarpuz's Avatar
    Joined
    Sep 2008
    From
    R
    Posts
    481
    Thanks
    2
    Quote Originally Posted by Winding Function View Post
    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}]
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Banned
    Joined
    Sep 2008
    Posts
    47
    Quote Originally Posted by bkarpuz View Post
    I guess that wth a=25, b=c=0 and x=-2 you get \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 |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?

    Thanks in advance!
    Follow Math Help Forum on Facebook and Google+

  8. #8
    Senior Member bkarpuz's Avatar
    Joined
    Sep 2008
    From
    R
    Posts
    481
    Thanks
    2
    Quote Originally Posted by Winding Function View Post
    But I thought that one of the conditions of the inequality was that |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?

    Thanks in advance!
    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
    Follow Math Help Forum on Facebook and Google+

  9. #9
    Super Member
    Joined
    Aug 2008
    Posts
    903
    In the original code I posted, I had |x|\geq 1. Just change it to |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}}
    Follow Math Help Forum on Facebook and Google+

  10. #10
    Senior Member bkarpuz's Avatar
    Joined
    Sep 2008
    From
    R
    Posts
    481
    Thanks
    2
    Quote Originally Posted by shawsend View Post
    In the original code I posted, I had |x|\geq 1. Just change it to |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 a*x^2 + b*x + c is maximizing |a|+|b|+|c| at the same time?
    Follow Math Help Forum on Facebook and Google+

  11. #11
    Banned
    Joined
    Sep 2008
    Posts
    47
    I need to maximize |a|+|b|+|c|.

    The conditions are:

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


    • |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 |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.

    Could someone please help me? Thanks!
    Follow Math Help Forum on Facebook and Google+

  12. #12
    Super Member
    Joined
    Aug 2008
    Posts
    903
    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?
    Follow Math Help Forum on Facebook and Google+

  13. #13
    Banned
    Joined
    Sep 2008
    Posts
    47
    Shouldn't a*x^2 + b*x + c be in absolute value code?
    Follow Math Help Forum on Facebook and Google+

  14. #14
    Senior Member bkarpuz's Avatar
    Joined
    Sep 2008
    From
    R
    Posts
    481
    Thanks
    2

    Talking

    Quote Originally Posted by Winding Function View Post
    Shouldn't a*x^2 + b*x + c be in absolute value code?
    I believe that \max\{|a|+|b|+|c|\}=\infty may hold this is why the program gives error
    Follow Math Help Forum on Facebook and Google+

  15. #15
    Banned
    Joined
    Sep 2008
    Posts
    47
    Quote Originally Posted by bkarpuz View Post
    I believe that \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!
    Follow Math Help Forum on Facebook and Google+

Page 1 of 2 12 LastLast

Similar Math Help Forum Discussions

  1. Maximization
    Posted in the Calculus Forum
    Replies: 2
    Last Post: May 31st 2010, 02:47 PM
  2. need help with Maximization
    Posted in the Calculus Forum
    Replies: 1
    Last Post: February 26th 2010, 03:46 AM
  3. Inequalities in Mathematica
    Posted in the Math Software Forum
    Replies: 0
    Last Post: November 10th 2009, 12:55 PM
  4. Inequalities [Mathematica]
    Posted in the Math Software Forum
    Replies: 1
    Last Post: October 1st 2008, 02:06 PM
  5. Maximization
    Posted in the Calculus Forum
    Replies: 6
    Last Post: January 19th 2007, 12:39 AM

Search Tags


/mathhelpforum @mathhelpforum