# NM-Solved(How to plot points from a Maximize[ ] output)

1. Sep 14, 2010

### Wesleytf

NM-Solved(How to plot points from a "Maximize[ ]" output)

Hello all,

I'm working with some data sets and I want to make a bar-type graph out of the numbers that result after a series of equations ending in a maximize function. My trouble is that the output of the function gives something like

Code (Text):

{21.0133, {b -> 1, c -> -3., d -> 2., e -> 3, f -> 4}}

How can I reference these numbers without having to manually enter them? I want to make a list plot out of them where each value corresponds to x coordinates 1, 2..., so I need them in a list {1, -3, 2, 3, 4}. Any ideas?

edit: I think I can solve this by flipping the equation and using linear programming. No need to reply, but thanks for looking.

Last edited: Sep 14, 2010
2. Sep 17, 2010

### yourgoldteeth

Re: NM-Solved(How to plot points from a "Maximize[ ]" output)

The way I would do it is assign that solution to a variable, like this

Code (Text):
solution = Maximize[...]
Then, you can apply this as you see fit. Here is an example:

Code (Text):
Plot[function[a,b,c] /. solution[[2]]]
The /. tells Mathematica to replace the arguments of function[] with the values of a,b,c from solution.

You use solution[[2]] because the second element of solution is the values of the variables.

3. Sep 17, 2010

### jackmell

Re: NM-Solved(How to plot points from a "Maximize[ ]" output)

myaray = {b -> 1, c -> -3., d -> 2., e -> 3, f -> 4}

#[[2]] & /@ myaray