MathGroup Archive 2008

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

Search the Archive

Empirical othogonal functions and pure functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg84818] Empirical othogonal functions and pure functions
  • From: mante <claude.mante at univmed.fr>
  • Date: Tue, 15 Jan 2008 03:22:33 -0500 (EST)

Hello!

       I need to othogonalize polynomials relatively to a fixed sampling 
mesh {x1,  ............., xp}, ie. to the *discrete* scalar product :
<P,Q>=Sum[P(xi) Q(xi),{i,p}].
This scalar product corresponds to the function :
EmpirScal[f_, g_, X_] :=   Dot[Table[f[X[[i]]], {i, Length@X}],  
Table[g[X[[i]]], {i, Length@X}]];

Let's try with
rr = Table[x^i, {i, 0, 2}]
using first the "canonical" orthogonalization procedure  :
Orthogonalize[rr, Integrate[#1*#2, {x, -1, 1}] & ]
->{1/Sqrt[2], Sqrt[3/2]*x, (3/2)*Sqrt[5/2]*(-(1/3) + x^2)}
Fine!

Now, putting for instance  X = Range[3] we can note that :
Orthogonalize[rr, EmpirScal[#1, #2, X] & ]
does not work, because EmpirScal doesn't works itself :
In[94]:= EmpirScal[rr[[2]], rr[[3]]]
Out[94]= x[1]*(x^2)[1] + x[2]*(x^2)[2] + x[3]*(x^2)[3] +  x[4]*(x^2)[4] 
+   x[5]*(x^2)[5]

It seems that in this case x^k is not interpreted as a function, but as 
the name of some function ; I don't understand why.

So, I tried to work with pure functions, superseding rr by tt :

In[53]:= tt = Table[Function[x, x^i], {i, 0, 2}]
Out[53]= {Function[x, x^i], Function[x, x^i], Function[x, x^i]}
This is not what I expected...

Then, I used an old module of mine, converting a polynomiak to a pure 
function :

PolyToPure[pp_] := Module[{x, cc, pol, degre},
   pol = Expand[pp];
    x = First@Variables[N@pol];
   degre = Check[Exponent[pol, x], 0];
   cc = If[degre > 0, CoefficientList[pol, x], {pol}];
   Function[x,
    Apply[Plus,
     Prepend[Table[cc[[i]] x^(i - 1), {i, 2, Length[cc]}], cc[[1]]]]]
   ];

In[122]:= PolyToPure[(1 - x)^3][z]
Out[122]= 1 - 3 z + 3 z^2 - z^3

Now, we can compute scalar products :

In[7]:= rr = Table[x^i, {i, 0, 2}]
ss = Map[PolyToPure, rr];
EmpirScal[ss[[2]], ss[[3]], X]

Out[7]= {1, x, x^2}
Out[9]= 36


But the final result is again unusable :

In[48]:= res = Orthogonalize[ss, EmpirScal[#1, #2, X] & ];
res[[1]]

Out[49]= (1/Sqrt[3])Function[x$,  Plus @@ Prepend[ Table[cc$894[[i]] 
x$^(i - 1), {i, 2, Length[cc$894]}],
   cc$894[[1]]]]

                         Could you enlighten me?

       Thanks,
                Claude Manté



  • Prev by Date: Fill between points in ListPointPlot3D not working?
  • Next by Date: Re: how restore version 5.2 graphics in 6
  • Previous by thread: Re: Fill between points in ListPointPlot3D not working?
  • Next by thread: Re: Empirical othogonal functions and pure functions