MathGroup Archive 2002

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

Search the Archive

Re: function composition

  • To: mathgroup at smc.vnet.net
  • Subject: [mg38188] Re: function composition
  • From: "Francois Bernard Lauze" <francoisNO at SPAMit-c.dk>
  • Date: Thu, 5 Dec 2002 03:29:18 -0500 (EST)
  • Organization: UNI-C
  • References: <200211281907.OAA23956@smc.vnet.net> <ashulb$ejn$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

"Tomas Garza" <tgarza01 at prodigy.net.mx> wrote in message
news:ashulb$ejn$1 at smc.vnet.net...
> Your first problem I don't understand. As for the second, this may give
you
> a taste of Mathematica's powers:
>
> In[1]:=
> <<DiscreteMath`Combinatorica`
>
> In[2]:=
> KSubsets[{a, b, c}, 2] /. {x_, y_} -> {x -> 0, y -> 0}
> Out[2]=
> {{a -> 0, b -> 0}, {a -> 0, c -> 0}, {b -> 0, c -> 0}}
>

Thanks for your answers!
I find the KSubset beautiful!

I realize that I was really too imprecise for the first problem. What i
really want to do is to define some finite differences operators to get
semi-implicit discretizations of some PDE's.
And for the composition pattern, it's meant to avoid involving points
too far away when differentiating twice with respect with the same
variable. So what I did was to define an explicit differentiation formula
for that case and set, as indicated by the first answer, the HoldFirst
attribute to my central difference operator.

The problem with lists was in fact for extracting the coefficients
of the discretization - the stencil. All in all it now works, and
my code generates C routines.
Each stencil is a 3x3x3 array, and to parse it, I must admit I
use 3 ugly imbricated For[] loops, and that's a bit annoying,
for I may soon have to deal with lower or higer dimensional
data. I came with one possible solution that was to flatten these
arrays and to have the parsing function capable of computing
the corrects indices in the original array when processing the
flattened version. But it's pretty messy at that point. Any
suggestions, or should I just spend more time reading the
Mathematica book ;-)?


Francois
--
Francois Lauze
The IT University of Copenhagen, Glentevej 67
2400 Kbh NV, Denmark
Tel (45) 38 16 89 29






  • Prev by Date: TriangularSurfacePlot question
  • Next by Date: Re: Efficient Sorting Algorithm [2]
  • Previous by thread: Re: function composition
  • Next by thread: RE: Drawing and Filling closed objects of arbitrary shape?