| index_main_var | Function (ROM Call 0x2CF)

AMS 1.01 or higher | estack.h

ESI index_main_var (CESI ptr);

Searches an expression for a first encountered variable.

index_main_var returns the index of the first encountered variable in the expression pointed to by ptr. More precise, it repeatedly decreases value of ptr by one until the tag of a variable, a number or a symbolic constant (like pi) is reached. As expressions are usually organized in "internal canonic" form (see notes given with description of numeric_factor_index) in which all constants are always "below" variables on the stack, a variable will always be reached before any constant, except if there are not any variables in the expression (in this case, a pointer to a constant is returned). Obviously, this function is not reliable if the expression is not in the internal canonic form (see push_internal_simplify).

Uses: primary_tag_list
Used by: did_push_anti_deriv, push_1st_derivative, push_csolve, push_czeros, push_def_int, push_desolve, push_expand, push_factor, push_lim, push_max, push_min, push_nsolve, push_solve, push_zeros, push_equals, push_greater_than, push_greater_than_or_equals, push_less_than, push_less_than_or_equals, push_not_equals, get_ub, replace_top_with_post_simplified