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

Sin and Cos Rules

fricas
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)
fricas
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)
fricas
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\{{= = \left({{\%B \ {\sin \left({x}\right)}\ {\sin \left({y}\right)}}, \:{{-{\%B \ {\cos \left({y + x}\right)}}+{\%B \ {\cos \left({y - x}\right)}}}\over 2}}\right)}, \right.
\
\
\displaystyle
\left.\:{= = \left({{\%C \ {\cos \left({x}\right)}\ {\cos \left({y}\right)}}, \:{{{\%C \ {\cos \left({y + x}\right)}}+{\%C \ {\cos \left({y - x}\right)}}}\over 2}}\right)}, \: \right.
\
\
\displaystyle
\left.{= = \left({{\%D \ {\cos \left({y}\right)}\ {\sin \left({x}\right)}}, \:{{{\%D \ {\sin \left({y + x}\right)}}-{\%D \ {\sin \left({y - x}\right)}}}\over 2}}\right)}, \: \right.
\
\
\displaystyle
\left.{= = \left({{{\sin \left({x}\right)}^{2}}, \:{{-{\cos \left({2 \  x}\right)}+ 1}\over 2}}\right)}, \: \right.
\
\
\displaystyle
\left.{= = \left({{{\sin \left({x}\right)}^{3}}, \:{{{\left(-{\cos \left({2 \  x}\right)}+ 1 \right)}\ {\sin \left({x}\right)}}\over 2}}\right)}\right\} 
(3)
Type: Ruleset(Integer,Integer,Expression(Integer))
fricas
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

fricas
)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)),...)

fricas
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))

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

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

Gosper's algorithm is implemented in Axiom

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

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

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

\label{eq10}{\hbox{\axiomType{BINOMIAL}\ } \left({{2 \  k}, \: k}\right)}\over{{4}^{k}}(10)
Type: Expression(Integer)
fricas
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)
fricas
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)
fricas
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

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

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

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

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

\label{eq17}\left[ x \right](17)
Type: List(Symbol)
fricas
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)
fricas
kernels(e1)

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

\label{eq20}\left[{x = -{{\cos \left({t}\right)}\over{\sin \left({t}\right)}}}\right](20)
Type: List(Equation(Expression(Integer)))
fricas
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

fricas
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)))
fricas
--[(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{{{{2
7}\ {{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 ???

fricas
e:Expression Integer:=x*y

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

\label{eq24}\verb#"failed"#(24)
Type: Union("failed",...)
fricas
e1:Expression Integer:=x

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

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

\label{eq27}\verb#"failed"#(27)
Type: Union("failed",...)




  Subject:   Be Bold !!
  ( 15 subscribers )  
Please rate this page: