3 of 4 added 46 characters in body

# Define Dynamic Limit for ListPlot

Helly everybody,

I will try to keep this as simple as possible.

1. I have a function which looks like this:

Min[T_, E_, D_] := Module[ ..... List = {...} ];


In any case this function gives me a list that looks like this {1,2, 1, 4,5, 2,1} etc. (Actually D determines the number of entries in this list)

1. I use Listplot to plot this list.

ListPlot[Min[T, E, D], PlotRange -> {Automatic, {0,  0.5}}]

2. I use Manipulate to be able to manipulate any of these 3 Variables.

Manipulate[ListPlot[Min[...], {T, 1, 20}, {D, 10, 20}, {E, 1, 20}]


Everything worked perfectly and dandy, but I ran into one problem. E has a dynamic limit that changes when I change D or T and few other factors.

3. So in order to be able to calculate the dynamic limit ofE, I had to write a few new lines in the old Min.

So now it looks something like this:

Min[T_, E_, D_] :=
Module[Emax = T + D  + a; List = {...}];


where a is a variable only used in that function

Even though Emax is getting calculated correctly, I just cannot use it outside of the function.

When I plug it into the Manipulate stuff like this:

ListPlot[Min[...], {T, 1, 20}, {D, 10, 20}, {E, 1, Emax}]


the code does not know what Emax is.

Any ideas what I can do?

I need to use a variable from inside a function as limit for a Manipulate.

Thanks in advance for any help (:

 asked Aug 2 '18 at 13:20 Benjamin Jabl 9677 bronze badges