246
Appendix A: System Routines — Algebra Utilities
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
index_rmng_factor
Declaration:
EStackIndex
index_rmng_factor
(EStackIndex
j
, EStackIndex
i
)
Category(ies):
Algebra Utilities
Description:
This function can be used to determine if the expression indexed by
j
is
identical to the one indexed by
i
or any of its syntactic factors. If so, you
can then use
push_but_factor
to form the cofactor of that factor.
Inputs:
i
,
j
— Index of the top tags of internally-simplified algebraic expressions.
Outputs:
Returns NULL_INDEX if the expression indexed by
j
is not identical to the
one indexed by
lead_factor_index
(
i
) or
lead_factor_index
(
remaining_factors_index
(
i
)) or
lead_factor_index
(
remaining_factors_index
(
remaining_factors_index
(
i
))), etc.
Otherwise returns the shallowest index
k
such that the expression indexed
by
j
is identical to the one indexed by
lead_factor_index
(
k
=
i
) or
lead_factor_index
(
k
=
remaining_factors_index
(
i
)) or
lead_factor_index
(
k
=
remaining_factors_index
(
remaining_factors_index
(
i
))), etc.
Assumptions:
None
Side Effects:
None
Availability:
All versions of the TI
-
89 / TI
-
92 Plus.
TI
-
89 / TI
-
92 Plus
Differences:
None
See Also: index_rmng_fctrs_start_fctr_tag, index_rmng_fctrs_start_base,
index_rmng_fctrs_start_base_tag
(
Beware: Their arguments are in the
opposite order!
)
Example:
push_quantum (10u);
push_quantum (EXP_TAG); /* exp(z) */
push_quantum (9u);
push_quantum (EXP_TAG); /* exp(y) */
push_quantum (MULTIPLY_TAG);
push_quantum (8u);
push_quantum (LN_TAG); /* ln(x) */
push_quantum (MULTIPLY_TAG);
i = top_estack; /* ln(x) * exp(y) * exp(z) */
push_quantum (9u);
push_quantum (EXP_TAG);
j = top_estack; /* exp(y) */
k = index_rmng_factor (j,i);
if (NULL_INDEX != k) push_but_factor(i,k); /* pushes ln(x) * exp(z) */