Hold, HoldForm, ReleaseHold when Plotting multiple functions

• To: mathgroup at smc.vnet.net
• Subject: [mg25481] Hold, HoldForm, ReleaseHold when Plotting multiple functions
• From: Ross Sean Civ AFRL/DELO <Sean.Ross at kirtland.af.mil>
• Date: Mon, 2 Oct 2000 22:26:59 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```I wrote a function called bandwidth and want to print out a number of these
functions on the same graph.  Here is an example:
In[1]:=

Plot[{bandwidth[28.5,x],
bandwidth[28.7,x],
bandwidth[28.9,x],
bandwidth[29.1,x],
bandwidth[29.3,x],
bandwidth[29.5,x],
bandwidth[29.7,x],
bandwidth[29.9,x]},{x,140,200},
PlotRange->{-5,5},PlotStyle->Array[Hue[#/9.]&,9]]

Now, I personally think that listing out all those functions is a little
clumsy.  I would rather put some kind of a Map statement as the argument to
Plot.  Here is one that does the trick:
In[2]:=
Map[HoldForm[bandwidth[#,x]]&,{28.5,28.7,28.9,29.1,29.3,29.5,29.7,29.9}]

However, using this code as the argument to Plot generates a lot of error
messages and, ultimately, doesn't work.  I know that the solution has
something to do with Hold, HoldForm, ReleaseHold, Evaluate etc., but I have
never been able to figure out what these things do or figure out which
combination will work.

Here are some combinations I have tried that kind of work:
In[3]:=
Plot[Evaluate[ReleaseHold[Map[HoldForm[bandwidth[#,x]]&,{28.5,28.7,28.9,29.1
,29.3,29.5,29.7,29.9}]]],{x,140,200},
PlotRange->{-5,5},PlotStyle->Array[Hue[#/9.]&,9]]
In[4]:=
Plot[Evaluate[ReleaseHold[Map[Hold[bandwidth[#,x]]&,{28.5,28.7,28.9,29.1,29.
3,29.5,29.7,29.9}]]],{x,140,200},
PlotRange->{-5,5},PlotStyle->Array[Hue[#/9.]&,9]]

In[3] and In[4] generate lots of error messages and take a long time, but
print out the multiple graph.  I have tried other combinations that don't
work at all.

I would greatly appreciate it if someone could tell me

1) what magic combination of Holds and Releases etc. would generate a
multiple plot in the same time as the explicit version of In[1] and without
generating error messages.  (Please don't refer me to other packages or
other kinds of solutions or approaches like MultipleListPlot or Show.  I
want to understand Holds and this is a good case in point.)
2) how I could have figured out what that magic combination was before hand
by reading the Mathematica Book or something on the Wolfram web site.

Please respond directly to Sean.Ross at kirtland.af.mil as I no longer
subscribe to the mathgroup.

Dr. Sean Ross

AFRL/DELO
3550 Aberdeen Ave. Building 761
Kirtland AFB, NM 87117

Office:    (505) 846-9148
Labs:      (505) 853-6440/846-9289
Fax:        (505) 853-0485
Email:     sean.ross at kirtland.af.mil

```

• Prev by Date: FullSimplify tricks
• Next by Date: Re: Summary: List element manipulation
• Previous by thread: FullSimplify tricks
• Next by thread: Re: Hold, HoldForm, ReleaseHold when Plotting multiple functions