Message Boards Message Boards

0
|
4267 Views
|
8 Replies
|
2 Total Likes
View groups...
Share
Share this post:

i want to transfer function to programming by mma!!

Posted 11 years ago

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

enter image description here

POSTED BY: kevin kevin
8 Replies

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:

enter image description here

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

POSTED BY: Marco Thiel

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).

POSTED BY: Daniel Lichtblau

Ups, sorry. I believe I just did...

M.

POSTED BY: Marco Thiel

(That cracks me up..)

POSTED BY: Daniel Lichtblau

Some folks just can't help themselves... ;-)

POSTED BY: David Reiss
Posted 11 years ago

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

POSTED BY: kevin kevin
Posted 11 years ago

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

POSTED BY: kevin kevin

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

POSTED BY: Daniel Lichtblau
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract