Hi Mohsen,
Your code is a bit unusual as it does not use the Indexed part of MapIndexed:
order = 5
toc = {{-0.5, 0}, {-0.3, 0}, {-0.1, 0}, {0.1, 0}, {0.3, 0}, {0.5, 0}}
xp = Map[InterpolatingPolynomial[ReplacePart[toc, 1, {#, 2}], x] &, Range[2, order]]
gives the same output. So I will work from there. Map basically 'fills' the # with the values given: Range[2,order] ({2,3,4,5})
:
{InterpolatingPolynomial[ReplacePart[toc,1,{2,2}],x],
InterpolatingPolynomial[ReplacePart[toc,1,{3,2}],x],
InterpolatingPolynomial[ReplacePart[toc,1,{4,2}],x],
InterpolatingPolynomial[ReplacePart[toc,1,{5,2}],x]}
which takes toc and replaces the {2,2}, {3,2},{4,2} {5,2}
element with a 1:
{
ReplacePart[toc, 1, {2, 2}],
ReplacePart[toc, 1, {3, 2}],
ReplacePart[toc, 1, {4, 2}],
ReplacePart[toc, 1, {5, 2}]
}
{
{{-0.5,0},{-0.3,1},{-0.1,0},{0.1,0},{0.3,0},{0.5,0}},
{{-0.5,0},{-0.3,0},{-0.1,1},{0.1,0},{0.3,0},{0.5,0}},
{{-0.5,0},{-0.3,0},{-0.1,0},{0.1,1},{0.3,0},{0.5,0}},
{{-0.5,0},{-0.3,0},{-0.1,0},{0.1,0},{0.3,1},{0.5,0}}
}
Now it creates InterpolatingPolynomials with variable x for each....