Re: How to express a Product (special case) in Mathematica?
- To: mathgroup at smc.vnet.net
- Subject: [mg59113] Re: [mg59094] How to express a Product (special case) in Mathematica?
- From: Adriano Pascoletti <pascolet at dimi.uniud.it>
- Date: Fri, 29 Jul 2005 00:41:50 -0400 (EDT)
- References: <200507280628.CAA12454@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
David,
if Ts = {-1, 0, 2, 3} is a list of t's
define a variable, say t, and get the main ingredients for building
the functions you want
In[2]:=
variable=t;
data={{variable,Ts[[#]]},Drop[Ts,{#}]}&/@Range[Length[Ts]]
Out[3]=
{{{t,-1},{0,2,3}},{{t,0},{-1,2,3}},{{t,2},{-1,0,3}},{{t,3},{-1,0,2}}}
define the functions
MapIndexed[(Ï?[#2ã??1ã?? -
1] = Function[Evaluate@variable,
Evaluate[#[[1]]/#[[2]] &[Times @@@
Outer[Plus, #[[1]], -#[[2]]]]]]) &, data];
here they are
In[5]:=
Ï?[2][y]//InputForm
Out[5]//InputForm=
-((-3 + y)*y*(1 + y))/6
Plot[Evaluate[Ï?[#][x] & /@
Range[0, Length[Ts] - 1]], {x, -2, 4}, GridLines -> Automatic];
Adriano Pascoletti
Il giorno 28 lug 2005, alle ore 08:28, vdavidster at gmail.com ha scritto:
> If you're familiar with the Lagrange interpolation polynomial, you'll
> know that the coefficient term, phi, is defined as follows:
>
> n
> phi_j (t) = TT (t - t_i)
> i=0 -----------
> i!=j (t_j - t_i)
>
> Or in LaTeX notation:
>
> \phi_j(t) = \prod^{n}_{\stackrel{i=0}{i \neq j}} \frac{(t - t_i)}{(t_j
> - t_i)}
>
> Or in graphical form:
> http://mathworld.wolfram.com/LagrangeInterpolatingPolynomial.html
>
> How do I do that in Mathematica?
> How do I specify a product that skips a value in its iterator, i?
> (i.e.
> i != j)
>
> Thanks!
>
> David
>
>
------------------------------------------------------------------------
--------
Adriano Pascoletti
Dipartimento di Matematica e Informatica
Universita' di Udine
Via delle scienze 206
I-33100 Udine
Italy
- References:
- How to express a Product (special case) in Mathematica?
- From: vdavidster@gmail.com
- How to express a Product (special case) in Mathematica?