| main_gen_var_index | Function (ROM Call 0x2E2)

AMS 1.01 or higher | estack.h

ESI main_gen_var_index (CESI ptr);

Searches an expression for a generalized variable.

main_gen_var_index is a variant of index_main_var, but it searches for a "generalized variable", which may also be a subexpression. For example, if the expression is `'sin(x)+y'`, index_main_var will return a pointer to `'x'`, but main_gen_var_index will return a pointer to `'sin(x)'`. Generalized variable can be an ordinary variable, the base of a noninteger power, or a kernel (like `'sin(x)'`), meaning any other irrational subexpression.
More precise, main_gen_var_index skips all ADD_TAG, MUL_TAG and POW_TAG tags, then stops at the first tag which is not equal to some of them. In addition to this, if the tag is POW_TAG, function next_expression_index will be called, to get access to the base of the power (note that "powers" cannot be "reorganized" on such way that constants are always in front of variables, because `'2^x'` and `'x^2'` are not the same expression). This implies that "main generalized variable" of a sum, a product or an integer power is equal to the main generalized variable of a lead term, a lead factor or a base respectively. Otherwise, main generalized variable is the expression itself. For example, main "generalized variables" of expressions `'sin(x)^2*y+ln(z)'`, `'3^(1/5)+2'` and `'(x+y)^(1/2)+x'` are `'sin(x)'`, `'3'` and `'x+y'` respectively.

Uses: next_expression_index, is_whole_number
Used by: did_push_anti_deriv, push_1st_derivative, push_comdenom, push_csolve, push_czeros, push_def_int, push_desolve, push_exp, push_expand, push_extended_prod, push_factor, push_floor, push_lim, push_max, push_min, push_nsolve, push_phase, push_sin2, push_solve, push_summation, push_zeros, did_push_to_polar, 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, push_to_cylin, push_to_sphere, get_ub, is_term_improper, push_gcd_then_cofactors, push_make_proper, push_poly_qr, push_standardize, push_var_kern_tail