Appendix A: System Routines — Algebra Utilities
245
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
index_reductum_with_tag_base
Declaration:
EStackIndex
index_reductum_with_tag_base
(EStackIndex
i
,
Quantum
tag
, Boolean
exponent_must_be_1
)
Category(ies):
Algebra Utilities
Description:
Returns
i
or the index of the first reductum of the expression indexed by
i
whose lead term has a base beginning with
tag
. Returns NULL_INDEX if
there is no such term. If
exponent_must_be_1
is TRUE then the base’s
exponent must be 1. You can use this function together with
push_but_term
to push a “sum” of all but the first syntactic term
containing a base beginning with
tag
in the expression indexed by
i
.
Inputs:
i
— Index of the top tag of an internally-simplified
algebraic expression.
tag
— A primary tag.
exponent_must_be_1
— FALSE if the base can have an exponent
≠
1.
Outputs:
Returns
i
or the index of the first reductum of the expression indexed by
i
whose lead term has a base beginning with
tag
. Returns NULL_INDEX if
there is no such term.
Assumptions:
None
Side Effects:
None
Availability:
On AMS 2.02 and higher.
TI
-
89 / TI
-
92 Plus
Differences:
None
See Also: push_but_term, index_numeric_term, push_constant_terms,
push_nonconstant_terms, push_dependent_terms,
push_independent_terms
Example:
Boolean does_denom_have_sin2 (EStackIndex i)
/* Returns TRUE if the term indexed by i has a SIN2 sufficiently exposed in its
denominator to warrant putting that term + another term over a common denominator.
*/
{ EStackIndex j;
while (! IS_NUMBER_TAG (ESTACK (i)))
{ j = lead_factor_index (i);
if (EXPONENTIATION_TAG == ESTACK (j) &&
is_negative(next_expression_index(--j)) &&
index_reductum_with_tag_base (j, SIN2_TAG, FALSE) )
return TRUE;
i = remaining_factors_index (i);
}
return FALSE;
}