login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for SandBoxExpOfEnd revision 5 of 18

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
Editor: Bill Page
Time: 2014/09/19 19:23:25 GMT+0
Note:

added:
Choose n items from a list. Returns list of size binomial(#a,n) of lists.

added:
1.3 The Main Result

removed:
---f(i,j)==reduce(+,map((x:List Expression Integer):Expression Integer +-> reduce(*,x,1),choose([r[q] for q in 1..n|q~=j],n-i-1)))

changed:
-f(i,j)==sum [ product x for x in choose([r[q]::Expression Integer for q in 1..n|q~=j],n-i-1)]
-- 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)]
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])
\end{axiom}

Polynomial of degree 2
\begin{axiom}

changed:
-f(0,1)
-f(0,2)
-f(1,1)
-f(1,2)
eq2_3a:= g[0]=groupPolyCoeff(0)
eq2_3b:= g[1]=groupPolyCoeff(1)
\end{axiom}
Polynomial of degree 3
\begin{axiom}

changed:
-f(0,1)
-f(0,2)
-f(0,3)
-f(1,1)
-f(1,2)
-f(1,3)
-f(2,1)
-f(2,2)
-f(2,3)
-reduce(+,[exp(r[j])/reduce(*,[r[j]-r[m] for m in 1..3 | j~=m]) for j in 1..3])
eq3_3a:= g[0]=groupPolyCoeff(0)
factor(numer rhs %)/factor(denom rhs %)
eq3_3b:= g[1]=groupPolyCoeff(1)
factor(numer rhs %)/factor(denom rhs %)
eq3_3c:= g[2]=groupPolyCoeff(2)
factor(numer rhs %)/factor(denom rhs %)

changed:
-one
Polynomial of degree 4
\begin{axiom}
n:=4
eq4_2:= g[0]=groupPolyCoeff(0)
eq4_3:= g[1]=groupPolyCoeff(1)
eq4_4:= g[2]=groupPolyCoeff(2)
eq4_5:= g[3]=groupPolyCoeff(3)
\end{axiom}

Old

Choose n items from a list. Returns list of size binomial(#a,n) of lists.

fricas
choose(a,n) ==
  j:=[i for i in 1..n]
  r:=[[a(j(i)) for i in 1..n]]
  k:=n
  while k>0 and j(k)+n-k<#a repeat
    j(k):=j(k)+1
    for i in k..n-1 repeat j(i+1):=j(i)+1
    r:=concat(r,[a(j(i)) for i in 1..n])
    k:=n; while j(k)+n-k>=#a and k>1 repeat k:=k-1
  if binomial(#a,n)~=#r then error "error in choose"
  return r
Type: Void

  1. 3 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

\label{eq1}2(1)
Type: PositiveInteger?
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)

\label{eq2}{g_{0}}={{-{{r_{1}}\ {{e}^{r_{2}}}}+{{r_{2}}\ {{e}^{r_{1}}}}}\over{{r_{2}}-{r_{1}}}}(2)
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)

\label{eq3}{g_{1}}={{{{e}^{r_{2}}}-{{e}^{r_{1}}}}\over{{r_{2}}-{r_{1}}}}(3)
Type: Equation(Expression(Integer))

Polynomial of degree 3

fricas
n:=3

\label{eq4}3(4)
Type: PositiveInteger?
fricas
eq3_3a:= g[0]=groupPolyCoeff(0)

\label{eq5}\begin{array}{@{}l}
\displaystyle
{g_{0}}={{\left(
\begin{array}{@{}l}
\displaystyle
{{\left({{r_{1}}\ {{r_{2}}^{2}}}-{{{r_{1}}^{2}}\ {r_{2}}}\right)}\ {{e}^{r_{3}}}}+ 
\
\
\displaystyle
{{\left(-{{r_{1}}\ {{r_{3}}^{2}}}+{{{r_{1}}^{2}}\ {r_{3}}}\right)}\ {{e}^{r_{2}}}}+ 
\
\
\displaystyle
{{\left({{r_{2}}\ {{r_{3}}^{2}}}-{{{r_{2}}^{2}}\ {r_{3}}}\right)}\ {{e}^{r_{1}}}}
(5)
Type: Equation(Expression(Integer))
fricas
factor(numer rhs %)/factor(denom rhs %)

\label{eq6}{\left(
\begin{array}{@{}l}
\displaystyle
{{\left({{r_{1}}\ {{r_{2}}^{2}}}-{{{r_{1}}^{2}}\ {r_{2}}}\right)}\ {{e}^{r_{3}}}}+{{\left(-{{r_{1}}\ {{r_{3}}^{2}}}+{{{r_{1}}^{2}}\ {r_{3}}}\right)}\ {{e}^{r_{2}}}}+ 
\
\
\displaystyle
{{\left({{r_{2}}\ {{r_{3}}^{2}}}-{{{r_{2}}^{2}}\ {r_{3}}}\right)}\ {{e}^{r_{1}}}}
(6)
Type: Fraction(Factored(SparseMultivariatePolynomial?(Integer,Kernel(Expression(Integer)))))
fricas
eq3_3b:= g[1]=groupPolyCoeff(1)

\label{eq7}{g_{1}}={{{{\left(-{{r_{2}}^{2}}+{{r_{1}}^{2}}\right)}\ {{e}^{r_{3}}}}+{{\left({{r_{3}}^{2}}-{{r_{1}}^{2}}\right)}\ {{e}^{r_{2}}}}+{{\left(-{{r_{3}}^{2}}+{{r_{2}}^{2}}\right)}\ {{e}^{r_{1}}}}}\over{{{\left({r_{2}}-{r_{1}}\right)}\ {{r_{3}}^{2}}}+{{\left(-{{r_{2}}^{2}}+{{r_{1}}^{2}}\right)}\ {r_{3}}}+{{r_{1}}\ {{r_{2}}^{2}}}-{{{r_{1}}^{2}}\ {r_{2}}}}}(7)
Type: Equation(Expression(Integer))
fricas
factor(numer rhs %)/factor(denom rhs %)

\label{eq8}-{{{{\left({{r_{2}}^{2}}-{{r_{1}}^{2}}\right)}\ {{e}^{r_{3}}}}+{{\left(-{{r_{3}}^{2}}+{{r_{1}}^{2}}\right)}\ {{e}^{r_{2}}}}+{{\left({{r_{3}}^{2}}-{{r_{2}}^{2}}\right)}\ {{e}^{r_{1}}}}}\over{{\left({r_{2}}-{r_{1}}\right)}\ {\left({r_{3}}-{r_{2}}\right)}\ {\left({r_{3}}-{r_{1}}\right)}}}(8)
Type: Fraction(Factored(SparseMultivariatePolynomial?(Integer,Kernel(Expression(Integer)))))
fricas
eq3_3c:= g[2]=groupPolyCoeff(2)

\label{eq9}{g_{2}}={{{{\left({r_{2}}-{r_{1}}\right)}\ {{e}^{r_{3}}}}+{{\left(-{r_{3}}+{r_{1}}\right)}\ {{e}^{r_{2}}}}+{{\left({r_{3}}-{r_{2}}\right)}\ {{e}^{r_{1}}}}}\over{{{\left({r_{2}}-{r_{1}}\right)}\ {{r_{3}}^{2}}}+{{\left(-{{r_{2}}^{2}}+{{r_{1}}^{2}}\right)}\ {r_{3}}}+{{r_{1}}\ {{r_{2}}^{2}}}-{{{r_{1}}^{2}}\ {r_{2}}}}}(9)
Type: Equation(Expression(Integer))
fricas
factor(numer rhs %)/factor(denom rhs %)

\label{eq10}{{{\left({r_{2}}-{r_{1}}\right)}\ {{e}^{r_{3}}}}+{{\left(-{r_{3}}+{r_{1}}\right)}\ {{e}^{r_{2}}}}+{{\left({r_{3}}-{r_{2}}\right)}\ {{e}^{r_{1}}}}}\over{{\left({r_{2}}-{r_{1}}\right)}\ {\left({r_{3}}-{r_{2}}\right)}\ {\left({r_{3}}-{r_{1}}\right)}}(10)
Type: Fraction(Factored(SparseMultivariatePolynomial?(Integer,Kernel(Expression(Integer)))))

Polynomial of degree 4

fricas
n:=4

\label{eq11}4(11)
Type: PositiveInteger?
fricas
eq4_2:= g[0]=groupPolyCoeff(0)

\label{eq12}\begin{array}{@{}l}
\displaystyle
{g_{0}}={{\left(
\begin{array}{@{}l}
\displaystyle
{{\left({
\begin{array}{@{}l}
\displaystyle
{{\left(-{{r_{1}}\ {{r_{2}}^{2}}}+{{{r_{1}}^{2}}\ {r_{2}}}\right)}\ {{r_{3}}^{3}}}+ 
\
\
\displaystyle
{{\left({{r_{1}}\ {{r_{2}}^{3}}}-{{{r_{1}}^{3}}\ {r_{2}}}\right)}\ {{r_{3}}^{2}}}+ 
\
\
\displaystyle
{{\left(-{{{r_{1}}^{2}}\ {{r_{2}}^{3}}}+{{{r_{1}}^{3}}\ {{r_{2}}^{2}}}\right)}\ {r_{3}}}
(12)
Type: Equation(Expression(Integer))
fricas
eq4_3:= g[1]=groupPolyCoeff(1)

\label{eq13}\begin{array}{@{}l}
\displaystyle
{g_{1}}={{\left(
\begin{array}{@{}l}
\displaystyle
{{\left({
\begin{array}{@{}l}
\displaystyle
{{\left({{r_{2}}^{2}}-{{r_{1}}^{2}}\right)}\ {{r_{3}}^{3}}}+ \
\
\displaystyle
{{\left(-{{r_{2}}^{3}}+{{r_{1}}^{3}}\right)}\ {{r_{3}}^{2}}}+{{{r_{1}}^{2}}\ {{r_{2}}^{3}}}- 
\
\
\displaystyle
{{{r_{1}}^{3}}\ {{r_{2}}^{2}}}
(13)
Type: Equation(Expression(Integer))
fricas
eq4_4:= g[2]=groupPolyCoeff(2)

\label{eq14}\begin{array}{@{}l}
\displaystyle
{g_{2}}={{\left(
\begin{array}{@{}l}
\displaystyle
{{\left({
\begin{array}{@{}l}
\displaystyle
{{\left(-{r_{2}}+{r_{1}}\right)}\ {{r_{3}}^{3}}}+{{\left({{r_{2}}^{3}}-{{r_{1}}^{3}}\right)}\ {r_{3}}}- 
\
\
\displaystyle
{{r_{1}}\ {{r_{2}}^{3}}}+{{{r_{1}}^{3}}\ {r_{2}}}
(14)
Type: Equation(Expression(Integer))
fricas
eq4_5:= g[3]=groupPolyCoeff(3)

\label{eq15}\begin{array}{@{}l}
\displaystyle
{g_{3}}={{\left(
\begin{array}{@{}l}
\displaystyle
{{\left({
\begin{array}{@{}l}
\displaystyle
{{\left({r_{2}}-{r_{1}}\right)}\ {{r_{3}}^{2}}}+{{\left(-{{r_{2}}^{2}}+{{r_{1}}^{2}}\right)}\ {r_{3}}}+ 
\
\
\displaystyle
{{r_{1}}\ {{r_{2}}^{2}}}-{{{r_{1}}^{2}}\ {r_{2}}}
(15)
Type: Equation(Expression(Integer))

Old

fricas
eq42 := _
  -r2*r3*r4*exp(r1)/((r1-r2)*(r1-r3)*(r1-r4)) + _
  -r1*r3*r4*exp(r2)/((r2-r1)*(r2-r3)*(r2-r4)) + _
  -r1*r2*r4*exp(r3)/((r3-r1)*(r3-r2)*(r3-r4)) + _
  -r1*r2*r3*exp(r4)/((r4-r1)*(r4-r2)*(r4-r3))

\label{eq16}{\left(
\begin{array}{@{}l}
\displaystyle
{{\left({
\begin{array}{@{}l}
\displaystyle
{{\left(-{r 1 \ {{r 2}^{2}}}+{{{r 1}^{2}}\  r 2}\right)}\ {{r 3}^{3}}}+ 
\
\
\displaystyle
{{\left({r 1 \ {{r 2}^{3}}}-{{{r 1}^{3}}\  r 2}\right)}\ {{r 3}^{2}}}+ 
\
\
\displaystyle
{{\left(-{{{r 1}^{2}}\ {{r 2}^{3}}}+{{{r 1}^{3}}\ {{r 2}^{2}}}\right)}\  r 3}
(16)
Type: Expression(Integer)

three

fricas
htrigs eval(eq42, [r3=-r1,r4=-r2])

\label{eq17}{-{{{r 1}^{2}}\ {\cosh \left({r 2}\right)}}+{{{r 2}^{2}}\ {\cosh \left({r 1}\right)}}}\over{{{r 2}^{2}}-{{r 1}^{2}}}(17)
Type: Expression(Integer)
fricas
htrigs limit(%,r2=r1)

\label{eq18}{-{r 1 \ {\sinh \left({r 1}\right)}}+{2 \ {\cosh \left({r 1}\right)}}}\over 2(18)
Type: Expression(Integer)

fricas
eq43 :=
  (r2*r3 + r3*r4 + r4*r2)*exp(r1)/((r1-r2)*(r1-r3)*(r1-r4)) + _
  (r1*r3 + r3*r4 + r4*r1)*exp(r2)/((r2-r1)*(r2-r3)*(r2-r4)) + _
  (r1*r2 + r2*r4 + r4*r1)*exp(r3)/((r3-r1)*(r3-r2)*(r3-r4)) + _
  (r1*r2 + r2*r3 + r3*r1)*exp(r4)/((r4-r1)*(r4-r2)*(r4-r3))

\label{eq19}{\left(
\begin{array}{@{}l}
\displaystyle
{{\left({
\begin{array}{@{}l}
\displaystyle
{{\left({{r 2}^{2}}-{{r 1}^{2}}\right)}\ {{r 3}^{3}}}+{{\left(-{{r 2}^{3}}+{{r 1}^{3}}\right)}\ {{r 3}^{2}}}+ 
\
\
\displaystyle
{{{r 1}^{2}}\ {{r 2}^{3}}}-{{{r 1}^{3}}\ {{r 2}^{2}}}
(19)
Type: Expression(Integer)

fricas
htrigs eval(eq43, [r3=-r1,r4=-r2])

\label{eq20}{-{{{r 1}^{3}}\ {\sinh \left({r 2}\right)}}+{{{r 2}^{3}}\ {\sinh \left({r 1}\right)}}}\over{{r 1 \ {{r 2}^{3}}}-{{{r 1}^{3}}\  r 2}}(20)
Type: Expression(Integer)
fricas
htrigs limit(%,r2=r1)

\label{eq21}{{3 \ {\sinh \left({r 1}\right)}}-{r 1 \ {\cosh \left({r 1}\right)}}}\over{2 \  r 1}(21)
Type: Expression(Integer)