numeric_factor_index Function (ROM Call 0x2E7)

AMS 1.01 or higher estack.h

ESI numeric_factor_index (CESI ptr);

Searches factors in the expression for a numeric factor.

If ptr points to the MUL_TAG, which is a case when it points to an expression of form factor1 * factor2 * ... (i.e. if the expression is a product of simpler factors), numeric_factor_index returns the pointer to the eventual numeric factor in the expression. If the expression is a number, numeric_factor_index returns ptr (i.e. the pointer to the expression itself). If ptr does not point to the MUL_TAG (i.e. if the expression is not a product of simpler factors), or if there is not any numeric factors in the expression, lead_factor_index returns a pointer to a simple expression which consists only of the number 1 (floating point or integer, depending of whether the approximation mode is active or not).

Note: This function is not implemented to be very universal. TIOS always "reorganizes" expressions on such way that numeric factors are at the beginning of the expression (i.e. x*3 will be reorganized into 3*x), and this function assumes that the expression is organized on such way. This is the so-called "internal canonic" form, and such expressions always have at most one factor with a numeric tag, in which case it is the deepest factor. So, '3*x^2*y' contains a numeric factor (3), but '2*x+3' does not. Also, numeric factors in numerators and denominators are always simplified into a single numeric factor in internal canonic forms (so, the numeric factor of '6*x/(4*y)' after conversion to canonic form is 3/2. Fortunately, all expressions in arguments are always in internal canonic form. However, this is not true after push_parse_text function, nor after an evaluation using NG_rationalESI or NG_approxESI. In other words, results of these commands are not always "correctly" organized. To force converting an expression to the internal canonic form, always call push_internal_simplify after usage any of functions mentioned above.


Uses: next_expression_index, Float1Index, Integer1Index, primary_tag_list
Used by: did_push_anti_deriv, push_1st_derivative, push_abs, push_acosh, push_asin, push_asinh, push_atan, push_atanh, push_comdenom, push_csolve, push_czeros, push_def_int, push_desolve, push_exp, push_expand, push_factor, push_lim, push_max, push_min, push_nsolve, push_sign, push_sin2, push_solve, push_tan, push_zeros, push_equals, push_exponentiate, push_greater_than, push_greater_than_or_equals, push_less_than, push_less_than_or_equals, push_negate, push_not_equals, push_product, push_sum, get_ub, index_if_pushed_binomial_info, push_gcd_then_cofactors, push_make_proper, push_reciprocal, push_standardize, replace_top_with_post_simplified, ROM Call 0x48D