Re: How to express a Product (special case) in Mathematica?
- To: mathgroup at smc.vnet.net
- Subject: [mg59126] Re: [mg59094] How to express a Product (special case) in Mathematica?
- From: Pratik Desai <pdesai1 at umbc.edu>
- Date: Fri, 29 Jul 2005 00:42:21 -0400 (EDT)
- References: <200507280628.CAA12454@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
vdavidster at gmail.com wrote: >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 > > > Will this work? or for that matter is it correct ? :-) \!\(dat = {3, 5, 8, 13}\[IndentingNewLine] m = Length[dat]\[IndentingNewLine] f[x_] = Total[\(Table[\[Product]\+\(n = 1\)\%k\((dat[\([k]\)] - x)\)/\(\[Product]\+\(n = 1\)\%k\((dat[\([k]\)] - dat[\([\((k + 1)\)]\)])\)\), {k, 0, m - 1}] // Cancel\) // Simplify]\[IndentingNewLine] \) Best regards, Pratik PS: You can copy and paste the code in to Mathematica it works fine -- Pratik Desai Graduate Student UMBC Department of Mechanical Engineering Phone: 410 455 8134
- References:
- How to express a Product (special case) in Mathematica?
- From: vdavidster@gmail.com
- How to express a Product (special case) in Mathematica?