[Work with argument of Maximize?] - A New Kind of Science: The NKS Forum

A New Kind of Science: The NKS Forum

Pages:1



Work with argument of Maximize?

(Click here to view the original thread with full colors/images)



Posted by: serge

Hello, I have a following question. I would like to understand how I could work with the arguments of Maximize. Suppose that I maximize the following function

In[1]=Maximize[{x^2 + 2y, x^2 + y^2 ¡Ü 1}, {x, y}]

and get the answer.

Out[1]={2, {x -> 0, y -> 1}}

I would like to know if I could work further on with the new variable z=y=1 (in other words, I wonder if I could assign the value of argmaximum to (some) variable so that I could work with it)? E.G. I would like to calculate y+y, i.e. I want to use the output of Maximize in my further calculations. I would be grateful if smb told me the direction to take.

Thank you for your time.

Serge



Posted by: Richard Phillips

Serge,

You may get better answers at the MathGroup Forum for Mathematica use and programming:
http://forums.wolfram.com/mathgroup/

A forum for Student users exists too:
http://forums.wolfram.com/student-support/list/



You can assign the results to variables, as follows:

In[1] := {max, r} = Maximize[{x^2 + 2y, x^2 + y^2 <= 1}, {x, y}]
Out[1] = {2, {x -> 0, y -> 1}}

In[2] := max
Out[2] = 2

In[3] := r
Out[3] = {x->0, y->1}

Any expression containing x and y can then be calculated by using ReplaceAll (written /. ) as follows:

In[4]:= {x, y} /. r
Out[4] = {0, 1}

In[5]:= y + y /. r
Out[5] = 2

Does this help?





Forum Sponsored by Wolfram Research

© 2004-2008 Wolfram Research, Inc. | Powered by vBulletin 2.3.0 © 2000-2002 Jelsoft Enterprises, Ltd. | Disclaimer
vB Easy Archive Final - Created by Xenon and modified/released by SkuZZy from the Job Openings