Formating output of Modules
- To: mathgroup at smc.vnet.net
- Subject: [mg2214] Formating output of Modules
- From: sherod at boussinesq.Colorado.EDU (Scott Herod)
- Date: Mon, 16 Oct 1995 11:54:29 -0400
- Organization: University of Colorado at Boulder
I've got an annoying little problem that I was hoping someone can
help me solve. I have a Module, NDelaySolve, which returns a
numerical approximation of solutions to differential-delay equations.
In order to make the output look as much like that of NDSolve as
possible, I have the module return something like
{{x[t] -> g[t], y[t] -> f[t]}}
where g[t] and f[t] are often big Which[] functions. I would like
to reduce the output by creating a DelaySolveFunction[][t] which
looks something like an Interpolating function.
Here is an example:
In[4]:=
Format[spam[x_]] := 1/x;
In[8]:=
spam[a_] := Module[{},
pop = Table[a,{3}]
];
In[9]:=
spam[8]
Out[9]=
{8, 8, 8}
This Format isn't doing what I want. I would like spam[8] to return {8,8,8}
but to print the output as 1/8. If I get this one to work, I could solve
my real problem.
Scott Herod
sherod at newton.colorado.edu