Sindbad~EG File Manager

Current Path : /usr/home/beeson/MathXpert/algebra/
Upload File :
Current File : /usr/home/beeson/MathXpert/algebra/algint.c

/* intlinear and intminus, placed in algebra.dll so
polyvalop can call them without making algebra.dll
depend on trigcalc.dll */

/*
M. Beeson, for MathXpert
11.3.91  Original date
2.27.98  modified
12.30.99 changed the reason string in intlinear
10.24.23  eliminated OEM symbol in favor of \int
*/
#include <string.h>
#include <assert.h>
#include "globals.h"
#include "ops.h"
#include "calc.h"
#include "factor.h"
#include "cancel.h"
#include "intsub.h"
#include "algaux.h"
#include "polynoms.h"
#include "order.h"
#include "integral.h"
#include "symbols.h"
#include "islinear.h"
#include "errbuf.h"
#include "autosimp.h"
#include "dispfunc.h"
#include "pvalaux.h"

/*_______________________________________________________________________*/
int intlinear(term t, term arg, term *next, char *reason)
{ term u,x,c,v;
  if(FUNCTOR(t) != INTEGRAL)
     return 1;
  u = ARG(0,t);
  x = ARG(1,t);
  if(FUNCTOR(u) == '*' || FUNCTOR(u) == '/')
     { twoparts(u,x,&c,&v);
       if(ONE(c))
          return 1;
       if(ARITY(t) == 2)  /* an indefinite integral */
          *next = product(c,integral(v,x));
       else if (ARITY(t)==4)  /* a definite integral */
          *next = product(c,definite_integral(v,x,ARG(2,t),ARG(3,t)));
      }
  else  /* functors other than * and / */
     return 1;
  HIGHLIGHT(*next);
  strcpy(reason, "$\\int cu dt = c\\int u dt$");
  return 0;
}
/*_______________________________________________________________________*/
int intminus(term t, term arg, term *next, char *reason)
{ term u,x;
  if(FUNCTOR(t) != INTEGRAL)
     return 1;
  u = ARG(0,t);
  x = ARG(1,t);
  if(FUNCTOR(u) != '-')
     return 1;
  if(ARITY(t) == 2)  /* an indefinite integral */
     *next = tnegate(integral(ARG(0,u),x));
  else if (ARITY(t)==4)  /* a definite integral */
     *next = tnegate(definite_integral(ARG(0,u),x,ARG(2,t),ARG(3,t)));
  HIGHLIGHT(*next);
  strcpy(reason,"\\int (-u) dt = -\\int u dt$");
  return 0;
}

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