# Use the numbers found in an optimization problem somewhere else?

Posted 4 years ago
4412 Views
|
3 Replies
|
2 Total Likes
|
 Hello all, Let's say we solve maximization problem and create a table for a specific range. An example: c1 = Table[NMaximize[{(x*y - y^2 + x - x^2)*a/2, 0 <= y <= x <= 1, a*(1 - y) <= 1}, {x, y}], {a, 1, 6, 0.1}] Now resulting table have elements in a form such: {0.166667, {x -> 0.666667, y -> 0.333333} In order to solve another problem, I need to use these x and y values. How can I call them in a different place?Best, Ovuncp.s. I took the table to Excel, created three rows. I imported the Excel file into Mathematica, but this time I cannot convert it to the matrix form I am interested in. Answer
3 Replies
Sort By:
Posted 4 years ago
 Welcome to Wolfram Community! Please make sure you know the rules: https://wolfr.am/READ-1STThe rules explain how to format your code properly. If you do not format code, it may become corrupted and useless to other members. Please EDIT your posts and make sure code blocks start on a new paragraph and look framed and colored like this. int = Integrate[1/(x^3 - 1), x]; Map[Framed, int, Infinity]  Answer
Posted 4 years ago
 Ovunc,you can reference the x and y variables with a replace.Let's say you want the x value from the fifth result -- so take the second element from the fifth result (which is the list of x and y rules): x /. c1[[5, 2]] You can use this to restructure your results into a matrix: lookupTable = Map[{#[], x /. #[], y /. #[]} &, c1]; and look at it as a grid: Grid[lookupTable , Frame -> All] or export / use it.Regards Answer
Posted 4 years ago
 Amazing! Thank you so much! Answer