I have some predefined function F[x], where x can be a 2D vector. I am doing the following:

lambda = 0.5
x = Array[s, 2]
NMinimize[{F[x] + lambda (x.x)}, x]

This only gives me the value for one particular value of lambda. I want to form a plot where the x-axis is lambda (ranging from 0 to 5) and the y-axis is some real-valued function of the vector I get from NMinimize (say, the first coordinate divided by the second coordinate). How can I do this?

  • $\begingroup$ Can you adapt this? x = Array[s, 2]; F[x_]:=Norm[x]; Table[{lambda,s[1],s[2]} /.NMinimize[{F[x] + lambda (x.x)}, x][[2]],{lambda,0,5,.5}] When that is working you can change the s[1],s[2] to s[1]/s[2] and you can wrap a ListPlot around the Table to see what your plot looks like. $\endgroup$ – Bill May 10 at 7:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.