Choose n items from a list. Returns list of size binomial(#a,n) of lists.
- The Main Result
fricas
sum(x)==reduce(+,x,0)
Type: Void
fricas
product(x)==reduce(*,x,1)
Type: Void
fricas
-- specify n
f(i,j) == sum [ product x for x in choose([r[q]::Expression Integer for q in 1..n|q~=j],n-i-1)]
Type: Void
fricas
groupPolyCoeff(i) == (-1)^(i+n+1)*reduce(+,[exp(r[j])/reduce(*,[r[j]-r[m] for m in 1..n | j~=m])*f(i,j) for j in 1..n])
Type: Void
- Polynomial of degree 2
fricas
n:=2
fricas
eq2_1:= m[X]=(x-r[1])*(x-r[2])
Type: Equation(Polynomial(Integer))
fricas
eq2_2:= exp(X)=g[0]*id+g[1]*X
Type: Equation(Expression(Integer))
fricas
eq2_3a:= g[0]=groupPolyCoeff(0)
fricas
Compiling function choose with type (List(Expression(Integer)),
Integer) -> List(List(Expression(Integer)))
fricas
Compiling function product with type List(Expression(Integer)) ->
Expression(Integer)
fricas
Compiling function sum with type List(Expression(Integer)) ->
Expression(Integer)
fricas
Compiling function f with type (NonNegativeInteger,PositiveInteger)
-> Expression(Integer)
fricas
Compiling function groupPolyCoeff with type NonNegativeInteger ->
Expression(Integer)
Type: Equation(Expression(Integer))
fricas
eq2_3b:= g[1]=groupPolyCoeff(1)
fricas
Compiling function f with type (PositiveInteger,PositiveInteger) ->
Expression(Integer)
fricas
Compiling function groupPolyCoeff with type PositiveInteger ->
Expression(Integer)
Type: Equation(Expression(Integer))
Example 2.1
fricas
eval(eq2_1,[r[2]=-r[1]])
Type: Equation(Polynomial(Integer))
fricas
eq2_4:= eval(eval(eq2_2,[eq2_3a,eq2_3b]),r[2]=-r[1])
Type: Equation(Expression(Integer))
fricas
htrigs rhs %
Type: Expression(Integer)
- Polynomial of degree 3
fricas
n:=3
fricas
eq3_1:= m[X]=(x-r[1])*(x-r[2])*(x-r[3])
Type: Equation(Polynomial(Integer))
fricas
eq3_2:= exp(X)=g[0]*id+g[1]*X+g[2]*X^2
Type: Equation(Expression(Integer))
fricas
eq3_3a:= g[0]=groupPolyCoeff(0)
Type: Equation(Expression(Integer))
fricas
eq3_3b:= g[1]=groupPolyCoeff(1)
Type: Equation(Expression(Integer))
fricas
eq3_3c:= g[2]=groupPolyCoeff(2)
Type: Equation(Expression(Integer))
Example 3.1
fricas
eval(eq3_1,[r[2]=-r[1],r[3]=0])
Type: Equation(Polynomial(Integer))
fricas
eq3_4:= eval(eval(eq3_2,[eq3_3a,eq3_3b,eq3_3c]),[r[2]=-r[1],r[3]=0])
Type: Equation(Expression(Integer))
fricas
htrigs rhs %
Type: Expression(Integer)
- Polynomial of degree 4
fricas
n:=4
fricas
eq4_1:= m[X]=(x-r[1])*(x-r[2])*(x-r[3])*(x-r[4])
Type: Equation(Polynomial(Integer))
fricas
eq4_2:= g[0]=groupPolyCoeff(0)
Type: Equation(Expression(Integer))
fricas
eq4_3:= g[1]=groupPolyCoeff(1)
Type: Equation(Expression(Integer))
fricas
eq4_4:= g[2]=groupPolyCoeff(2)
Type: Equation(Expression(Integer))
fricas
eq4_5:= g[3]=groupPolyCoeff(3)
Type: Equation(Expression(Integer))
-
fricas
eq5_1:=eval(eq4_1,[r[3]=-r[1],r[4]=-r[2]])
Type: Equation(Polynomial(Integer))
fricas
eq5_2:= exp(X)=g[0]*id+g[1]*X+g[2]*X^2+g[3]*X^3
Type: Equation(Expression(Integer))
fricas
eq5_3a:= eval(eq4_2,[r[3]=-r[1],r[4]=-r[2]])
Type: Equation(Expression(Integer))
fricas
htrigs rhs %
Type: Expression(Integer)
fricas
eq5_3b:= eval(eq4_3,[r[3]=-r[1],r[4]=-r[2]])
Type: Equation(Expression(Integer))
fricas
htrigs rhs %
Type: Expression(Integer)
fricas
eq5_3c:= eval(eq4_4,[r[3]=-r[1],r[4]=-r[2]])
Type: Equation(Expression(Integer))
fricas
htrigs rhs %
Type: Expression(Integer)
fricas
eq5_3d:= eval(eq4_5,[r[3]=-r[1],r[4]=-r[2]])
Type: Equation(Expression(Integer))
fricas
htrigs rhs %
Type: Expression(Integer)
fricas
eq5_4:= eval(eval(eq5_2,[eq4_2,eq4_3,eq4_4,eq4_5]),[r[3]=-r[1],r[4]=-r[2]])
Type: Equation(Expression(Integer))
fricas
htrigs rhs %
Type: Expression(Integer)