MathGroup Archive 2004

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

Search the Archive

one liner for a function?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg45959] one liner for a function?
  • From: sean_incali at yahoo.com (sean kim)
  • Date: Fri, 30 Jan 2004 04:17:25 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

I have been asking questions for three straight night in a row... 

I appreciate all the replies. 

I have another couple of questions tonight. 

1. let's say you have to make GraphicsArray using the interpolating
functions.
I have managed to write a function that automates the plotting part,
but i haven't been able to write one that will automate plotting and
naming the plot object and showing in a graphics array.

as an example, 

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]];

pfunc[name_]:= Plot[Evaluate[{name[t]/. sol}, {t, 0, 250}],
PlotRange-> All, DisplayFunction -> Identity, PlotLabel -> name];

pa = pfunc[a];
pb = pfunc[b];
px = pfunc[x];
py = pfunc[y];

Show[GraphicsArray [{{pa, pb}, {px, py}}], ImageSize-> 500]


funtion I wrote called "pfunc" does fine, but i was wondering is there
a way to automate the

pa = pfunc[a]; ... py = pfunc[y];
  
and 

Show[GraphicsArray [{{pa, pb}, {px, py}}], ImageSize-> 500] 

part also?  

I can't seem to figure out a way to take the output of function to
make another function.. and that seems to me what i have to do.. ( i
don't even know that make sense to you guys...)


2. once you have everythign in function form, can you write it in one
liner format? ( perhaps with some explanations? )

as always any and all thoughts and replies are thoroughly appreciated.

thanks all in advance. 

sean


  • Prev by Date: Re: Mathematica and XML
  • Next by Date: Re: populating a list from system of odes
  • Previous by thread: Re: Simplifying a second order eq. system
  • Next by thread: Re: one liner for a function?