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

Edit detail for SandBoxSinCosRules revision 1 of 2

1 2
Editor: Bill Page
Time: 2009/10/16 19:40:14 GMT-7
Note: split

changed:
-
Sin and Cos Rules

\begin{axiom}
x:=v1*sin(p1)+v2*sin(p2)
y:= a0 + a1*x + a2*x^2 + a3*x^3
sinCosProducts := rule
  sin(x)*sin(y) == (cos(x-y) - cos(x+y))/2
  cos(x)*cos(y) == (cos(x-y) + cos(x+y))/2
  sin(x)*cos(y) == (sin(x-y) + sin(x+y))/2
  sin(x)^2 == (1 - cos(2*x))/2
  sin(x)^3 == sin(x)*(1 - cos(2*x))/2

sinCosProducts(y)
\end{axiom}

Integration

\begin{axiom}
)clear completely
integrate(%e ^(-x*x), x=%minusInfinity..%plusInfinity)
\end{axiom}

\begin{axiom}
integrate(integrate(x+y, x),y)
\end{axiom}

\begin{axiom}
integrate(exp(-b*h*sin(o))*sin(o),o=0..2*%pi)
\end{axiom}

Gosper's algorithm is implemented in Axiom

\begin{axiom}
p:Polynomial Integer:=1+x+x^2
sum(p,x=0..n)
e:=binomial(2*k,k)/4^k
sum(e,k=0..n)
sum(%,n=0..n)
factor(4*n^2+8*n+3)
\end{axiom}
Examples from Petkovsek, Wilf, Zeilberger

\begin{reduce}
exp(log(x)+log(y^-1));
\end{reduce}


Symbols, kernels, variables, expressions ... difficult to understand

\begin{axiom}
e0:Expression Integer:=1+2*x^2+x
kernels(e0)
p0:=e0::(Polynomial Integer)
variables(p0)
e1:Expression Integer:=x*sin(t)/cos(t)+1
kernels(e1)
solve(e1=0,x)
e2:UP(x,Expression Integer):=sin(t)/cos(t)*x
\end{axiom}


Expressions and substitution

\begin{axiom}
f:=operator 'f; e:=1+a*x**2+f(y)*x^3; eq:=[f(y)=r]; peq:=subst(e,eq)::(Polynomial Integer)=0;sol:=radicalSolve(peq,x);
--[(lhs(s)=subst(rhs(s),r=f(y))) for s in sol]
--As a list there is no output shown
--x1=subst (rhs(sol.1),r=f(y))
--x2=subst (rhs(sol.2),r=f(y))
x3=subst (rhs(sol.3),r=f(y))
\end{axiom}


Parsing expressions ???

\begin{axiom}
e:Expression Integer:=x*y
isMult(e)
e1:Expression Integer:=x
isMult(e1)
isMult(e1*e)
\end{axiom}


Sin and Cos Rules

axiom
x:=v1*sin(p1)+v2*sin(p2)

\label{eq1}{v 2 \ {\sin \left({p 2}\right)}}+{v 1 \ {\sin \left({p 1}\right)}}(1)
Type: Expression(Integer)
axiom
y:= a0 + a1*x + a2*x^2 + a3*x^3

\label{eq2}\begin{array}{@{}l}
\displaystyle
{a 3 \ {v 2^3}\ {{\sin \left({p 2}\right)}^3}}+{{\left({3 \  a 3 \  v 1 \ {v 2^2}\ {\sin \left({p 1}\right)}}+{a 2 \ {v 2^2}}\right)}\ {{\sin \left({p 2}\right)}^2}}+ 
\
\
\displaystyle
{{\left({3 \  a 3 \ {v 1^2}\  v 2 \ {{\sin \left({p 1}\right)}^2}}+{2 \  a 2 \  v 1 \  v 2 \ {\sin \left({p 1}\right)}}+{a 1 \  v 2}\right)}\ {\sin \left({p 2}\right)}}+ 
\
\
\displaystyle
{a 3 \ {v 1^3}\ {{\sin \left({p 1}\right)}^3}}+{a 2 \ {v 1^2}\ {{\sin \left({p 1}\right)}^2}}+{a 1 \  v 1 \ {\sin \left({p 1}\right)}}+ a 0 
(2)
Type: Expression(Integer)
axiom
sinCosProducts := rule
  sin(x)*sin(y) == (cos(x-y) - cos(x+y))/2
  cos(x)*cos(y) == (cos(x-y) + cos(x+y))/2
  sin(x)*cos(y) == (sin(x-y) + sin(x+y))/2
  sin(x)^2 == (1 - cos(2*x))/2
  sin(x)^3 == sin(x)*(1 - cos(2*x))/2

\label{eq3}\begin{array}{@{}l}
\displaystyle
\left\{{{\%B \ {\sin \left({x}\right)}\ {\sin \left({y}\right)}}\mbox{\rm = =}{{-{\%B \ {\cos \left({y + x}\right)}}+{\%B \ {\cos \left({y - x}\right)}}}\over 2}}, \: \right.
\
\
\displaystyle
\left.{{\%C \ {\cos \left({x}\right)}\ {\cos \left({y}\right)}}\mbox{\rm = =}{{{\%C \ {\cos \left({y + x}\right)}}+{\%C \ {\cos \left({y - x}\right)}}}\over 2}}, \: \right.
\
\
\displaystyle
\left.{{\%D \ {\cos \left({y}\right)}\ {\sin \left({x}\right)}}\mbox{\rm = =}{{{\%D \ {\sin \left({y + x}\right)}}-{\%D \ {\sin \left({y - x}\right)}}}\over 2}}, \: \right.
\
\
\displaystyle
\left.{{{\sin \left({x}\right)}^2}\mbox{\rm = =}{{-{\cos \left({2 \  x}\right)}+ 1}\over 2}}, \: \right.
\
\
\displaystyle
\left.{{{\sin \left({x}\right)}^3}\mbox{\rm = =}{{{\left(-{\cos \left({2 \  x}\right)}+ 1 \right)}\ {\sin \left({x}\right)}}\over 2}}\right\} 
(3)
Type: Ruleset(Integer,Integer,Expression(Integer))
axiom
sinCosProducts(y)

\label{eq4}{\left(
\begin{array}{@{}l}
\displaystyle
-{a 3 \ {v 2^3}\ {\sin \left({3 \  p 2}\right)}}-{3 \  a 3 \  v 1 \ {v 2^2}\ {\sin \left({{2 \  p 2}+ p 1}\right)}}+ 
\
\
\displaystyle
{3 \  a 3 \  v 1 \ {v 2^2}\ {\sin \left({{2 \  p 2}- p 1}\right)}}- 
\
\
\displaystyle
{3 \  a 3 \ {v 1^2}\  v 2 \ {\sin \left({p 2 +{2 \  p 1}}\right)}}+ 
\
\
\displaystyle
{{\left({3 \  a 3 \ {v 2^3}}+{{\left({6 \  a 3 \ {v 1^2}}+{4 \  a 1}\right)}\  v 2}\right)}\ {\sin \left({p 2}\right)}}- 
\
\
\displaystyle
{3 \  a 3 \ {v 1^2}\  v 2 \ {\sin \left({p 2 -{2 \  p 1}}\right)}}-{a 3 \ {v 1^3}\ {\sin \left({3 \  p 1}\right)}}+ 
\
\
\displaystyle
{{\left({6 \  a 3 \  v 1 \ {v 2^2}}+{3 \  a 3 \ {v 1^3}}+{4 \  a 1 \  v 1}\right)}\ {\sin \left({p 1}\right)}}- 
\
\
\displaystyle
{2 \  a 2 \ {v 2^2}\ {\cos \left({2 \  p 2}\right)}}-{4 \  a 2 \  v 1 \  v 2 \ {\cos \left({p 2 + p 1}\right)}}+ 
\
\
\displaystyle
{4 \  a 2 \  v 1 \  v 2 \ {\cos \left({p 2 - p 1}\right)}}-{2 \  a 2 \ {v 1^2}\ {\cos \left({2 \  p 1}\right)}}+ 
\
\
\displaystyle
{2 \  a 2 \ {v 2^2}}+{2 \  a 2 \ {v 1^2}}+{4 \  a 0}
(4)
Type: Expression(Integer)

Integration

axiom
)clear completely
All user variables and function definitions have been cleared. All )browse facility databases have been cleared. Internally cached functions and constructors have been cleared. )clear completely is finished. integrate(%e ^(-x*x), x=%minusInfinity..%plusInfinity)

\label{eq5}\sqrt{\pi}(5)
Type: Union(f1: OrderedCompletion?(Expression(Integer)),...)

axiom
integrate(integrate(x+y, x),y)

\label{eq6}{{1 \over 2}\  x \ {y^2}}+{{1 \over 2}\ {x^2}\  y}(6)
Type: Polynomial(Fraction(Integer))

axiom
integrate(exp(-b*h*sin(o))*sin(o),o=0..2*%pi)

\label{eq7}\mbox{\tt "failed"}(7)
Type: Union(fail: failed,...)

Gosper's algorithm is implemented in Axiom

axiom
p:Polynomial Integer:=1+x+x^2

\label{eq8}{x^2}+ x + 1(8)
Type: Polynomial(Integer)
axiom
sum(p,x=0..n)

\label{eq9}{{n^3}+{3 \ {n^2}}+{5 \  n}+ 3}\over 3(9)
Type: Fraction(Polynomial(Integer))
axiom
e:=binomial(2*k,k)/4^k

\label{eq10}{\hbox{\axiomType{BINOMIAL}\ } \left({{2 \  k}, \: k}\right)}\over{4^k}(10)
Type: Expression(Integer)
axiom
sum(e,k=0..n)

\label{eq11}{{\left({2 \  n}+ 1 \right)}\ {\hbox{\axiomType{BINOMIAL}\ } \left({{2 \  n}, \: n}\right)}}\over{4^n}(11)
Type: Expression(Integer)
axiom
sum(%,n=0..n)

\label{eq12}{{\left({4 \ {n^2}}+{8 \  n}+ 3 \right)}\ {\hbox{\axiomType{BINOMIAL}\ } \left({{2 \  n}, \: n}\right)}}\over{3 \ {4^n}}(12)
Type: Expression(Integer)
axiom
factor(4*n^2+8*n+3)

\label{eq13}{\left({2 \  n}+ 1 \right)}\ {\left({2 \  n}+ 3 \right)}(13)
Type: Factored(Polynomial(Integer))

Examples from Petkovsek, Wilf, Zeilberger

exp(log(x)+log(y^-1));
reduce
\displaylines{\qdd
\frac{x}{
      y}
\cr}
 

Symbols, kernels, variables, expressions ... difficult to understand

axiom
e0:Expression Integer:=1+2*x^2+x

\label{eq14}{2 \ {x^2}}+ x + 1(14)
Type: Expression(Integer)
axiom
kernels(e0)

\label{eq15}\left[ x \right](15)
Type: List(Kernel(Expression(Integer)))
axiom
p0:=e0::(Polynomial Integer)

\label{eq16}{2 \ {x^2}}+ x + 1(16)
Type: Polynomial(Integer)
axiom
variables(p0)

\label{eq17}\left[ x \right](17)
Type: List(Symbol)
axiom
e1:Expression Integer:=x*sin(t)/cos(t)+1

\label{eq18}{{x \ {\sin \left({t}\right)}}+{\cos \left({t}\right)}}\over{\cos \left({t}\right)}(18)
Type: Expression(Integer)
axiom
kernels(e1)

\label{eq19}\left[{\sin \left({t}\right)}, \:{\cos \left({t}\right)}, \: x \right](19)
Type: List(Kernel(Expression(Integer)))
axiom
solve(e1=0,x)

\label{eq20}\left[{x = -{{\cos \left({t}\right)}\over{\sin \left({t}\right)}}}\right](20)
Type: List(Equation(Expression(Integer)))
axiom
e2:UP(x,Expression Integer):=sin(t)/cos(t)*x

\label{eq21}{{\sin \left({t}\right)}\over{\cos \left({t}\right)}}\  x(21)
Type: UnivariatePolynomial?(x,Expression(Integer))

Expressions and substitution

axiom
f:=operator 'f; e:=1+a*x**2+f(y)*x^3; eq:=[f(y)=r]; peq:=subst(e,eq)::(Polynomial Integer)=0;sol:=radicalSolve(peq,x);
Type: List(Equation(Expression(Integer)))
axiom
--[(lhs(s)=subst(rhs(s),r=f(y))) for s in sol]
--As a list there is no output shown
--x1=subst (rhs(sol.1),r=f(y))
--x2=subst (rhs(sol.2),r=f(y))
x3=subst (rhs(sol.3),r=f(y))

\label{eq22}\begin{array}{@{}l}
\displaystyle
x 3 ={{\left(
\begin{array}{@{}l}
\displaystyle
{
\begin{array}{@{}l}
\displaystyle
9 \ {{f \left({y}\right)}^2}\  \cdot 
\
\
\displaystyle
{{\root{3}\of{{{{54}\ {{f \left({y}\right)}^3}\ {\sqrt{{{{27}\ {{f \left({y}\right)}^2}}+{4 \ {a^3}}}\over{{108}\ {{f \left({y}\right)}^4}}}}}-{{27}\ {{f \left({y}\right)}^2}}-{2 \ {a^3}}}\over{{54}\ {{f \left({y}\right)}^3}}}}^2}
(22)
Type: Equation(Expression(Integer))

Parsing expressions ???

axiom
e:Expression Integer:=x*y

\label{eq23}x \  y(23)
Type: Expression(Integer)
axiom
isMult(e)

\label{eq24}\mbox{\tt "failed"}(24)
Type: Union("failed",...)
axiom
e1:Expression Integer:=x

\label{eq25}x(25)
Type: Expression(Integer)
axiom
isMult(e1)

\label{eq26}\left[{coef = 1}, \:{var = x}\right](26)
Type: Union(Record(coef: Integer,var: Kernel(Expression(Integer))),...)
axiom
isMult(e1*e)

\label{eq27}\mbox{\tt "failed"}(27)
Type: Union("failed",...)