Sindbad~EG File Manager

Current Path : /usr/home/beeson/MathXpert/automode/
Upload File :
Current File : /usr/home/beeson/MathXpert/automode/adjmod.c

/* Adjust the user model as required for each specific problem type.  It
has already been set up to the default model created by init_default model.
If user has loaded a customized model, this is not called.   */

/*
4.7.92 file created
1.13.99 modified
1.9.00 modified under _binomial_theorem
1.10.00 modified for differenceofnthpowers, differenceofnth2, sumofnthpowers
1.13.00 modified for complexform
2.25.00 modified for simplify_polynomial
6.17.00 deleted an obsolete comment and modified for infinite series, which aren't presently
        supported anyway.
12.1.00 modified for to set the status of lhopital to UNKNOWN on
        topic _diff_exp_from_defn
6.23.04 changed SeriesAdjustModel to series_adjust_model  
8.17.10 modified at line 680 to keep writeaspoly out of Term Selection menu on simple topics  
5.24.13 moved series_adjust_model here and made it static, removed include seropdef.h   
6.8.13  adjusted the status of writeaspoly 
6.17.13 changed simplify_polynomial to simplify_polynomials, and removed dead topics
*/

#include <assert.h>
#include <string.h>
#include "globals.h"
#include "tdefn.h"
#include "operator.h"
#include "checkarg.h"
#include "ops.h"
#include "trig.h"
#include "calc.h"
#include "symbols.h"
#include "series.h"


static void basic_algebra(void);
static  void series_adjust_model(int currenttopic);

/*______________________________________________________________________*/
void adjust_model(int currenttopic)

/* adjust the user model according  to the topic */
/* model is the user model, currenttopic the chosen topic */

{ aflag arithflag = get_arithflag();
  if(GRAPH_TOPIC(currenttopic))
      return;   /* for graphing the user model is not relevant */
  if(LINEAR_ALGEBRA_TOPIC(currenttopic) || /* _solve_linear_eqn to _cramers_rule */
     ALGEBRA2_TOPIC(currenttopic)  /* _simplify to _verify_alg2_identity */
    )
     { basic_algebra();
       set_status(polyvalop,LEARNING);
       set_status(complexpowers,LEARNING);
       set_status(coshdef,UNKNOWN);  /* used to control display of exptohyper1 */
       set_status(sinhdef, UNKNOWN);
       set_status(writeaspoly,LEARNING);
       switch(currenttopic)
          { case _solve_linear_eqn:
               set_status(cancelfactor,UNKNOWN);
               set_status(solvelinear, LEARNING);
               set_status(addeqn, KNOWN);  /* this makes it collect terms and
                                              do arithmetic when adding terms */
               set_status(subeqn, KNOWN);
               set_status(rootpowerexp,LEARNING);
               set_status(powerrootexp,LEARNING);
               set_status(powersqrtexp,LEARNING);
               break;
            case _eqns_by_substitution:
               set_status(commondenomandsimp,KNOWN);
               set_status(polyvalop,WELLKNOWN);
               break;
            case _eqns_by_adding_eqns:
               set_status(commondenomandsimp,KNOWN);
               /* so coefficients like 4/sqrt 3 + sqrt 3 get simplified quickly */
               break;
            case _eqns_in_matrix_form:
               set_status(matrixform,KNOWN);
               set_status(dividebymatrix,UNKNOWN);
               set_status(commondenomandsimp,KNOWN);
               break;
            case _gauss_jordan:
               set_status(matrixform,KNOWN);
               set_status(multbyidentity,KNOWN);
               set_status(dividebymatrix,UNKNOWN);
               set_status(commondenomandsimp,KNOWN);
               break;
            case _eqns_by_matrix_inverse:
               set_status(matrixform,KNOWN);
               set_status(multiplymatrices,KNOWN);
               set_status(dividebymatrix,KNOWN);
               set_status(exactmatrixinverse,KNOWN);
               set_status(commondenomandsimp,KNOWN);
               break;
            case _cramers_rule:
               set_status(cramersrule,KNOWN);
               set_status(commondenomandsimp,KNOWN);
               break;
            case _simplify:
               set_status(collectpowers,KNOWN);
               set_status(collectall,KNOWN);
               set_status(multiplyoutandsimp,KNOWN);
               break;
            case _simple_commondenom:
               set_status(commondenom,LEARNING);
               set_status(commondenom2,LEARNING);
               set_status(commondenomandsimp,LEARNING);
               set_status(commondenomandsimp2,LEARNING);
               arithflag.comdenom = 0;
               set_status(rootpowerexp,LEARNING);
               set_status(powerrootexp,LEARNING);
               set_status(powersqrtexp,LEARNING);

               break;
            case _advanced_commondenom:
                   /* can do it in one step when factoring not required */
               set_status(commondenom,KNOWN);
               set_status(commondenom2,KNOWN);
               set_status(commondenomandsimp,LEARNING);
               set_status(commondenomandsimp2,LEARNING);
               set_status(collectpowers,KNOWN);
               set_status(distriblaw,KNOWN);
                   /* causes distriblaw to collect powers */
               set_status(multiplyoutandsimp,KNOWN);
               break;
            case _compound_fractions:
               set_status(invertandmultiply,LEARNING);
               set_status(compoundfractions1,LEARNING);
               set_status(compoundfractions2,LEARNING);
               set_status(compoundfractions3,LEARNING);
               set_status(compoundfractions4,LEARNING);
                 /* turn arithmetic way down; see explanation
                    under _numerical_compound_fractions
                 */
               memset(&arithflag,0,sizeof(aflag));
               arithflag.varadd = 1;
               set_status(rootpowerexp,LEARNING);
               set_status(powerrootexp,LEARNING);
               set_status(powersqrtexp,LEARNING);
               break;
            case _simple_exponents:
               set_status(collectpowers,LEARNING);
                   /* fall-through, no break */
            case _simplify_polynomials:        /* fall-through */
               /* This is algebra 2, so don't set multiplyout to LEARNING */
            case _simplify_roots_and_powers:   /* fall-through */
            case _simplify_roots_and_fractions: /* fall-through */
            case _simplify_rational_functions:
               set_status(multiplyoutandsimp,KNOWN);
               set_status(commondenomandsimp,KNOWN);
               set_status(commondenomandsimp2,KNOWN);
               set_status(distriblaw,KNOWN);
               set_status(rootofquotient,LEARNING);
               set_status(rootpowerexp,LEARNING);
               set_status(powerrootexp,LEARNING);
               set_status(powersqrtexp,LEARNING);
               set_status(writeaspoly,LEARNING);
               break;
            case _negative_exponents:   /* fall-through */
            case _eliminate_negative_exponents:
               arithflag.negexp = 0; /* don't evaluate negative exponents */
               arithflag.ratexp = 0; /* or rational exponents either      */
               arithflag.roots = 0;  /* don't evaluate  sqrt 25 but first make it  sqrt 5^2 */
               set_status(collectpowers,LEARNING);
               set_status(quotienttopower,LEARNING);
               set_status(eliminatenegexp,LEARNING);
               set_status(eliminatenegexpdenom,LEARNING);
               set_status(introducenegexp,LEARNING);
               set_status(introducenegexp1,LEARNING);
               set_status(negexpofquotient,LEARNING);
               set_status(rootpowerexp,LEARNING);
               set_status(powerrootexp,LEARNING);
               set_status(powersqrtexp,LEARNING);
               set_status(writeaspoly,KNOWN);
               break;
            case _radicals:
               arithflag.negexp = 0; /* don't evaluate negative exponents  */
               arithflag.ratexp = 0; /* or rational exponents either      */
               arithflag.roots = 0;  /* don't evaluate  sqrt 25 but first make it sqrt (5^2) */
               set_status(commondenom,KNOWN);
               set_status(commondenom2,KNOWN);
               set_status(commondenomandsimp,LEARNING);
               set_status(commondenomandsimp2,LEARNING);
               set_status(collectpowers,KNOWN);
               set_status(distriblaw,KNOWN);
                   /* causes distriblaw to collect powers */
               set_status(multiplyoutandsimp,KNOWN);
               set_status(writeaspoly,KNOWN);
               break;
            case _absolute_value:
               arithflag.comdenom = 1;
               set_status(polyvalop,WELLKNOWN);
               set_status(quadraticformula,WELLKNOWN);
               set_status(solvelinear,WELLKNOWN);
               set_status(writeaspoly,KNOWN);
               break;
            case _fractional_exponents:  /* fall through */
            case _eliminate_fractional_exponents:
               arithflag.negexp = 0; /* don't evaluate negative exponents  */
               arithflag.ratexp = 0; /* or rational exponents either      */
               arithflag.roots = 0;  /* don't evaluate  sqrt 25 but first make it  sqrt 5^2 */
               set_status(collectpowers,LEARNING);
               set_status(exponenttoroot,LEARNING);
               set_status(quotienttopower,LEARNING);
               set_status(sqrtexp,LEARNING);
               set_status(rootexp,LEARNING);
               set_status(rootpowerexp,LEARNING);
               set_status(powerrootexp,LEARNING);
               set_status(powersqrtexp,LEARNING);
               set_status(writeaspoly,KNOWN);
               break;
            case _factor_by_grouping: /* fall-through */
            case _factor_quadratics:
               set_status(factorquadratic,LEARNING);
               break;
            case _quadratic_formula: break;
            case _complete_the_square: break;
            case _solve_quadratic_equation: break;
            case _advanced_factoring:
               set_status(quadraticformula,WELLKNOWN);
               set_status(differenceofnthpowers,LEARNING);
               set_status(sumofnthpowers,LEARNING);
               set_status(differenceofnth2, LEARNING);
               break;
            case _solve_higher_degree_equation:
               set_status(quadraticformula,WELLKNOWN);
               set_status(solvelinear,WELLKNOWN);
               set_status(polyvalop,WELLKNOWN);
               set_status(writeaspoly,KNOWN);
               break;
            case _solve_rational_equation:
               set_status(quadraticformula,WELLKNOWN);
               set_status(solvelinear,LEARNING);
               set_status(polyvalop,WELLKNOWN);
               set_status(writeaspoly,KNOWN);
               break;
            case _solve_root_equation:
               set_status(quadraticformula,WELLKNOWN);
               set_status(solvelinear,WELLKNOWN);
               set_status(polyvalop,WELLKNOWN);
               set_status(writeaspoly,KNOWN);
               set_status(powertopower,KNOWN);  // added 4.25.24 
               break;
            case _solve_fractions_and_roots:
               set_status(quadraticformula,WELLKNOWN);
               set_status(solvelinear,WELLKNOWN);
               set_status(polyvalop,WELLKNOWN);
               set_status(writeaspoly,KNOWN);
               break;
            case _solve_linear_inequality:  /* under Algebra 2 */
               set_status(cancelfactor,UNKNOWN);
               set_status(solvelinear, LEARNING);
               break;
            case _solve_polynomial_inequality:  /* fall through */
            case _solve_rational_inequality:    /* fall through */
            case _solve_root_inequality:
               set_status(polyvalop,WELLKNOWN);
               set_status(quadraticformula,WELLKNOWN);
               set_status(solvelinear,WELLKNOWN);
               set_status(completethesquare,WELLKNOWN);
               set_status(writeaspoly,KNOWN);
               break;
            case _simplify_any_function:  /* fall through */
            case _verify_alg2_identity:   /* fall through */
            case _cubic_one_root:         /* fall through */
               set_status(commondenom,KNOWN);
               set_status(commondenom2,KNOWN);
               set_status(commondenomandsimp,KNOWN);
               set_status(commondenomandsimp2,KNOWN);
               set_status(writeaspoly,KNOWN);
               break;
            case _solve_equation:
               set_status(commondenom,KNOWN);
               set_status(commondenom2,KNOWN);
               set_status(commondenomandsimp,KNOWN);
               set_status(commondenomandsimp2,KNOWN);
               set_status(polyvalop,KNOWN);
               set_status(writeaspoly,KNOWN);
               break;
            default: assert(0);
          }

       if(currenttopic >= _simplify_rational_functions)
          { set_status(multiplyout,WELLKNOWN);
               /* causes mvpolymult to be used so terms are collected */
             set_status(writeaspoly,KNOWN);
          }
       if(currenttopic >= _simple_factoring)
          { set_status(collectpowers,WELLKNOWN);
            set_status(collectall,WELLKNOWN);
            set_status(multiplyoutandsimp,WELLKNOWN);
            set_status(distriblaw,WELLKNOWN);
          }
       set_arithflag(arithflag);
       return;
     }
  else if(TRIG_TOPIC(currenttopic))
     { set_status(collectpowers,WELLKNOWN);
       set_status(multiplyout,WELLKNOWN);
       set_status(collectall,WELLKNOWN);
       set_status(multiplyoutandsimp,WELLKNOWN);
       set_status(commondenomandsimp,WELLKNOWN);
       set_status(commondenomandsimp2,KNOWN);
       set_status(distriblaw,KNOWN);   /* causes distriblaw to collect powers */
       set_status(complexpowers,LEARNING);
       set_status(writeaspoly,KNOWN);
       basic_algebra();
       switch(currenttopic)
          { case _evaluate_trig:
               break;
            case _basic_trig:
               break;
            case _trig_addition:
               set_status(polyvalop,WELLKNOWN);
               break;
            case _double_angle:
              set_status(polyvalop,WELLKNOWN);
               break;
            case _half_angle:
               set_status(polyvalop,WELLKNOWN);
               break;
            case _trig_product:
               set_status(polyvalop,WELLKNOWN);
               break;
            case _trig_factor:
               set_status(polyvalop,WELLKNOWN);
               break;
            case _trig_identities:
               break;
            case _inverse_trig_functions:
               set_status(polyvalop,WELLKNOWN);
               /* to get algebraic numerical expressions done in one step
                  that otherwise involve a lot of thrashing around. */
               break;
            case _simple_trig_eqn:
               set_status(solvelinear,WELLKNOWN);
               break;
            case _complex_arithmetic:
               arithflag.complex = 0;
               set_status(polyvalop,LEARNING);
            case _polar_form:
               set_status(rectangulartopolar,LEARNING);
               set_status(polyvalop,LEARNING);
               break;
            case _complex_roots:  /* fall through */
            case _de_moivre:
               set_status(rectangulartopolar,WELLKNOWN);
               set_status(polyvalop,WELLKNOWN);
               break;
            case _hyperfunctions:
            case _hyperfunctions2:
               set_status(polyvalop,WELLKNOWN);
               set_status(complexpowers,LEARNING);
               break;
            case _complex_quadratics:
               set_status(polyvalop,WELLKNOWN);
               set_status(complexpowers,LEARNING);
               set_status(complexform,WELLKNOWN);
               break;
            case _complex_trig:
               set_status(polyvalop,WELLKNOWN);
               set_status(complexpowers,LEARNING);
               break;
            case _complex_cubics:
               set_status(rectangulartopolar,WELLKNOWN);
               set_status(polyvalop,WELLKNOWN);
               set_status(complexform,WELLKNOWN);
            /*   set_status(cardan, LEARNING);
                 set_status(cardan2,LEARNING);
                 These lines would get the cubic formulas used, but we want
                 automode to show long solutions.
            */
               arithflag.roots = 1;
               arithflag.ratexp = 1;
               break;
            case _exponentials:
               break;
            case _simplify_logpower:
               break;
            case _logarithms: break;
            case _change_log_base: break;
            case _log_eqn: /* fall-through */
            case _exp_eqn: /* fall-through */
            case _trig_eqn:
               set_status(polyvalop,WELLKNOWN);
               set_status(solvelinear,WELLKNOWN);
               break;
            case _binomial_theorem:
               set_status(binomialtheorem,LEARNING);
               set_status(binomialcoeftofactorials,LEARNING);
               set_status(defnoffactorial,LEARNING);
               set_status(evaluatefactorial,LEARNING);
               set_status(writeaspoly,UNKNOWN);
               /* deliberate fall-through */
            case _sigma_notation:
               set_status(sigmatosum,LEARNING);
               set_status(sigmasum,LEARNING);
               set_status(minusoutofsigma,LEARNING);
               set_status(renameindexvariable,LEARNING);
               set_status(sumofi,LEARNING);
               set_status(sumofisquared,LEARNING);
               set_status(sumofallpowers,LEARNING);
               set_status(productofsigmas,LEARNING);
               set_status(showfirstterms,LEARNING);
               set_status(splitofflastterm,LEARNING);
               set_status(polyvalop,WELLKNOWN);
               break;
#if 0  /* obsolete topic */
            case _induction:
               set_status(selectinductionvariable,LEARNING);
               set_status(basiscase,LEARNING);
               set_status(inductionstep,LEARNING);
               set_status(useinductionhyp,LEARNING);
               set_status(thereforeasdesired,LEARNING);
               set_status(polyvalop,WELLKNOWN);
               break;
#endif
            case _trig_simplify:
               break;
            default: assert(0);
          }
       set_arithflag(arithflag);
       return;
     }

  else if(CALC1_TOPIC(currenttopic))
     { /* Calculus I topics */
       arithflag.complex = 0;    /* don't use complexarithmetic */
       set_status(complexpowers,LEARNING);
       set_status(collectpowers,WELLKNOWN);
       set_status(distriblaw,WELLKNOWN);  /* makes it use collectpowers */
       set_status(collectall,WELLKNOWN);
       set_status(multiplyout,WELLKNOWN);
       set_status(multiplyoutandsimp,WELLKNOWN);
       set_status(commondenomandsimp,WELLKNOWN);
       set_status(commondenomandsimp2,WELLKNOWN);
       set_status(limrationalfunction,LEARNING);
       set_status(limleadingterms,LEARNING);
       set_status(writeaspoly,KNOWN);
       set_status(sumleadingterm, UNKNOWN);
       if(currenttopic <= _difreview)
          set_status(derivop, LEARNING);
       else
          set_status(derivop, KNOWN);
       set_status(polyvalop,WELLKNOWN);
       set_status(solvelinear,WELLKNOWN);
       set_status(limvalop,LEARNING);
       set_status(simpleint,LEARNING);
       set_status(lhopital,UNKNOWN);
       set_status(limtlnt, UNKNOWN);
       if(currenttopic > _diff_polynomial)
          set_status(difpoly,KNOWN);
       else
          set_status(difpoly,LEARNING);
       if(currenttopic > _int_poly)
          set_status(intpoly,KNOWN);
       else
          set_status(intpoly,LEARNING);
       set_status(integratebyparts,LEARNING);
       set_status(logdif, UNKNOWN);  /* don't use logarithmic differentiation */
       if(currenttopic < _int_by_substitution)
          { set_status(intsub, UNKNOWN);
            set_status(choosesubstitution,UNKNOWN);
            set_status(integratebyparts,UNKNOWN);
            set_status(autointegratebyparts, UNKNOWN);
          }
       if(currenttopic == _int_by_substitution)
          { set_status(intsub, LEARNING);   /* get multistep integration-by-substitution */
            set_status(integratebyparts, UNKNOWN);
            set_status(autointegratebyparts, UNKNOWN);
          }
       if(currenttopic == _int_poly ||
          currenttopic == _simple_int
         )
          { set_status(intsub, UNKNOWN);   /* don't use it at all */
            set_status(integratebyparts,UNKNOWN);
          }
       if(currenttopic == _polynomial_limits)
          set_status(limpoly,LEARNING);
       else
          set_status(limpoly,KNOWN);
       basic_algebra();
       set_status(complexpowers,LEARNING);
       set_status(solvelinear,WELLKNOWN);
       switch(currenttopic)
          { case _polynomial_limits: break;
            case _simple_limits: break;
            case _lim_trig: break;
            case _rational_limits: break;
            case _limits_at_infinity: /* fall-through */
            case _infinite_limits:
               set_status(limrationalfunction,KNOWN);
               // set_status(limleadingterms,KNOWN);
               // set_status(sumleadingterm,LEARNING);
               break;
            case _diff_from_def: break;
            case _diff_basics: break;
            case _diff_polynomial: break;
            case _diff_trig: break;
            case _chain_rule: break;
            case _difreview: break;
            case _higher_order_diff: break;
            case _implicit_diff: break;
            case _related_rates:
               set_status(ssolveop,KNOWN);
               break;
            case _minmax:
               set_status(ssolveop,KNOWN);
               break;
            case _sigma_notation1:
               set_status(sigmatosum,LEARNING);
               set_status(sigmasum,LEARNING);
               set_status(minusoutofsigma,LEARNING);
               set_status(renameindexvariable,LEARNING);
               set_status(sumofi,LEARNING);
               set_status(sumofisquared,LEARNING);
               set_status(sumofallpowers,LEARNING);
               set_status(productofsigmas,LEARNING);
               set_status(showfirstterms,LEARNING);
               set_status(splitofflastterm,LEARNING);
               set_status(polyvalop,WELLKNOWN);
               break;
            case _int_poly:
               /* keep polyval from using the following operators */
               set_status(intminus,LEARNING);
               set_status(intsum,LEARNING);
               set_status(intlinear,LEARNING);
               break;
            case _simple_int: break;
            case _fundamental_theorem: break;
            case _int_by_substitution:
               set_status(choosesubstitution,LEARNING);
                /* get display of "Trying substitution..." */
               break;
            case _int_by_parts1:
               set_status(intsub,KNOWN);
               /* do integration by substitution in one step */
               break;
            case _intreview:
               set_status(intsub, KNOWN);
               set_status(integratebyparts, KNOWN);
               break;
            default: assert(0);
          }
       set_arithflag(arithflag);
       return;
     }
  else if(CALC2_TOPIC(currenttopic))
     { /* first the general setup for calculus II */
       arithflag.complex = 1;    /* use complexarithmetic */
       set_status(derivop, KNOWN);
       set_status(polyvalop,WELLKNOWN);
       set_status(complexpowers,LEARNING);
       set_status(solvelinear,WELLKNOWN);
       set_status(limvalop,LEARNING);
       set_status(difpoly,WELLKNOWN);
       set_status(ssolveop,KNOWN);
       set_status(writeaspoly,KNOWN);
       set_status(simpleint,LEARNING);  /* simple integral in one step */
       set_status(intsub,KNOWN);        /* integration by substitution in one step */
       set_status(integratebyparts,KNOWN);  /* last topic in Calc I    */
       if(currenttopic == _diff_exp_from_defn)
          set_status(lhopital, UNKNOWN);
          /* never use l'hopital when using the definition of derivative */
          /* Also, this status controls the use of rationalizefraction,
             which is needed to get the derivative of sqrt x */
       else
          set_status(lhopital,LEARNING);
       set_status(limtlnt, LEARNING);  /* reset to UNKNOWN on topic lhopital */
       set_status(limrationalfunction,KNOWN);
       set_status(limleadingterms,KNOWN);
       set_status(sumleadingterm, currenttopic > _limleadingterm ? KNOWN : LEARNING);
       set_status(collectpowers,WELLKNOWN);
       set_status(collectall,WELLKNOWN);
       set_status(multiplyout,WELLKNOWN);
       set_status(multiplyoutandsimp,WELLKNOWN);
       set_status(commondenomandsimp,WELLKNOWN);
       set_status(commondenomandsimp2,WELLKNOWN);
       set_status(logdif, LEARNING);
       set_status(integraltolimit, LEARNING);
       basic_algebra();
       if(SERIES_TOPIC(currenttopic))
          { series_adjust_model(currenttopic);
            return;
          }
       switch(currenttopic)
          { case _lim_exp:
               set_status(logdif,UNKNOWN);
               break;
            case _lhopitals_rule:
               set_status(logdif,UNKNOWN);
               set_status(limtlnt,UNKNOWN);
               break;
            case _limleadingterm:
               set_status(logdif,UNKNOWN);
               break;
            case _limits_any_function:
               set_status(logdif,UNKNOWN);
               break;
            case _diff_exp_from_defn:
               set_status(logdif,UNKNOWN);
               break;
            case _diff_exp:
               set_status(logdif,UNKNOWN);
               break;
            case _diff_logs:
               set_status(logdif, UNKNOWN);
               break;
            case _logarithmic_differentiation:
               set_status(logdif,LEARNING);
               break;
            case _diff_arctrig:
               break;
            case _diff_hyperbolic:
               break;
            case _diff_any_function:
               break;
            case _int_by_parts2:
               break;
            case _int_logs:
               break;
            case _trigpower_integrals:
               break;
            case _trig_substitution:
               break;
            case _integrate_rational_functions:
               break;
            case _rationalizing_substitutions:
               break;
            case _integrate_any_function:
               break;
            case _improper_integrals:
               break;
#if 0
            case _separable_ode:
               break;
            case _arc_length:
               break;
            case _area_revolution:
               break;
            case _volume_revolution:
               break;
#endif
            default: assert(0);
          }
       set_arithflag(arithflag);
       return;
     }
  else    /*  if(ALGEBRA1_TOPIC(currenttopic))  */
     { set_status(factorquadratic,LEARNING);
       set_status(quadraticformula,LEARNING);
       set_status(cancelfactor,UNKNOWN);
       set_status(solvelinear, LEARNING);
       set_status(commondenomandsimp,LEARNING);
       set_status(commondenomandsimp2,LEARNING);
       set_status(polyvalop,LEARNING);
       set_status(productofsqrts,LEARNING);  /* this means sortargs won't
                     be used automatically under the sqrt */
       set_status(sqrtexp,UNKNOWN);
       set_status(rootexp,UNKNOWN);
       set_status(sinhdef,UNKNOWN);
       set_status(coshdef,UNKNOWN);
       set_status(writeaspoly,UNKNOWN);
       if(currenttopic == _solve_linear_equation ||
          currenttopic == _alg1_linear_inequality
         )
          { set_status(addeqn,LEARNING);  /* It won't do arithmetic when adding */
            set_status(subeqn,LEARNING);
            set_status(addeqn1,LEARNING);
            set_status(addeqn2,LEARNING);
            set_status(subeqn1,LEARNING);
            set_status(subeqn2,LEARNING);
            set_status(multiplyoutandsimp, UNKNOWN);
                /* so it won't appear in Term Selection */
          }
       if(currenttopic != _numerical_radicals &&
          currenttopic != _alg1_radicals
         )
          set_status(rootofpower,LEARNING);
          /* this prevents selectops from showing sqrt x = root(2n,x^n) */
       if(currenttopic == _simplify_polynomials)
         set_status(orderfactors,LEARNING);
         /* forces a(b+c) to be executed literally,
            so x(2x^2+3) doesn't come out as 2x^3 + 3x */
       if(currenttopic == _numerical_exponents ||
          currenttopic == _alg1_exponents
         )
          set_status(collectpowers,LEARNING);
       else
          set_status(collectpowers,KNOWN);
       if(currenttopic <= _multiply_polynomials ||
          currenttopic == _add_numerical_fractions ||
          currenttopic == _simple_commondenom
          )
          { set_status(collectall,LEARNING);
            set_status(collectterms,LEARNING);
            set_status(multiplyoutandsimp,LEARNING);
            set_status(multiplyout,LEARNING);
            set_status(distriblaw,LEARNING);
            set_status(powertopower,LEARNING);
            set_status(regroupterms,LEARNING);
            set_status(writeaspoly, UNKNOWN);  // keep it out of Term Selection Menu
            arithflag.comdenom = 0;
            arithflag.fract = 0;
            arithflag.ratexp = 0;
            arithflag.roots = 0;
          }
       else
          {  set_status(distriblaw,KNOWN);
              /* causes distriblaw to collect powers */
            set_status(multiplyoutandsimp,KNOWN);
          }
       if(currenttopic == _add_numerical_fractions ||
          currenttopic == _simple_commondenom
          )
          { set_status(commondenom,LEARNING);
            set_status(commondenom2,LEARNING);
          }
       else
          { set_status(commondenom,KNOWN);
            set_status(commondenom2,KNOWN);
          }
       if(currenttopic == _simple_factoring)
          { set_status(differenceofnthpowers,LEARNING);
            set_status(differenceofnth2, LEARNING);
            set_status(sumofnthpowers,LEARNING);
          }
       if(currenttopic == _alg1_radicals)
          { arithflag.negexp = 0; /* don't evaluate negative exponents  */
            arithflag.ratexp = 0; /* or rational exponents either      */
            arithflag.roots = 0;  /* don't evaluate  sqrt 25 but first make it  sqrt 5^2 */
            set_status(commondenom,KNOWN);
            set_status(commondenom2,KNOWN);
          }
       if(currenttopic == _alg1_absolute_value)
          { arithflag.negexp = 0; /* don't evaluate negative exponents  */
            arithflag.ratexp = 0; /* or rational exponents either      */
            arithflag.roots = 0;  /* don't evaluate  sqrt 25 but first make it  (sqrt 5)^2 */
            arithflag.comdenom = 1;
          }
       if(currenttopic == _add_numerical_fractions ||
          currenttopic == _numerical_exponents ||
          currenttopic == _numerical_radicals ||
          currenttopic == _numerical_compound_fractions ||
          currenttopic == _alg1_compound_fractions
         )
          {  /* turn arithmetic way down */
             memset(&arithflag,0,sizeof(aflag));
             /* don't evaluate compound fractions, exponents,
                indexed sums, matrices, etc. Don't use complex
                arithmetic.  Pre_ops will take care that the operation
                arithmetic is used only on exponents with integer base
                and power; that operation will set arithflag.intexp
                to 1 temporarily.  But other operations such as cancel
                use arith also, and we don't want them doing exponents.
             */
             arithflag.varadd = 1;
          }
       set_arithflag(arithflag);
       return;
     }
}
/*______________________________________________________________________*/
static void basic_algebra(void)
/* set many simple Algebra I operators to well-known so they
will increase the step size of some other operators and will be
applied automatically in Algebra II, trig, and calculus. */

{  set_status(multbyzero,WELLKNOWN);
   set_status(multbyone,WELLKNOWN);
   set_status(bringminusout,WELLKNOWN);
   set_status(zeronum,WELLKNOWN);
   set_status(unitdenom,WELLKNOWN);
   set_status(recip,WELLKNOWN);
   set_status(multiplyfractions,WELLKNOWN);
   set_status(multiplyfractions2,WELLKNOWN);
   set_status(zeroexponent,WELLKNOWN);
   set_status(unitexponent,WELLKNOWN);
   set_status(zerobase,WELLKNOWN);
   set_status(unitbase,WELLKNOWN);
   set_status(producttopower,WELLKNOWN);
   set_status(quotienttopower,WELLKNOWN);
   set_status(minustopower,WELLKNOWN);
   set_status(powerofsqrt,WELLKNOWN);
   set_status(powerofroot,WELLKNOWN);
   set_status(cardan, UNKNOWN);
   set_status(cardan2, UNKNOWN);
}

/*____________________________________________________________________*/
static  void series_adjust_model(int currenttopic)
/* called from adjust_model in adjmod.c to finish the 
work of that function on series topics. */
{ aflag f = get_arithflag();
  f.sums = 1;  // evaluate sum(0,k,0,infinity) to 0 for example 
  set_arithflag(f);
  switch(currenttopic)
    { case _sum_series:
         break;
      case _integral_test:
         break;
      case _comparison_test:
         break;
      case _root_ratio_tests:
         break;
      case _power_series1:
         set_status(seriesintdif,KNOWN);
         set_status(seriesintdifdef,KNOWN);
         set_status(seriesdifint,KNOWN);
         set_status(oneplusxseries,KNOWN);
         set_status(oneminusxseries,KNOWN);
         set_status(lnseries,LEARNING);
         set_status(lnseriesminus,LEARNING);
         set_status(sinseries,LEARNING);
         set_status(cosseries,LEARNING);
         set_status(atanseries,LEARNING);
         set_status(negexpseries,LEARNING);
         set_status(xoveroneminusxseries,LEARNING);
         set_status(xoveroneplusxseries,LEARNING);
         set_status(oneoveroneplusxkseries,LEARNING);
         set_status(oneoveroneminusxkseries,LEARNING);
         set_status(xmoveroneminusxkseries,LEARNING);
         set_status(xmoveroneplusxkseries,LEARNING);
         break;
      case _power_series2:
         set_status(seriesintdif,KNOWN);
         set_status(seriesintdifdef,KNOWN);
         set_status(seriesdifint,KNOWN);
         set_status(oneplusxseries,KNOWN);
         set_status(oneminusxseries,KNOWN);
         set_status(lnseries,KNOWN);
         set_status(lnseriesminus,KNOWN);
         set_status(sinseries,KNOWN);
         set_status(cosseries,KNOWN);
         set_status(atanseries,KNOWN);
         break;
     } 
}



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