Sindbad~EG File Manager

Current Path : /usr/home/beeson/MathXpert/trigcalc/
Upload File :
Current File : /usr/home/beeson/MathXpert/trigcalc/hyperfns.c

/* M. Beeson, for MathXpert         */
/* hyperbolic and Bessel functions */
/* 9.10.91 original date
   11.7.98 last modified
   1.4.00  corrected exptohyper2
   11.18.10 corrected difcosh
   1.14.11  added six new operations, sinhasinh etc.
   3.18.23  In asinhtoln and acoshtoln, eliminated OEM symbols for TeX and corrected
            a comma to a semicolon.
   5.13.24  added more $ to reasons
*/

#include <string.h>
#include <assert.h>

#include "globals.h"
#include "calc.h"
#include "match.h"
#include "cancel.h"
#include "trig.h"   /* recip_aux */
#include "pvalaux.h" /* square2 */
/*________________________________________________________________*/
int coshdef(term t, term arg, term *next, char *reason)
/* cosh u = (e^u+e^(-u))/2 */
{ term u;
  if(FUNCTOR(t) != COSH)
     return 1;
  u = ARG(0,t);
  *next = make_fraction(sum(make_power(eulere,u),make_power(eulere,tnegate(u))),two);
  HIGHLIGHT(*next);
  strcpy(reason,"cosh u=(e^u+e^(-u))/2");
  return 0;
}

/*________________________________________________________________*/
int coshdefrev2(term t, term arg, term *next, char *reason)
/* e^u + e^-u = 2 cosh u */
{ term lhs,a;
  int err;
  if(FUNCTOR(t) != '+')
     return 1;
  lhs = sum(make_power(eulere,var0),make_power(eulere,tnegate(var0)));
  err = match(t,lhs,product(two,cosh1(var0)),&a,next);   /* instantiate a and *next */
  if(err)
     { destroy_term(lhs);
       return 1;
     }
  HIGHLIGHT(*next);
  strcpy(reason,"e^u+e^(-u) = 2 cosh u");
  return 0;
}

/*________________________________________________________________*/
int sinhdef(term t, term arg, term *next, char *reason)
/* sinh u = (e^u-e^(-u))/2 */
{ term u;
  if(FUNCTOR(t) != SINH)
     return 1;
  u = ARG(0,t);
  *next = make_fraction(sum(make_power(eulere,u),tnegate(make_power(eulere,tnegate(u)))),two);
  HIGHLIGHT(*next);
  strcpy(reason,"sinh u=(e^u-e^(-u))/2");
  return 0;
}

/*________________________________________________________________*/
int sinhdefrev2(term t, term arg, term *next, char *reason)
/* e^u-e^(-u) = 2 sinh u */
{ term lhs,a;
  int err;
  if(FUNCTOR(t) != '+')
     return 1;
  lhs = sum(make_power(eulere,var0),tnegate(make_power(eulere,tnegate(var0))));
  err = match(t,lhs,product(two,sinh1(var0)),&a,next);   /* instantiate a and *next */
  if(err)
     { destroy_term(lhs);
       return 1;
     }
  HIGHLIGHT(*next);
  strcpy(reason,"e^u-e^(-u) = 2 sinh u");
  return 0;
}


/*________________________________________________________________*/
int tanhdef(term t, term arg, term *next, char *reason)
/* tanh u = sinh u / cosh u */
{ term u;
  if(FUNCTOR(t) != TANH)
     return 1;
  u = ARG(0,t);
  *next = make_fraction(sinh1(u),cosh1(u));
  HIGHLIGHT(*next);
  strcpy(reason,"tanh u= sinh u/cosh u");
  return 0;
}

/*________________________________________________________________*/
int coshsqminussinhsq(term t, term arg, term *next, char *reason)
/* cosh^2 u - sinh^2u = 1 */
{ term lhs,a;
  int err;
  lhs = sum(make_power(cosh1(var0),two),tnegate(make_power(sinh1(var0),two)));
  err = match(t,lhs,one,&a,next);  /* instantiate a and *next */
  if(err)
     { destroy_term(lhs);
       return 1;
     }
  HIGHLIGHT(*next);
  strcpy(reason,"$cosh^2 u - sinh^2 u = 1$");
  return 0;
}
/*________________________________________________________________*/
int cosheven(term t, term arg, term *next, char *reason)
/* cosh(-u) = cosh u */
{ if(FUNCTOR(t) != COSH)
     return 1;
  if(FUNCTOR(ARG(0,t)) != '-')
     return 1;
  *next = cosh1(ARG(0,ARG(0,t)));
  HIGHLIGHT(*next);
  strcpy(reason,"cosh(-u) = cosh u");
  return 0;
}

/*________________________________________________________________*/
int sinhodd(term t, term arg, term *next, char *reason)
/* sinh(-u) = -sinh u */
{ if(FUNCTOR(t) != SINH)
     return 1;
  if(FUNCTOR(ARG(0,t)) != '-')
     return 1;
  tneg(sinh1(ARG(0,ARG(0,t))),next);
  HIGHLIGHT(*next);
  strcpy(reason,"sinh(-u) = -sinh u");
  return 0;
}

/*________________________________________________________________*/
int sinhsum(term t, term arg, term *next, char *reason)
/*  sinh(u \pm v)=sinh u cosh v  \pm  cosh u sinh v */
{ term u,v,w;
  unsigned short i,n;
  int sign = 1;
  if(FUNCTOR(t) != SINH)
     return 1;
  if(FUNCTOR(ARG(0,t)) != '+')
     return 1;
  n = ARITY(ARG(0,t));
  u = ARG(0,ARG(0,t));
  if(n == 2)
     { v = ARG(1,ARG(0,t));
       if(FUNCTOR(v) == '-')
          { sign = -1;
            v = ARG(0,v);
          }
     }
  else
     { v = make_term('+',(unsigned short)(n-1));
       for(i=0;i<(unsigned short)(n-1);i++)
          ARGREP(v,i,ARG(i+1,ARG(0,t)));
     }
  w = product(cosh1(u),sinh1(v));
  *next = sum(product(sinh1(u),cosh1(v)),sign == 1 ? w : tnegate(w));
  HIGHLIGHT(*next);
  strcpy(reason,"sinh(u$ \\pm $v) = sinh u   cosh v $ \\pm $cosh u sinh v");
  return 0;
}

/*________________________________________________________________*/
int coshsum(term t, term arg, term *next, char *reason)
/* cosh(u \pm v)=cosh u cosh v  \pm  sinh u sinh v */
{ term u,v,w;
  unsigned short i,n;
  int sign = 1;
  if(FUNCTOR(t) != COSH)
     return 1;
  if(FUNCTOR(ARG(0,t)) != '+')
     return 1;
  n = ARITY(ARG(0,t));
  u = ARG(0,ARG(0,t));
  if(n == 2)
     { v = ARG(1,ARG(0,t));
       if(FUNCTOR(v) == '-')
          { v = ARG(0,v);
            sign = -1;
          }
     }
  else
     { v = make_term('+',(unsigned short)(n-1));
       for(i=0;i<(unsigned short)(n-1);i++)
          ARGREP(v,i,ARG(i+1,ARG(0,t)));
     }

  w = product(sinh1(u),sinh1(v));
  *next = sum(product(cosh1(u),cosh1(v)),sign == 1 ? w : tnegate(w));
  HIGHLIGHT(*next);
  strcpy(reason,"cosh(u$\\pm$v) = cosh u   cosh v $\\pm$sinh u sinh v");
  return 0;
}

/*________________________________________________________________*/
int doublesinh(term t, term arg, term *next, char *reason)
/* sinh 2u = 2 sinh u cosh u */
{ int err;
  term cancelled, temp,u;
  if (FUNCTOR(t) != SINH)
     return 1;
  u = ARG(0,t);
  if(FUNCTOR(u) != '*')
     return 1;
  err = cancel(u,two,&cancelled,&temp);
  if(err)
     return 1;
  *next = product3(two,sinh1(temp),cosh1(temp));
  HIGHLIGHT(*next);
  strcpy(reason,"sinh 2u =            2 sinh u cosh u");
  return 0;
}


/*________________________________________________________________*/
int doublecosh(term t, term arg, term *next, char *reason)
/* cosh 2u = cosh^2 u + sinh^2 u */
{ int err;
  term cancelled, temp,u;
  if (FUNCTOR(t) != COSH)
     return 1;
  u = ARG(0,t);
  if(FUNCTOR(u) != '*')
     return 1;
  err = cancel(u,two,&cancelled,&temp);
  if(err)
     return 1;
  *next = sum(make_power(cosh1(temp),two),make_power(sinh1(temp),two));
  HIGHLIGHT(*next);
  strcpy(reason,"$cos 2u=cosh^2u+sinh^2u$");
  return 0;
}

/*________________________________________________________________*/
int coshplussinh(term t, term arg, term *next, char *reason)
/* cosh u + sinh u = e^u */
{ term lhs,a;
  int err;
  lhs = sum(cosh1(var0),sinh1(var0));
  err = match(t,lhs,make_power(eulere,var0),&a,next);   /* instantiate a and *next */
  if(err)
     { destroy_term(lhs);
       return 1;
     }
  HIGHLIGHT(*next);
  strcpy(reason,"cosh a + sinh a = e^a");
  return 0;
}
/*________________________________________________________________*/
int coshminussinh(term t, term arg, term *next, char *reason)
/* cosh u - sinh u = e^(-u)  */
{ term lhs,rhs,a;
  int err;
  lhs = sum(cosh1(var0),tnegate(sinh1(var0)));
  rhs = make_power(eulere,tnegate(var0));
  err = match(t,lhs,rhs,&a,next);   /* instantiate a and *next */
  if(err)
     { destroy_term(lhs);
       return 1;
     }
  HIGHLIGHT(*next);
  strcpy(reason,"cosh a-sinh a=e^(-a)");
  return 0;
}


/*_______________________________________________________________________*/
int difsinh(term t, term arg, term *next, char *reason)
{ term x,u,p;
  if(FUNCTOR(t) != DIFF)
     return 1;
  x = ARG(1,t);
  u = ARG(0,t);
  if(FUNCTOR(u) != SINH)
     return 1;
  p = ARG(0,u);
  if(equals(p,x))
    {*next = cosh1(x);
     strcpy(reason,"d/dx sinh x = cosh x");
    }
  else
    {*next = product(cosh1(p),diff(p,x));
     strcpy(reason,"d/dx sinh u =         (cosh u) du/dx");
    }
  HIGHLIGHT(*next);
  return 0;
}

/*_______________________________________________________________________*/
int difcosh(term t, term arg, term *next, char *reason)
{ term x,u,p;
  if(FUNCTOR(t) != DIFF)
     return 1;
  x = ARG(1,t);
  u = ARG(0,t);
  if(FUNCTOR(u) != COSH)
     return 1;
  p = ARG(0,u);
  if(equals(p,x))
     { *next = sinh1(x);
       strcpy(reason,"d/dx cosh x = sinh x");
     }
  else
     { *next = product(sinh1(p),diff(p,x));
       strcpy(reason,"d/dx cosh u =          (sinh u) du/dx");
     }
  HIGHLIGHT(*next);
  return 0;
}

/*_______________________________________________________________________*/
int difsech(term t, term arg, term *next, char *reason)
{ term x,u,p;
  if(FUNCTOR(t) != DIFF)
     return 1;
  x = ARG(1,t);
  u = ARG(0,t);
  if(FUNCTOR(u) != SECH)
     return 1;
  p = ARG(0,u);
  if(equals(p,x))
     { *next = tnegate(product(sech1(x),tanh1(x)));
       strcpy(reason,"d/dx sech x =        -sech x tanh x");
     }
  else
     { *next = tnegate(product3(sech1(p),tanh1(p),diff(p,x)));
       strcpy(reason,"d/dx sech u =        -sech u tanh u du/dx");
     }
  HIGHLIGHT(*next);
  return 0;
}

/*_______________________________________________________________________*/
int difcsch(term t, term arg, term *next, char *reason)
{ term x,u,p;
  if(FUNCTOR(t) != DIFF)
     return 1;
  x = ARG(1,t);
  u = ARG(0,t);
  if(FUNCTOR(u) != CSCH)
     return 1;
  p = ARG(0,u);
  if(equals(p,x))
     { *next = tnegate(product(csch1(x),coth1(x)));
       strcpy(reason,"d/dx csch x =        -csch x coth x");
     }
  else
     { *next = tnegate(product3(csch1(p),coth1(p),diff(p,x)));
       strcpy(reason,"d/dx csch u =        -csch u coth u du/dx");
     }
  HIGHLIGHT(*next);
  return 0;
}
/*_______________________________________________________________________*/
int difcoth(term t, term arg, term *next, char *reason)
{ term x,u,p;
  if(FUNCTOR(t) != DIFF)
     return 1;
  x = ARG(1,t);
  u = ARG(0,t);
  if(FUNCTOR(u) != COTH)
     return 1;
  p = ARG(0,u);
  if(equals(p,x))
     { *next = tnegate(make_power(csch1(x),two));
       strcpy(reason,"d/dx coth x=-csch^2 x");
     }
  else
     { *next = tnegate(product(make_power(csch1(p),two),diff(p,x)));
       strcpy(reason,"d/dx coth u =          -(csch^2 u) du/dx");
     }
  HIGHLIGHT(*next);
  return 0;
}
/*_______________________________________________________________________*/
int diftanh(term t, term arg, term *next, char *reason)
{ term x,u,p;
  if(FUNCTOR(t) != DIFF)
     return 1;
  x = ARG(1,t);
  u = ARG(0,t);
  if(FUNCTOR(u) != TANH)
     return 1;
  p = ARG(0,u);
  if(equals(p,x))
     { *next = make_power(sech1(x),two);
       strcpy(reason,"d/dx tanh x = sech^2 x");
     }
  else
     { *next = product(make_power(sech1(p),two),diff(p,x));
       strcpy(reason,"d/dx tanh u =        (sech^2 u) du/dx");
     }
  HIGHLIGHT(*next);
  return 0;
}
/*_______________________________________________________________________*/
int intsinh(term t, term arg, term *next, char *reason)
{ term x,u;
  if(FUNCTOR(t) != INTEGRAL)
     return 1;
  x = ARG(1,t);
  u = ARG(0,t);
  if(FUNCTOR(u) != SINH)
     return 1;
  if(!equals(ARG(0,u),x))
     return 1;
  if(ARITY(t) == 2)  /* indefinite integral */
     *next = cosh1(x);
  else
     *next = evalat(cosh1(x), x,ARG(2,t),ARG(3,t));
  HIGHLIGHT(*next);
  strcpy(reason,"$\\int sinh x dx = cosh x$");
  return 0;
}
/*_______________________________________________________________________*/
int intcosh(term t, term arg, term *next, char *reason)
{ term x,u;
  if(FUNCTOR(t) != INTEGRAL)
     return 1;
  x = ARG(1,t);
  u = ARG(0,t);
  if(FUNCTOR(u) != COSH)
     return 1;
  if(!equals(ARG(0,u),x))
     return 1;
  if(ARITY(t) == 2)  /* indefinite integral */
     *next = sinh1(x);
  else
     *next = evalat(sinh1(x), x,ARG(2,t),ARG(3,t));
  HIGHLIGHT(*next);
  strcpy(reason,"$\\int cosh x dx = sinh x$");
  return 0;
}
/*_______________________________________________________________________*/
int inttanh(term t, term arg, term *next, char *reason)
{ term x,u;
  if(FUNCTOR(t) != INTEGRAL)
     return 1;
  x = ARG(1,t);
  u = ARG(0,t);
  if(FUNCTOR(u) != TANH)
     return 1;
  if(!equals(ARG(0,u),x))
     return 1;
  if(ARITY(t) == 2)  /* indefinite integral */
     *next = ln1(cosh1(x));
  else
     *next = evalat(ln1(cosh1(x)), x,ARG(2,t),ARG(3,t));
  HIGHLIGHT(*next);
  strcpy(reason,"$\\int tanh x dx=ln cosh x$");
  return 0;
}
/*_______________________________________________________________________*/
int intcoth(term t, term arg, term *next, char *reason)
{ term x,u;
  if(FUNCTOR(t) != INTEGRAL)
     return 1;
  x = ARG(1,t);
  u = ARG(0,t);
  if(FUNCTOR(u) != COTH)
     return 1;
  if(!equals(ARG(0,u),x))
     return 1;
  if(ARITY(t) == 2)  /* indefinite integral */
     *next = ln1(sinh1(x));
  else
     *next = evalat(ln1(sinh1(x)), x,ARG(2,t),ARG(3,t));
  HIGHLIGHT(*next);
  strcpy(reason,"$\\int coth x dx=ln sinh x$");
  return 0;
}
/*_______________________________________________________________________*/
int intcsch(term t, term arg, term *next, char *reason)
{ term x,u;
  if(FUNCTOR(t) != INTEGRAL)
     return 1;
  x = ARG(1,t);
  u = ARG(0,t);
  if(FUNCTOR(u) != COTH)
     return 1;
  if(!equals(ARG(0,u),x))
     return 1;
  if(ARITY(t) == 2)  /* indefinite integral */
     *next = ln1(tanh1(make_fraction(x,two)));
  else
     *next = evalat(ln1(make_fraction(tanh1(x),two)), x,ARG(2,t),ARG(3,t));
  HIGHLIGHT(*next);
  strcpy(reason,"$\\int csch x dx$ =          ln tanh(x/2)");
  return 0;
}
/*_______________________________________________________________________*/
int intsech(term t, term arg, term *next, char *reason)
{ term x,u;
  if(FUNCTOR(t) != INTEGRAL)
     return 1;
  x = ARG(1,t);
  u = ARG(0,t);
  if(FUNCTOR(u) != SECH)
     return 1;
  if(!equals(ARG(0,u),x))
     return 1;
  if(ARITY(t) == 2)  /* indefinite integral */
     *next = atan1(sinh1(x));
  else
     *next = evalat(atan1(sinh1(x)), x,ARG(2,t),ARG(3,t));
  HIGHLIGHT(*next);
  strcpy(reason,"$\\int sech x dx$ =          arctan(sinh x)");
  return 0;
}
/*_______________________________________________________________________*/
int difasinh(term t, term arg, term *next, char *reason)
{ term x,u,p;
  if(FUNCTOR(t) != DIFF)
     return 1;
  x = ARG(1,t);
  u = ARG(0,t);
  if(FUNCTOR(u) != ASINH)
     return 1;
  p = ARG(0,u);
  if(equals(p,x))
     { *next = make_fraction(one,sqrt1(sum(make_power(x,two),one)));
       strcpy(reason,"d/dx asinh x =       $1/\\sqrt (x^2+1)$");
     }
  else
     { *next = make_fraction(diff(p,x),sqrt1(sum(make_power(p,two),one)));
       strcpy(reason,"d/dx asinh u =       $(du/dx)/\\sqrt (u^2+1)$");
     }
  HIGHLIGHT(*next);
  return 0;
}

/*_______________________________________________________________________*/
int difacosh(term t, term arg, term *next, char *reason)
{ term x,u,p;
  if(FUNCTOR(t) != DIFF)
     return 1;
  x = ARG(1,t);
  u = ARG(0,t);
  if(FUNCTOR(u) != ACOSH)
     return 1;
  p = ARG(0,u);
  if(equals(p,x))
     { *next = make_fraction(one,sqrt1(sum(make_power(x,two),minusone)));
       strcpy(reason,"d/dx acosh x =        $1/\\sqrt (x^2-1)$");
     }
  else
     { *next = make_fraction(diff(p,x),sqrt1(sum(make_power(p,two),minusone)));
       strcpy(reason,"d/dx acosh u =        $(du/dx)/\\sqrt (u^2-1)$");
     }
  HIGHLIGHT(*next);
  return 0;
}

/*_______________________________________________________________________*/
int difatanh(term t, term arg, term *next, char *reason)
{ term x,u,p;
  if(FUNCTOR(t) != DIFF)
     return 1;
  x = ARG(1,t);
  u = ARG(0,t);
  if(FUNCTOR(u) != ATANH)
     return 1;
  p = ARG(0,u);
  if(equals(p,x))
     { *next = make_fraction(one,sum(one,tnegate(make_power(x,two))));
       strcpy(reason,"$d/dx atanh x=1/(1-x^2)$");
     }
  else
     { *next = make_fraction(diff(p,x),sum(one,tnegate(make_power(p,two))));
       strcpy(reason,"d/dx atanh u =       (du/dx)/(1-u^2)");
     }
  HIGHLIGHT(*next);
  return 0;
}
/*_______________________________________________________________________*/
int difacoth(term t, term arg, term *next, char *reason)
{ term x,u,p;
  if(FUNCTOR(t) != DIFF)
     return 1;
  x = ARG(1,t);
  u = ARG(0,t);
  if(FUNCTOR(u) != ACOTH)
     return 1;
  p = ARG(0,u);
  if(equals(p,x))
     { *next = make_fraction(one,sum(one,tnegate(make_power(x,two))));
       strcpy(reason,"d/dx atanh x=1/(1-x^2)");
     }
  else
     { *next = make_fraction(diff(p,x),sum(one,tnegate(make_power(p,two))));
       strcpy(reason,"d/dx atanh u =        (du/dx)/(1-u^2)");
     }
  HIGHLIGHT(*next);
  return 0;
}
/*_______________________________________________________________________*/
int difacsch(term t, term arg, term *next, char *reason)
{ term x,u,p;
  if(FUNCTOR(t) != DIFF)
     return 1;
  x = ARG(1,t);
  u = ARG(0,t);
  if(FUNCTOR(u) != ACSCH)
    return 1;
  p = ARG(0,u);
  if(equals(p,x))
     { *next = tnegate(make_fraction(one,product(abs1(x),sqrt1(sum(make_power(x,two),one)))));
       strcpy(reason,"d/dx acsch x =       $-1/|x|\\sqrt (x^2+1)$");
     }
  else
     { *next = tnegate(make_fraction(diff(p,x),product(abs1(p),sqrt1(sum(make_power(p,two),one)))));
       strcpy(reason,"d/dx acsch u =       $-(du/dx)/|u|\\sqrt (u^2+1)$");
     }
  HIGHLIGHT(*next);
  return 0;
}
/*_______________________________________________________________________*/
int difasech(term t, term arg, term *next, char *reason)
{ term x,u,p;
  if(FUNCTOR(t) != DIFF)
     return 1;
  x = ARG(1,t);
  u = ARG(0,t);
  if(FUNCTOR(u) != ASECH)
     return 1;
  p = ARG(0,u);
  if(equals(p,x))
     { *next = tnegate(make_fraction(one,product(abs1(x),sqrt1(sum(one,tnegate(make_power(x,two)))))));
       strcpy(reason,"d/dx acsch x =       $-1/|x|\\sqrt (1-x^2)$");
     }
  else
     { *next = tnegate(make_fraction(diff(p,x),product(abs1(p),sqrt1(sum(one,tnegate(make_power(p,two)))))));
       strcpy(reason,"d/dx acsch u =       $-(du/dx)/|u|\\sqrt (1-u^2)$");
     }
  HIGHLIGHT(*next);
  return 0;
}

/*________________________________________________________________*/
int cosh0(term t, term arg, term *next, char *reason)
/* cosh 0 = 1 */
{ if(FUNCTOR(t) != COSH)
     return 1;
  if(!ZERO(ARG(0,t)))
     return 1;
  *next = one;
  strcpy(reason,"cosh 0 = 1");
  return 0;
}
/*________________________________________________________________*/
int sinh0(term t, term arg, term *next, char *reason)
/* sinh 0 = 1 */
{ if(FUNCTOR(t) != SINH)
     return 1;
  if(!ZERO(ARG(0,t)))
     return 1;
  *next = zero;
  strcpy(reason,"sinh 0 = 0");
  return 0;
}

/*________________________________________________________________*/
int difj0(term t, term arg, term *next, char *reason)
/* d/dx J0(x) = -J1(x) */
{ term u,x,n,v;
  if(FUNCTOR(t) != DIFF)
     return 1;
  u = ARG(0,t);
  x = ARG(1,t);
  if(FUNCTOR(u) != BESSELJ)
     return 1;
  n = ARG(0,u);
  v = ARG(1,u);
  if(!ZERO(n))
     return 1;
  if(equals(v,x))
      *next = tnegate(besselj(one,x));
  else
      *next = tnegate(product(besselj(one,v),diff(v,x)));
  strcpy(reason,"d/dx J0(x) = -J1(x)");
  HIGHLIGHT(*next);
  return 0;
}

/*________________________________________________________________*/
int difj1(term t, term arg, term *next, char *reason)
/* d/dx J1(x) = J0(x) - J1(x)/x */

{ term u,x,n,v,w;
  if(FUNCTOR(t) != DIFF)
     return 1;
  u = ARG(0,t);
  x = ARG(1,t);
  if(FUNCTOR(u) != BESSELJ)
     return 1;
  n = ARG(0,u);
  v = ARG(1,u);
  if(!ONE(n))
     return 1;
      w = sum(besselj(zero,v),tnegate(make_fraction(besselj(one,v),v)));
  if(equals(v,x))
      *next = w;
  else
      *next = product(w,diff(v,x));
  strcpy(reason,"d/dx J1(x) =          J0(x)-J1(x)/x");
  HIGHLIGHT(*next);
  return 0;
}

/*________________________________________________________________*/
int difjn(term t, term arg, term *next, char *reason)
/* d/dx J(n,x)=J(n-1,x)-(n/x)J(n,x) */
{ term u,x,n,v,w,nminusone;
  if(FUNCTOR(t) != DIFF)
     return 1;
  u = ARG(0,t);
  x = ARG(1,t);
  if(FUNCTOR(u) != BESSELJ)
     return 1;
  n = ARG(0,u);
  v = ARG(1,u);
  value(sum(n,minusone),&nminusone);
  w = sum(besselj(nminusone,v),tnegate(product(make_fraction(n,v),besselj(n,v))));
  if(equals(v,x))
      *next = w;
  else
      *next = product(w,diff(v,x));
  strcpy(reason,"d/dx J(n,x) =          J(n-1,x)-(n/x)J(n,x)");
  HIGHLIGHT(*next);
  return 0;
}
/*________________________________________________________________*/
int dify0(term t, term arg, term *next, char *reason)
/* d/dx Y0(x) = -Y1(x) */
{ term u,x,n,v;
  if(FUNCTOR(t) != DIFF)
     return 1;
  u = ARG(0,t);
  x = ARG(1,t);
  if(FUNCTOR(u) != BESSELY)
     return 1;
  n = ARG(0,u);
  v = ARG(1,u);
  if(!ZERO(n))
     return 1;
  if(equals(v,x))
      *next = tnegate(bessely(one,x));
  else
      *next = tnegate(product(bessely(one,v),diff(v,x)));
  strcpy(reason,"d/dx Y0(x) = -Y1(x)");
  HIGHLIGHT(*next);
  return 0;
}

/*________________________________________________________________*/
int dify1(term t, term arg, term *next, char *reason)
/* d/dx Y1(x) = Y0(x) - Y1(x)/x */

{ term u,x,n,v,w;
  if(FUNCTOR(t) != DIFF)
     return 1;
  u = ARG(0,t);
  x = ARG(1,t);
  if(FUNCTOR(u) != BESSELY)
     return 1;
  n = ARG(0,u);
  v = ARG(1,u);
  if(!ONE(n))
     return 1;
      w = sum(bessely(zero,v),tnegate(make_fraction(bessely(one,v),v)));
  if(equals(v,x))
      *next = w;
  else
      *next = product(w,diff(v,x));
  strcpy(reason,"d/dx Y1(x) =          Y0(x)-Y1(x)/x");
  HIGHLIGHT(*next);
  return 0;
}

/*________________________________________________________________*/
int difyn(term t, term arg, term *next, char *reason)
/* d/dx Y(n,x)=Y(n-1,x)-(n/x)Y(n,x) */
{ term u,x,n,v,w,nminusone;
  if(FUNCTOR(t) != DIFF)
     return 1;
  u = ARG(0,t);
  x = ARG(1,t);
  if(FUNCTOR(u) != BESSELY)
     return 1;
  n = ARG(0,u);
  v = ARG(1,u);
  value(sum(n,minusone),&nminusone);
  w = sum(bessely(nminusone,v),tnegate(product(make_fraction(n,v),bessely(n,v))));
  if(equals(v,x))
      *next = w;
  else
      *next = product(w,diff(v,x));
  strcpy(reason,"d/dx Y(n,x) =        Y(n-1,x)-(n/x)Y(n,x)");
  HIGHLIGHT(*next);
  return 0;
}
/*________________________________________________________________*/
int difi0(term t, term arg, term *next, char *reason)
/* d/dx I0(x) = -I1(x) */
{ term u,x,n,v;
  if(FUNCTOR(t) != DIFF)
     return 1;
  u = ARG(0,t);
  x = ARG(1,t);
  if(FUNCTOR(u) != BESSELI)
     return 1;
  n = ARG(0,u);
  v = ARG(1,u);
  if(!ZERO(n))
     return 1;
  if(equals(v,x))
      *next = tnegate(besseli(one,x));
  else
      *next = tnegate(product(besseli(one,v),diff(v,x)));
  strcpy(reason,"d/dx I0(x) = -I1(x)");
  HIGHLIGHT(*next);
  return 0;
}

/*________________________________________________________________*/
int difi1(term t, term arg, term *next, char *reason)
/* d/dx I1(x) = I0(x) - I1(x)/x */

{ term u,x,n,v,w;
  if(FUNCTOR(t) != DIFF)
     return 1;
  u = ARG(0,t);
  x = ARG(1,t);
  if(FUNCTOR(u) != BESSELI)
     return 1;
  n = ARG(0,u);
  v = ARG(1,u);
  if(!ONE(n))
     return 1;
      w = sum(besseli(zero,v),tnegate(make_fraction(besseli(one,v),v)));
  if(equals(v,x))
      *next = w;
  else
      *next = product(w,diff(v,x));
  strcpy(reason,"d/dx I1(x) =         I0(x)-I1(x)/x");
  HIGHLIGHT(*next);
  return 0;
}

/*________________________________________________________________*/
int difin(term t, term arg, term *next, char *reason)
/* d/dx I(n,x)=I(n-1,x)-(n/x)I(n,x) */
{ term u,x,n,v,w,nminusone;
  if(FUNCTOR(t) != DIFF)
     return 1;
  u = ARG(0,t);
  x = ARG(1,t);
  if(FUNCTOR(u) != BESSELI)
     return 1;
  n = ARG(0,u);
  v = ARG(1,u);
  value(sum(n,minusone),&nminusone);
  w = sum(besseli(nminusone,v),tnegate(product(make_fraction(n,v),besseli(n,v))));
  if(equals(v,x))
      *next = w;
  else
      *next = product(w,diff(v,x));
  strcpy(reason,"d/dx I(n,x) =        I(n-1,x)-(n/x)I(n,x)");
  HIGHLIGHT(*next);
  return 0;
}
/*________________________________________________________________*/
int difk0(term t, term arg, term *next, char *reason)
/* d/dx K0(x) = -K1(x) */
{ term u,x,n,v;
  if(FUNCTOR(t) != DIFF)
     return 1;
  u = ARG(0,t);
  x = ARG(1,t);
  if(FUNCTOR(u) != BESSELK)
     return 1;
  n = ARG(0,u);
  v = ARG(1,u);
  if(!ZERO(n))
     return 1;
  if(equals(v,x))
      *next = tnegate(besselk(one,x));
  else
      *next = tnegate(product(besselk(one,v),diff(v,x)));
  strcpy(reason,"d/dx K0(x) = -K1(x)");
  HIGHLIGHT(*next);
  return 0;
}

/*________________________________________________________________*/
int difk1(term t, term arg, term *next, char *reason)
/* d/dx K1(x) = - K0(x) - K1(x)/x */

{ term u,x,n,v,w;
  if(FUNCTOR(t) != DIFF)
     return 1;
  u = ARG(0,t);
  x = ARG(1,t);
  if(FUNCTOR(u) != BESSELK)
     return 1;
  n = ARG(0,u);
  v = ARG(1,u);
  if(!ONE(n))
     return 1;
      w = sum(tnegate(besselk(zero,v)),tnegate(make_fraction(besselk(one,v),v)));
  if(equals(v,x))
      *next = w;
  else
      *next = product(w,diff(v,x));
  strcpy(reason,"d/dx K1(x) =         -K0(x)-K1(x)/x");
  HIGHLIGHT(*next);
  return 0;
}

/*________________________________________________________________*/
int difkn(term t, term arg, term *next, char *reason)
/* d/dx K(n,x)=-K(n-1,x)-(n/x)K(n,x) */
{ term u,x,n,v,w,nminusone;
  if(FUNCTOR(t) != DIFF)
     return 1;
  u = ARG(0,t);
  x = ARG(1,t);
  if(FUNCTOR(u) != BESSELK)
     return 1;
  n = ARG(0,u);
  v = ARG(1,u);
  value(sum(n,minusone),&nminusone);
  w = sum(tnegate(besselk(nminusone,v)),tnegate(product(make_fraction(n,v),besselk(n,v))));
  if(equals(v,x))
      *next = w;
  else
      *next = product(w,diff(v,x));
  strcpy(reason,"d/dx K(n,x) =        -K(n-1,x)-(n/x)K(n,x)");
  HIGHLIGHT(*next);
  return 0;
}
/*_______________________________________________________*/
int asinhtoln(term t, term arg, term *next, char *reason)
/* arcsinh x = ln(x + sqrt(x^2+1)) */
{ term u;
  if(FUNCTOR(t) != ASINH)
    return 1;
  u = ARG(0,t);
  *next = ln1(sum(u, sqrt1(sum(make_power(u,two), one))));
  strcpy(reason,"arcsinh x =          $ln(x+\\sqrt(x^2+1))$");
  HIGHLIGHT(*next);
  return 0;
}
/*_______________________________________________________*/
int acoshtoln(term t, term arg, term *next, char *reason)
/* arccosh x = ln(x + sqrt(x^2-1)) */
{ term u;
  if(FUNCTOR(t) != ACOSH)
    return 1;
  u = ARG(0,t);
  *next = ln1(sum(u, sqrt1(sum(make_power(u,two), minusone))));
  strcpy(reason,"arccosh x =          $ln(x+\\sqrt(x^2-1))$");
  HIGHLIGHT(*next);
  return 0;
}
/*_______________________________________________________*/
int atanhtoln(term t, term arg, term *next, char *reason)
/* arctanh x = (1/2) ln((1+x)/(1-x)) */
{ term u,num;
  if(FUNCTOR(t) != ATANH)
    return 1;
  u = ARG(0,t);
  num = sum(one,u);
  SETORDERED(num);
  *next = product(reciprocal(two), ln1(make_fraction(num,sum(one,tnegate(u)))));
  strcpy(reason,"$$arctanh x = (1/2) ln((1+x)/(1-x))$$");
  HIGHLIGHT(*next);
  return 0;
}
/*________________________________________________________________________*/
int coshsqtosinhsq(term t, term arg, term *next, char *reason)
/* cosh^2 u = sinh^2u + 1    */
{ term u,n,v,q,m;
  if(FUNCTOR(t) != '^' || !INTEGERP(ARG(1,t)) || !ISEVEN(ARG(1,t)))
     return 1;
  n = ARG(1,t);
  u = ARG(0,t);
  if(FUNCTOR(u) != COSH)
     return 1;
  v = ARG(0,u);
  strcpy(reason,"$$cosh^2 u = sinh^2 u + 1$$");
  q = sum(make_power(sinh1(v),two),one);
  if(equals(n,two))
     { *next = q;
       HIGHLIGHT(*next);
       return 0;
     }
  value(make_fraction(n,two),&m);
  *next = make_power(q,m);
  HIGHLIGHT(*next);
  return 0;
}
/*________________________________________________________________________*/
int sinhsqtocoshsq(term t, term arg, term *next, char *reason)
/* sinh^2u = cosh^2 u - 1 */
{ term u,n,v,q,m;
  if(FUNCTOR(t) != '^' || !INTEGERP(ARG(1,t)) || !ISEVEN(ARG(1,t)))
     return 1;
  n = ARG(1,t);
  u = ARG(0,t);
  if(FUNCTOR(u) != SINH)
     return 1;
  v = ARG(0,u);
  strcpy(reason,"$$sinh^2 u = cosh^2 u - 1$$");
  q = sum(make_power(cosh1(v),two),minusone);
  if(equals(n,two))
     { *next = q;
       HIGHLIGHT(*next);
       return 0;
     }
  value(make_fraction(n,two),&m);
  *next = make_power(q,m);
  HIGHLIGHT(*next);
  return 0;
}

/*________________________________________________________________________*/
int tanhdefrev(term t, term arg, term *next, char *reason)
/* sinh u / cosh u = tanh u */
{ if (FUNCTOR(t) != '/')
     return 1;
  if(FUNCTOR(ARG(0,t)) != SINH)
     return 1;
  if(FUNCTOR(ARG(1,t)) != COSH)
     return 1;
  if(! equals(ARG(0,ARG(0,t)),ARG(0,ARG(1,t))))
     return 1;
  *next = tanh1(ARG(0,ARG(0,t)));
  HIGHLIGHT(*next);
  strcpy(reason,"$$ (sinh x)/ (cosh x)=tanh x$$");
  return 0;
}

/*________________________________________________________________________*/
int cothdef(term t, term arg, term *next, char *reason)
/* coth u = cosh u / sinh u */
{ term u;
  if(FUNCTOR(t) != COTH)
     return 1;
  u = ARG(0,t);
  *next = make_fraction(cosh1(u),sinh1(u));
  HIGHLIGHT(*next);
  strcpy(reason,"$$coth u= (cosh u)/(sinh u)$$");
  return 0;
}
/*________________________________________________________________________*/
int cothdefrev(term t, term arg, term *next, char *reason)
/* cosh u / sinh u = coth u */
{ if (FUNCTOR(t) != '/')
     return 1;
  if(FUNCTOR(ARG(0,t)) != COSH)
     return 1;
  if(FUNCTOR(ARG(1,t)) != SINH)
     return 1;
  if(! equals(ARG(0,ARG(0,t)),ARG(0,ARG(1,t))))
     return 1;
  *next = coth1(ARG(0,ARG(0,t)));
  HIGHLIGHT(*next);
  strcpy(reason,"$$(cosh x)/ (sinh x)=coth x$$");
  return 0;
}


/*________________________________________________________________________*/
int sechdef(term t, term arg, term *next, char *reason)
/* sech u = 1 / cosh u      */
{ term u;
  if(FUNCTOR(t) == '^' && FUNCTOR(ARG(0,t)) == SECH)
     { *next = make_power(reciprocal(cosh1(ARG(0,ARG(0,t)))),ARG(1,t));
       HIGHLIGHT(*next);
       strcpy(reason,"$sech u= 1/cosh u$");
       return 0;
     }
  if(FUNCTOR(t) != SECH)
     return 1;
  u = ARG(0,t);
  *next = reciprocal(cosh1(u));
  HIGHLIGHT(*next);
  strcpy(reason,"$sech u= 1/cosh u$");
  return 0;
}

/*________________________________________________________________________*/
int sechdefrev(term t, term arg, term *next, char *reason)
/* 1 / cosh u = sech u      */
{ int err = recip_aux(COSH, SECH, t,next);
  if(err)
     return 1;
  strcpy(reason, "$1 / cosh u = sech u$");
  return 0;
}
/*________________________________________________________________________*/
int cschdef(term t, term arg, term *next, char *reason)
/* csch u = 1 / sinh u      */
{ term u;
  if(FUNCTOR(t) == '^' && FUNCTOR(ARG(0,t)) == CSCH)
     { *next = make_power(reciprocal(sinh1(ARG(0,ARG(0,t)))),ARG(1,t));
       HIGHLIGHT(*next);
       strcpy(reason,"$csch u= 1/sinh u$");
       return 0;
     }
  if(FUNCTOR(t) != CSCH)
     return 1;
  u = ARG(0,t);
  *next = reciprocal(sinh1(u));
  HIGHLIGHT(*next);
  strcpy(reason,"$csch u= 1/sinh u$");
  return 0;
}

/*________________________________________________________________________*/
int cschdefrev(term t, term arg, term *next, char *reason)
/* 1 / sinh u = csch u      */
{ int err = recip_aux(SINH, CSCH, t,next);
  if(err)
     return 1;
  strcpy(reason, "$1 / sinh u = csch u$");
  return 0;
}
/*________________________________________________________________________*/
int tanhsqplussechsq(term t, term arg, term *next, char *reason)
/* tanh^2 u + sech^2 u = 1    */
{ term lhs,a;
  int err;
  lhs = sum(make_power(tanh1(var0),two),make_power(sech1(var0),two));
  err = match(t,lhs,one,&a,next);  /* instantiate a and *next */
  if(err)
     { destroy_term(lhs);
       return 1;
     }
  HIGHLIGHT(*next);
  strcpy(reason,"$$tanh^2 u + sech^2 u = 1$$");
  return 0;
}
/*________________________________________________________________________*/
int tanhsqtosechsq(term t, term arg, term *next, char *reason)
/* tanh^2 u = 1 - sech^2 u    */
{ term u,n,v,q,m;
  if(FUNCTOR(t) != '^' || !INTEGERP(ARG(1,t)) || !ISEVEN(ARG(1,t)))
     return 1;
  n = ARG(1,t);
  u = ARG(0,t);
  if(FUNCTOR(u) != TANH)
     return 1;
  v = ARG(0,u);
  strcpy(reason,"$$sech^2 u = 1-tanh^2 u$$");
  q = sum(one,tnegate(make_power(sech1(v),two)));
  if(equals(n,two))
     { *next = q;
       HIGHLIGHT(*next);
       return 1;
     }
  value(make_fraction(n,two),&m);
  *next = make_power(q,m);
  HIGHLIGHT(*next);
  return 0;
}

/*________________________________________________________________________*/
int sechsqtotanhsq(term t, term arg, term *next, char *reason)
/* sech^2 u = 1 - tanh^2 u    */
{ term u,n,v,q,m;
  if(FUNCTOR(t) != '^' || !INTEGERP(ARG(1,t)) || !ISEVEN(ARG(1,t)))
     return 1;
  n = ARG(1,t);
  u = ARG(0,t);
  if(FUNCTOR(u) != SECH)
     return 1;
  v = ARG(0,u);
  strcpy(reason,"$$sech^2 u = 1-tanh^2 u$$");
  q = sum(one,tnegate(make_power(tanh1(v),two)));
  if(equals(n,two))
     { *next = q;
       HIGHLIGHT(*next);
       return 1;
     }
  value(make_fraction(n,two),&m);
  *next = make_power(q,m);
  HIGHLIGHT(*next);
  return 0;
}
/*________________________________________________________________________*/
int tanhln(term t, term arg, term *next, char *reason)
/* tanh(ln u) = (1-u^2)/(1+u^2) */
{ term u,v;
  if(FUNCTOR(t) != TANH)
     return 1;
  if(FUNCTOR(ARG(0,t)) != LN)
     return 1;
  u = ARG(0,ARG(0,t));
  copy(u,&v);  /* avoid DAGs */
  *next = make_fraction(sum(one,tnegate(square2(u))), sum(one,square2(v)));
  HIGHLIGHT(*next);
  strcpy(reason,"$$tanh(ln u) = (1-u^2)/(1+u^2)$$");
  return 0;
}
/*________________________________________________________________________*/
int exptohyper1(term t, term arg, term *next, char *reason)
/* e^x = cosh x + sinh x */
{ term x,x2;
  if(FUNCTOR(t) != '^')
     return 1;
  if(!equals(ARG(0,t),eulere))
     return 1;
  x = ARG(1,t);
  copy(x,&x2);
  *next = sum(cosh1(x), sinh1(x2));
  HIGHLIGHT(*next);
  strcpy(reason,"$$e^x = cosh x + sinh x$$");
  return 0;
}

/*________________________________________________________________________*/
int exptohyper2(term t, term arg, term *next, char *reason)
/* e^-x = cosh x - sinh x */
{ term x,x2;
  if(FUNCTOR(t) != '^')
     return 1;
  if(!equals(ARG(0,t),eulere))
     return 1;
  if(NEGATIVE(ARG(1,t)))
     x = ARG(0,ARG(1,t));
  else if(FRACTION(ARG(1,t)) && NEGATIVE(ARG(0,ARG(1,t))))
     x = make_fraction(ARG(0,ARG(0,ARG(1,t))),ARG(1,ARG(1,t)));
  else
     return 1;
  copy(x,&x2);
  *next = sum(cosh1(x), tnegate(sinh1(x2)));
  HIGHLIGHT(*next);
  strcpy(reason,"$$e^(-x) = cosh x - sinh x$$");
  return 0;
}

/*________________________________________________________________*/
int coshdefrev(term t, term arg, term *next, char *reason)
/* (e^t+e^(-t))/2=cosh t */
{ int err;
  term u;
  if(!FRACTION(t))
     return 1;
  if(!equals(ARG(1,t),two))
     return 1;
  if(FUNCTOR(ARG(0,t)) != '+' || ARITY(ARG(0,t)) != 2)
     return 1;
  err = coshdefrev2(ARG(0,t),arg,&u,reason);
  if(err)
     return 1;
  *next = ARG(1,u);  /* because u = 2 cosh t */
  HIGHLIGHT(*next);
  RELEASE(u);
  strcpy(reason,"$$(e^t+e^(-t))/2=cosh t$$");
  return 0;
}

/*________________________________________________________________*/
int sinhdefrev(term t, term arg, term *next, char *reason)
/* (e^t+e^(-t))/2=sinh t */
{ int err;
  term u,denom;
  if(!FRACTION(t))
     return 1;
  if(FUNCTOR(ARG(0,t)) != '+' || ARITY(ARG(0,t)) != 2)
     return 1;
  denom = ARG(1,t);
  if(!equals(denom,two))
     return 1;
  err = sinhdefrev2(ARG(0,t),arg,&u,reason);
  if(err)
     return 1;
  *next = ARG(1,u);  /* because u = 2 sinh t */
  HIGHLIGHT(*next);
  RELEASE(u);
  strcpy(reason,"$$(e^t+e^(-t))/2=sinh t$$");
  return 0;
}

/*________________________________________________________________*/
int sinhsqplus1(term t, term arg, term *next, char *reason)
/* sinh^2 + 1 = cosh^2 */
{ term lhs,a;
  int err;
  lhs = sum(make_power(sinh1(var0),two),one);
  err = match(t,lhs,make_power(cosh1(var0),two),&a,next);  /* instantiate a and *next */
  if(err)
     { destroy_term(lhs);
       return 1;
     }
  HIGHLIGHT(*next);
  strcpy(reason,"$$sinh^2 u + 1 = cosh^2 u$$");
  return 0;
}

/*________________________________________________________________*/
int coshsqminus1(term t, term arg, term *next, char *reason)
/* cosh^2 - 1 = sinh^2 */
{ term lhs,a;
  int err;
  lhs = sum(make_power(cosh1(var0),two),minusone);
  err = match(t,lhs,make_power(sinh1(var0),two),&a,next);  /* instantiate a and *next */
  if(err)
     { destroy_term(lhs);
       return 1;
     }
  HIGHLIGHT(*next);
  strcpy(reason,"$$cosh^2 u - 1 = sinh^2 u$$");
  return 0;
}

/*________________________________________________________________*/
int oneminustanhsq(term t, term arg, term *next, char *reason)
/* 1 - tanh^2 = sech^2 */
{ term lhs,a;
  int err;
  lhs = sum(one,tnegate(make_power(tanh1(var0),two)));
  err = match(t,lhs,make_power(sech1(var0),two),&a,next);  /* instantiate a and *next */
  if(err)
     { destroy_term(lhs);
       return 1;
     }
  HIGHLIGHT(*next);
  strcpy(reason,"$$1 - tanh^2 u = sech^2 u$$");
  return 0;
}

/*________________________________________________________________*/
int oneminussechsq(term t, term arg, term *next, char *reason)
/* 1 - sech^2 = tanh^2 */
{ term lhs,a;
  int err;
  lhs = sum(one,tnegate(make_power(sech1(var0),two)));
  err = match(t,lhs,make_power(tanh1(var0),two),&a,next);  /* instantiate a and *next */
  if(err)
     { destroy_term(lhs);
       return 1;
     }
  HIGHLIGHT(*next);
  strcpy(reason,"$$1 - sech^2 u = tanh^2 u$$");
  return 0;
}

/*___________________________________________________________________*/
int sinhasinh(term t, term arg, term *next, char *reason)
/* sinh (asinh x) = x */
{ if(FUNCTOR(t) != SINH) return 1;
  t = ARG(0,t);
  if(FUNCTOR(t) != ASINH) return 1;
  *next = ARG(0,t);
  HIGHLIGHT(*next);
  strcpy(reason,"$sinh(asinh x) = x$");
  return 0;
}
/*___________________________________________________________________*/
int coshacosh(term t, term arg, term *next, char *reason)
/* cosh (acosh x) = x */
{ if(FUNCTOR(t) != COSH) return 1;
  t = ARG(0,t);
  if(FUNCTOR(t) != ACOSH) return 1;
  *next = ARG(0,t);
  HIGHLIGHT(*next);
  strcpy(reason,"$cosh(acosh x) = x$");
  return 0;
}
/*___________________________________________________________________*/
int tanhatanh(term t, term arg, term *next, char *reason)
/* tanh (atanh x) = x */
{ if(FUNCTOR(t) != TANH) return 1;
  t = ARG(0,t);
  if(FUNCTOR(t) != ATANH) return 1;
  *next = ARG(0,t);
  HIGHLIGHT(*next);
  strcpy(reason,"$tanh(atanh x) = x$");
  return 0;
}
/*___________________________________________________________________*/
int cothacoth(term t, term arg, term *next, char *reason)
/* coth (acoth x) = x */
{ if(FUNCTOR(t) != COTH) return 1;
  t = ARG(0,t);
  if(FUNCTOR(t) != ACOTH) return 1;
  *next = ARG(0,t);
  HIGHLIGHT(*next);
  strcpy(reason,"$coth(acoth x) = x$");
  return 0;
}
/*___________________________________________________________________*/
int sechasech(term t, term arg, term *next, char *reason)
/* sinh (asinh x) = x */
{ if(FUNCTOR(t) != SECH) return 1;
  t = ARG(0,t);
  if(FUNCTOR(t) != ASECH) return 1;
  *next = ARG(0,t);
  HIGHLIGHT(*next);
  strcpy(reason,"$sech(asech x) = x$");
  return 0;
}
/*___________________________________________________________________*/
int cschacsch(term t, term arg, term *next, char *reason)
/* csch (acsch x) = x */
{ if(FUNCTOR(t) != CSCH) return 1;
  t = ARG(0,t);
  if(FUNCTOR(t) != ACSCH) return 1;
  *next = ARG(0,t);
  HIGHLIGHT(*next);
  strcpy(reason,"$csch(acsch x) = x$");
  return 0;
}

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists