830
Appendix A: System Routines — Math
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
push_simult
(continued)
Example:
This example solves a system of equations of order two (although it could
solve any order). The input matrix is stored in ‘A’ and the column vector is
stored in ‘B’. The result is left on the estack.
short i, j, order = 2;
EStackIndex mat_idx;
float A[] = {1.0,2.0,3.0,4.0};
float B[] = {5.0,6.0};
/* push A onto estack */
push_quantum (END_TAG);
for (i = order-1; i >= 0; i--) {
push_quantum (END_TAG);
for (j = order-1; j >= 0; j--)
push_Float (A[i*order + j]);
push_quantum (LIST_TAG);
}
push_quantum (LIST_TAG);
mat_idx = top_estack;
/* push B onto estack */
push_quantum (END_TAG);
for (i = order-1; i >= 0; i--) {
push_quantum (END_TAG);
push_Float (B[i]);
push_quantum (LIST_TAG);
}
push_quantum (LIST_TAG);
/* Solve */
push_simult (mat_idx, top_estack, NULL_INDEX);