i want to transfer function to programming by mma!!

but i am user,i need help!!
can anyone help me to write this code?

Hi,

I do not know how to do that in an elegant way, but I noted that this

Product[i, {i, Complement[Range[1, 4], {3}]}]

is a way to exempt certain indices (in this case 3) from the product. In oder to evaluate the products we need to fix i. In my example Manipulate does that for us.

Manipulate[
 Product[Subscript[x, j] - Subscript[x, i], {j, 
    Complement[Range[1, 3], {i}]}]/
  Product[Subscript[x, i] - Subscript[x, k], {k, 
    Complement[Range[1, 3], {i}]}], {i, 1, 3, 1}]

You can also get the results for different i in form of a table:

Table[Product[
   Subscript[x, j] - Subscript[x, i], {j, 
    Complement[Range[1, 3], {i}]}]/
  Product[Subscript[x, i] - Subscript[x, k], {k, 
    Complement[Range[1, 3], {i}]}], {i, 1, 3}]

which results in:

ScreenShot2014-10-19at20.20.34.png

I am sure that there is a super-easy way of doing this, but in principle the functions above should do the trick.

Cheers,

Marco

What have you tried? (I don’t imagine anyone will just write up homework code unless there is some sign of effort on your part).

Ups, sorry. I believe I just did…

M.

(That cracks me up..)

Some folks just can’t help themselves… :wink:

hi, this is not homework obviously.i practice lagrange Polynomial but i have trouble , so i just post my question!!

sir ,you can take it easy,this is not my homework ,i write some finite elements method and i have problems,so i post it

Always best to show what you did when you post such a question.