Question: Question about product/ mul functions [mul(function(j), j=1..n, j<>i) is what I need, the j<>i doesnt work though]

Hi!

I am trying to determine the weights of a Gauß quadrature rule, the code I currently have is this:

 

for i from 1 to n do
  RekursivesZwischenergebnis:=1;
  for j from 1 to n do
    if i <> j then
      RekursivesZwischenergebnis:= RekursivesZwischenergebnis*((x-GaußKnoten[j])/(GaußKnoten[i]-GaußKnoten[j]))
    end if;
  end do;
  GaußGewichteAlt[i]:=int(RekursivesZwischenergebnis,x=-1..1);
end do;
 

The code works, is inefficient however. I want to use the product or mul function, however I dont know how to tell Maple not to multiply

((x-GaußKnoten[j])/(GaußKnoten[i]-GaußKnoten[j]))

if j=i.  mul(function(j), j=1..n,j<>i) doesnt work. Any efficient suggestions?

Please Wait...