       Plot several graphs generated by Table

• To: mathgroup at smc.vnet.net
• Subject: [mg36424] Plot several graphs generated by Table
• From: muhnochwaaa at yahoo.com (muh nochwaaa)
• Date: Fri, 6 Sep 2002 03:16:55 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```myArray is a list of triplets which look like {n,k,p}, where n and k
are integers  and p is real number. repetitions in n and k are allowed
but no two triplets ar the same.

I define a function, myfunc[n_,pthreshold_] as follows.

myfunc[n_,pthreshold_] := Module[{t},
t=Max[Cases[myArray, {n, k_, p_} /; (p >= pthreshold) -> p, 2]];
If[t>=0,t,-1]]

It prints the largest k for which p is greater than pthreshold for a
given n and
-1 if there is no such k.  The function does its job fine.

My problem is as follows. I would like to plot a collection of plots,
myfunc[n,p], for 1<=n<=21 with respect to p. unfortunately the
following does not work as desired.

Plot[Table[myfunc[n,p],{n,1,21}],{p,0.0,1.0}]

because the Table gets evaluated to numeric value (-1) before Plot is
invoked.
How could I accomplish this? Thanks in advance for all your helps.

```

• Prev by Date: Re: Running Mathematica in background.
• Next by Date: ListIntegrate Info.
• Previous by thread: Re: Plotting The Slope field of a differential equation
• Next by thread: Re: Plot several graphs generated by Table