Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: clarification. Re: one liner for a function?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg45997] Re: clarification. Re: one liner for a function?
  • From: sean_incali at yahoo.com (sean kim)
  • Date: Mon, 2 Feb 2004 05:20:36 -0500 (EST)
  • References: <bvg11r$qn6$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

actually, after having looked at what bob hanlon and bobby treat has
written, it occured to me that they ARE doing what I have asked for...
which is reducing the step where I have to name the plots in order to
show in a graphics array.

(thus by reducing amt of typing i have to do. that was the main thing
for me.  to name each plot of each interpolating function when you
have liek 100 of them is kinda silly)

and they both have ways to include the names of the graphs in one or
array of plots.  I'm amazed.

this is why I was making the functions anyway. so this works for me. I
guess i'll dump he idea of making a function for plotting and calling
output of that function in another function naming them, then making a
function to show with labels.

thanks all. 




sean_incali at yahoo.com (sean kim) wrote in message news:<bvg11r$qn6$1 at smc.vnet.net>...
> Thanks Bob, for the helpful comments from past few days. I'm
> constantly amazed at you guys for being so helpful.
> 
> What I was trying to do in my last post was to make a function that
> uses another function to make commands that will make graphs.
> 
> i have a function called pfunc, 
> 
> pfunc[name_] := Plot[Evaluate[{name[t] /. sol}, {t, 0, 250}],
> PlotRange -> All, DisplayFunction -> Identity, PlotLabel -> name];
> 
> The new function has to take a list called var= {a[t], b[t], x[t],
> y[t]}
> and then generate two types of mathematica commands.
> 
> 1. write lines that applies pfunc to each of the elements,while giving
> that each name according to the variable name, ie.
> 
> pa = pfunc[a]; pb = pfunc[b]; px = pfunc[x]; py = pfunc[y];
> 
> 2. take those new names for the plots, then make a show GraphicArray
> commands with *two* column of plots, ie.
> 
> Show[GraphicsArray [{{pa, pb}, {px, py}}], ImageSize -> 500]
> 
> 
> this one below doesn't work with the following errors. 
> 
> Show::gtype: Symbol is not a type of graphics
> 
> In[22]:=
> sol= NDSolve[{a'[t]==-0.1  a[t] x[t], b'[t]==-0.05  b[t] y[t],
> x'[t]==-0.1  a[t] x[t]+0.05 b[t] y[t], y'[t]==0.1  a[t] x[t]-0.05 
> b[t] y[t], a[0]==1, b[0]==1, x[0]==1, y[0]==0},
> {a,b,x,y},{t,0,250}][[1]];
> 
> var = {a[t], b[t], x[t], y[t]};
> 
> (* a function to make (pa = pfunc[a]; pb = pfunc[b]; px = pfunc[x]; py
> = pfunc[y];)*)
> 
> plfunc[name_]:= StringJoin["p","name"]//ToExpression =
> Plot[Evaluate[{name/. sol}, {t, 0, 100}], PlotRange-> All,
> DisplayFunction-> Identity, PlotLabel-> name];
> 
> Apply[plfunc,Flatten[var]]
> 
> (* i can't figure out how to make a function for this one*)
> 
> Show[GraphicsArray [{{pa, pb}, {px, py}}], ImageSize-> 500]


  • Prev by Date: Re: clarification. Re: one liner for a function?
  • Next by Date: Re: Re: Nasty bug in Integrate (version 5.0)
  • Previous by thread: Re: clarification. Re: one liner for a function?
  • Next by thread: Re: clarification. Re: one liner for a function?