RE: Complex Function Plot

*To*: mathgroup at smc.vnet.net*Subject*: [mg25575] RE: [mg25541] Complex Function Plot*From*: "David Park" <djmp at earthlink.net>*Date*: Sun, 8 Oct 2000 00:42:01 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

Roberto, Instead of doing an Interpolation which can be time consuming, why don't you just use a table and make a MultipleListPlot. The only disadvantage is that you lose the adaptive procedures of a normal Plot. Here is a routine that makes the plot and calculates f[t] only once at each point. Needs["Graphics`MultipleListPlot`"] ReImPlot[f_, {tmin_, tmax_, tinc_}, opts___?OptionQ] := Module[{fdata, fRe, fIm, t}, fdata = Transpose[Table[{t, Re[#], Im[#]} &[f[t]], {t, tmin, tmax, tinc}]]; fRe = Transpose[Take[fdata, {1, 2}]]; fIm = Transpose[Drop[fdata, {2}]]; MultipleListPlot[fRe, fIm, opts, PlotJoined -> True, SymbolShape -> None, PlotStyle -> {Hue[.7], Hue[.9]}] ] f[t_] := BesselK[3, I t] ReImPlot[f, {0.01, 20, 20/100}]; David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ > -----Original Message----- > From: Roberto Brambilla [mailto:rlbrambilla at cesi.it] To: mathgroup at smc.vnet.net > Hi, dear MG-friends > > I have often to plot the real and the imaginary part > of a complex valued function of a real variable : f(t). > The obvious solution is > > Plot[{f[t]//Re,f[t]//Im},{t,t1,t2}, > PlotStyle->{Hue[.7],Hue[.9]}] > > and the function is evaluated two times for each value of t. > In the case of a long-time-eating function (as in the case > of series expansions with hypergeometric f.,integrals with > parameters,etc) it would be suitable a trick to evaluate > f[t] only once. > I'd like also to avoid to use interpolation like > > p=Table[f[t1+k(t2-t1)k/n],{k,0,n}]; > fr=Interpolation[p//Re,InterpolationOrder->mr]; > fi=Interpolation[p//Im,InterpolationOrder->mi]; > Plot[{fr[t],fi[t]},{t,t1,t2}, > PlotStyle->{Hue[.7],Hue[.9]}] > > since it requires the optimum choice of n, mr and mi > for each (t1,t2) interval, especially if the two parts > oscillate with very different periods. > > I use Math. version 3.0 . > Any suggestion will be greatly appreciated. > Bye, Rob > > Roberto Brambilla > CESI > Via Rubattino 54 > 20134 Milano > tel +39.2.2125.5875 > fax +39.2.2125.610 > rlbrambilla at cesi.it > >