# How to Manipulate a ListLinePlot[Transpose[{T,B}]] if T is a Table and B is a list of minima built by using FindMinimum?

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!

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

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},
Manipulate[
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}
]
]


• 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! May 13, 2014 at 15:31