232
Appendix A: System Routines — Algebra Utilities
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
compare_expressions
Declaration:
int
compare_expressions
(EStackIndex
i
, EStackIndex
j
)
Category(ies):
Algebra Utilities
Description:
Returns an int that is 0 if expressions indexed by
i
and
j
are equal in the
sense that they have the same structure, variables, function names, and
numbers that “compare equal.” A float and a rational number “compare
equal” if converting the rational number to a float produces an identical
number. Otherwise returns a positive int if expression indexed by
i
is more
main, or returns a negative int if the expression indexed by
i
is less main.
Glossing over details, variables are more main than symbolic constants
such as
p
, which are more main than numbers. If the user enters an
expression such as expand ( . . . , var) or integral ( . . . , var), then that
variable is most main. Otherwise, the 26 Roman 1-letter variables order
r>s> . . . >z>a>b> . . . >q, which order more main than all other variables,
which order alphabetically. Functions and operators are typically ordered
by recursively comparing their first arguments, with ties broken by
comparing their second arguments, etc., then finally comparing the
operators or functions, if necessary.
Examples:
i
indexes
j
indexes Compare expression returns
L
2.0
L
20
L
2.0
L
1
L
1
p
41
x41
xr
L
1
x ln(y) 1
x ln(x)
L
1
Inputs:
i
,
j
— Indices of the top tags of internally-simplified expressions.
Outputs:
Returns an int that is 0 if expressions indexed by
i
and
j
are equal in the
sense that they have the same structure, variables, function names, and
numbers that “compare equal.”
Assumptions:
None
Side Effects:
None
Availability:
All versions of the TI
-
89 / TI
-
92 Plus.
(continued)