| Author |
Comment/Response |
Mark
|
08/30/09 00:56am
In a program I am writing, I need to define a particular function that can be used as input in the NArgMax function.
Basically, my program is in two parts.
The first part solves a system of equations, and gives the general answer, as a function of a couple of parameters.
The second part of the program takes that answer, and finds the ArgMax (the argument being one the parameters from part 1) of a new objective function with 1 new parameter that was not present in part 1.
Basically, I need a quick way to use the symbolic solution from part 1 as an argument of the NArgMax function in part 2.
I am not able to just nest the Solve function from part 1 in the NArgMax function in part 2.
Basically, what I have tried so far is this ("p" and "h" are parameters in the first system of equations):
Part 1:
Solve[{system of equations},x][[1]][[1]][[2]]
Function[p_]:=Evaluate[%]
This part seems to work fine. When I enter
Definition[Function[p]][[1]], I get
-(3p+ 5h)/ph
The text on the above line works perfectly if I enter it into the NArgMax function of the second part of my program, but I need to run this over and over again using different systems of equations in part 1.
Is there any way that I can get the NArgMax function to interpret "Function" as the text returned by the Definition function? In other words, can I have NArgMax symbolically interpret "Function" as its definition, and not as 1 particular value?
Apologies if any of this doesn't make sense.
Thanks in advance
URL: , |
|