I need to Manipulate a ListLinePlot using a parameter P. The problem is that this Curve is a ListLinePlot of a Transpose[{T,B}], in which T is a normal table and B is a list of minima got using FindMinimum in f[x]. This is a simplified code that contains my concern:

f[x_] := (b/a)*x^2 + (x^2/b)
Quiet[Xmin = Table[
   FindMinimum[{f[x], a >= 1, b >= 1}, {a, b}], {x, 250, 310, 20}]];

T = Table[T, {T, 250, 310, 20}];
B = b /. Take[Xmin, All, {2}] // Flatten;
Transpose[{T, B}];

ListLinePlot[Transpose[{T, B}]]

I'm able to plot this ListLinePlot as it is presented in the code but the idea is to insert a parameter P, multiplying the constant "a", inside of f[x] (P varies from 1 - 50).

When I just put this ListLinePlot correctly inside the Manipulate expression, setting P as a changeable parameter and also insert the parameter P, multiplying the constant "a", the routine is not able to output B and I get a list of errors. I really need B, so, is there any way to Manipulate it?

The Manipulate code that is not working is this:

Manipulate[ListLinePlot[Transpose[{T, B}]], {P, 1, 50}]

But with this Manipulate code above is evaluated only if I change "a" for "a*P" in the f[x].

Thanks a lot!

  • $\begingroup$ Please include the Manipulate code you are trying. $\endgroup$
    – Mr.Wizard
    May 13, 2014 at 13:23
  • $\begingroup$ I get FindMinimum::eit: The algorithm does not converge ... Don't you? $\endgroup$
    – Öskå
    May 13, 2014 at 13:23
  • $\begingroup$ If P multiplies just a, introducing the new parm will result in a new a.... which is the old one just divided by P .... $\endgroup$ May 13, 2014 at 13:25
  • $\begingroup$ @Öskå, Yes it gives an error message but in the end the ListLinePlot is accomplished. $\endgroup$
    – Roberto
    May 13, 2014 at 13:27
  • $\begingroup$ One usually doesn't like error messages.. :) $\endgroup$
    – Öskå
    May 13, 2014 at 13:30

1 Answer 1


This is very slow to update due to the repetitive use of FindMinimum but perhaps it is what you want:

DynamicModule[{f, Xmin, T, B, a, b},
  f[x_] := (b/(a*P))*x^2 + (x^2/b);
  Xmin = Quiet@Table[FindMinimum[{f[x], a >= 1, b >= 1}, {a, b}], {x, 250, 310, 20}];
  T = Range[250, 310, 20];
  B = b /. Take[Xmin, All, {2}] // Flatten;
  ListLinePlot[Transpose[{T, B}]],
  {P, 1, 50, 1},
  TrackedSymbols :> {P}

enter image description here

  • $\begingroup$ thanks so much! It was a really small version of my code. I have encapsulated everything in one manipulate but it is taking ages to evaluate. It works but it takes ages. Thanks again! $\endgroup$
    – Roberto
    May 13, 2014 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.