MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: RE: Hold, HoldForm, ReleaseHold when Plotting multiple functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg25551] RE: [mg25494] RE: [mg25481] Hold, HoldForm, ReleaseHold when Plotting multiple functions
  • From: "David Park" <djmp at earthlink.net>
  • Date: Sat, 7 Oct 2000 03:35:55 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

The reason that the second form of your plot statement does not work is that
the bandwidth function calls a subsidiary routine which contains a FindRoot
statement. FindRoot balks at receiving symbolic input and generates an error
message. The Evaluate statement is needed to generate the list of functions
that you have in the first statement. But you do not want it to fully
evaluate until the plot routine starts to feed numbers to the routine. The
way to do this is simple. Define an interface routine which requires number
input, and hence will not immediately evaluate.

This follows the routine you posted in a separate notebook where you
actually plot the first item in a list returned by bandwidth.

plotbandwidth[p_, x_?NumberQ]:= First[bandwidth[p,x]]

Then the following generates no error messages because it doesn't yet try to
fully evaluate the routines because x is still symbolic.

plotbandwidth[#, x] & /@ {28.5, 28.7, 28.9, 29.1, 29.3, 29.5, 29.7, 29.9}
{plotbandwidth[28.5, x], plotbandwidth[28.7, x], plotbandwidth[28.9, x],
  plotbandwidth[29.1, x], plotbandwidth[29.3, x], plotbandwidth[29.5, x],
  plotbandwidth[29.7, x], plotbandwidth[29.9, x]}

So the following plot statement works smoothly without any error messages:

Plot[Evaluate[plotbandwidth[#,x]& /@
{28.5,28.7,28.9,29.1,29.3,29.5,29.7,29.9}],{x,140,200},
  PlotRange->{-5,5},
  TextStyle->FontSize->14,
  Prolog->Thickness[.006],
  PlotStyle->Array[Hue[#/9.]&,9],
  Frame->True,
  FrameLabel->{"Grating Temperature, °C","Pump acceptance bandwidth,
nm","PPLN bandwidth curves",None},ImageSize->500];

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/



> -----Original Message-----
> From: Ross Sean Civ AFRL/DELO [mailto:Sean.Ross at kirtland.af.mil]
To: mathgroup at smc.vnet.net

> Thank you for your response, but I had already tried a plain, old Evaluate
> and it is one of the forms that generates error messages, is
> slower than the
> explicit form, but eventually works.  This indicates that there is still
> some subtle difference between
>
> 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]]
>
> 		---and---
>
> Plot[Evaluate[Map[bandwidth[#,x]&,{28.5,28.7,28.9,29.1,29.3,29.5,2
> 9.7,29.9}]
> ],{x,140,200},
>    PlotRange->{-5,5},PlotStyle->Array[Hue[#/9.]&,9]]
>
>



  • Prev by Date: Re: ? D[f,{x,n}]
  • Next by Date: Re: Re:Mapping down two lists
  • Previous by thread: Re: Hold, HoldForm, ReleaseHold when Plotting multiple functions
  • Next by thread: Re: Re: Hold, HoldForm, ReleaseHold when Plotting multiple functions