Routines for executing TI-Basic functions
Very few of the functions from this header file are documented as of now. Of
course, the ones which are undocumented have not been tested, either. It is
very likely that there are errors in this file, so use it with care.
However, we thought it might be a good idea to provide a header file for all
of the built-in TI-Basic functions which have a documented entry in the jump
table.
This way, you can easily search for particular symbolic math functions if you
need them. If you use a function from this header file, please document it,
too.
Many functions from this header file require their arguments to have some
specific format. They usually have to be internally simplified, which can be
achieved with the
push_internal_simplify
function from estack.h, and the result is an
internally simplified expression as well. For optional arguments, you can
usually pass NULL_INDEX.
If you do not want to accept the AMS dependency of these functions, you can
usually construct an expression using their appropriate tags, and then call
push_internal_simplify.
Note: All functions from this header file get parameters from the expression stack, so this header file must be used in conjunction with estack.h. You need to learn about the usage of the expression stack before using any function from this header file. All functions defined here execute particular TI-Basic functions. They sometimes may be useful to perform some operations which can not be implemented in C easily. But note that if you use functions from this header file too much, this will decrease the performance of your program significantly. In an extreme case, it will in fact decrease to that of a TI-Basic program! So use functions from this header file only if it is really necessary. Also note that these functions act exactly like the appropriate TI-Basic commands (including throwing errors if something is wrong), so the use of an error tracking mechanism from the error.h header file is highly recommended.
short did_push_anti_deriv(CESI expr, CESI var, short closed_form_only_flag); |
Executes TI-Basic 'ò' function.
did_push_anti_deriv integrates 'expr' with respect to variable 'var'. If the closed-form-only flag is TRUE, it pushes a result to the estack only if it can find a closed form integral. It returns TRUE if it pushed a result to the estack, FALSE otherwise.
short did_push_series(CESI expr, CESI var, CESI exporder, CESI exppt, short push_only_first_nonzero_term_flag); |
Executes TI-Basic 'taylor' function.
did_push_series does a Taylor series expansion of 'expr' with respect to variable 'var' about the point 'exppt' to order 'exporder'. If push_only_first_nonzero_term_flag is TRUE, it pushes only the first nonzero term. It returns TRUE if it pushed a result (not containing a SERIES_TAG) to the estack, FALSE otherwise.
void push_1st_derivative (CESI, CESI); |
Executes TI-Basic '¶' function.
void push_abs (CESI); |
Executes TI-Basic 'abs' function.
void push_acos (CESI); |
Executes TI-Basic 'cos-1' function.
void push_acosh (CESI); |
Executes TI-Basic 'cosh-1' function.
void push_approx (CESI); |
Executes TI-Basic 'approx' function.
void push_asin (CESI); |
Executes TI-Basic 'sin-1' function.
void push_asinh (CESI); |
Executes TI-Basic 'sinh-1' function.
void push_atan (CESI); |
Executes TI-Basic 'tan-1' function.
void push_atanh (CESI); |
Executes TI-Basic 'tanh-1' function.
void push_augment (CESI, CESI); |
Executes TI-Basic 'augment' function.
void push_ceiling (CESI); |
Executes TI-Basic 'ceiling' function.
void push_char (CESI); |
Executes TI-Basic 'char' function.
void push_coldim (CESI); |
Executes TI-Basic 'colDim' function.
void push_colnorm (CESI); |
Executes TI-Basic 'colNorm' function.
void push_comb (CESI, CESI); |
Executes TI-Basic 'nCr' function.
void push_comdenom (CESI, CESI); |
Executes TI-Basic 'comDenom' function.
void push_conj (CESI); |
Executes TI-Basic 'conj' function.
void push_cos (CESI); |
Executes TI-Basic 'cos' function.
void push_cosh (CESI); |
Executes TI-Basic 'cosh' function.
void push_cross_product (CESI, CESI); |
Executes TI-Basic 'crossP' function.
void push_csolve (CESI, CESI); |
Executes TI-Basic 'cSolve' function.
Please see push_czeros entry for an important note for all solver ROM calls.
void push_cumsum (CESI); |
Executes TI-Basic 'cumSum' function.
void push_czeros (CESI, CESI); |
Executes TI-Basic 'cZeros' function.
Important note for all solver ROM calls:
When czeros( ) is executed on the command line, the OS provides special treatment for the specified "variable of interest". Part of the "special treatment" is temporarily to promote the "variable of interest" to the top of the ordering. Directly calling push_czeros( ) bypasses this special treatment. This affects solver ROM calls such as push_zeros, push_solve, push_czeros, push_csolve, push_min, push_max, and push_desolve.
For example, the following code for attempting to find an inverse of sqrt(x/(1-x)) gives no solutions:
push_quantum(X_VAR_TAG); var = top_estack; push_difference(Integer1Index,var); expr = top_estack; push_quantum(X_VAR_TAG); divide_top(expr); push_sqrt(top_estack); //sqrt(x/(1-x)) push_zstr("solveaux"); top_estack--; solvevar = top_estack; //Auxiliary solve variable push_substitute_simplify(expr,var,solvevar); push_difference(top_estack,var); //(expr|x=solveaux)-x push_czeros(top_estack,solvevar);
The simplest and most reliable way around this is to do:
push_expression(var); push_expression(expr); push_quantum(CZEROS_TAG); push_simplify(top_estack);
The above information was obtained from TI.
void push_def_int (CESI, CESI, CESI, CESI); |
Executes TI-Basic 'ò' function.
void push_denominator (CESI); |
Executes TI-Basic 'getDenom' function.
void push_dense_poly_eval (ESI coeflist, ESI expr); |
Executes TI-Basic 'polyEval(' function.
The list 'coeflist' represents the coefficients of a polynomial in descending order. push_dense_poly_eval pushes the polynomial evaluated at 'expr'. 'expr' need not be a number, or even a variable.
void push_desolve (CESI); |
Executes TI-Basic 'deSolve' function.
Please see push_czeros entry for an important note for all solver ROM calls.
void push_determinant (CESI, CESI); |
Executes TI-Basic 'det' function.
void push_diag (CESI); |
Executes TI-Basic 'diag' function.
void push_dimension (CESI); |
Executes TI-Basic 'dim' function.
void push_div_dif_1c (ESI expr, ESI var, ESI h); |
Executes TI-Basic 'nDeriv(' function.
push_div_dif_1c pushes to the estack the 1st-order centered or symmetric difference of 'expr' with respect to variable 'var' with stepsize 'h'. You can obtain higher-order differences by repeated application, just as you can with derivatives.
See also: push_div_dif_1f
void push_div_dif_1f (ESI expr, ESI var, ESI h); |
Executes TI-Basic 'avgRC(' function.
push_div_dif_1f pushes to the estack the 1st-order forward difference of 'expr' with respect to variable 'var' with stepsize 'h'. You can obtain higher-order differences by repeated application, just as you can with derivatives.
See also: push_div_dif_1c
void push_dotproduct (CESI, CESI); |
Executes TI-Basic 'dotP' function.
void push_eigvc (CESI); |
Executes TI-Basic 'eigVc' function.
void push_eigvl (CESI); |
Executes TI-Basic 'eigVl' function.
void push_exp (CESI); |
Executes TI-Basic 'e^' function.
void push_expand (CESI, CESI, short); |
Executes TI-Basic 'expand' function.
void push_extended_prod (CESI, CESI, CESI, CESI); |
Executes TI-Basic 'Õ' function.
void push_factor (CESI, CESI, short); |
Executes TI-Basic 'factor' function.
void push_floor (CESI); |
Executes TI-Basic 'floor' function.
void push_fractional_part (CESI); |
Executes TI-Basic 'fPart' function.
void push_gcd_numbers (CESI, CESI); |
Executes TI-Basic 'gcd' function.
void push_getfold (void); |
Executes TI-Basic 'getFold' function.
void push_getkey (void); |
Executes TI-Basic 'getKey' function.
push_getkey pushes tke key code of a pressed key to the expression stack. It pushes 0 if no key is pressed. The pushed value is exactly the same as a value returned from the TI-Basic getKey function (it is mainly the same value as returned from ngetchx, but not always: for example, codes for arrow keys are different).
void push_getmode (CESI ModeNameString); |
Executes TI-Basic 'getMode' function.
push_getmode assumes that ModeNameString points to the tag of a string expression
(usually STR_TAG). If it points to a specific mode name
string, it pushes a new string containing the current setting for that mode to the expressions
stack. See push_setmode for a list of legal mode name strings.
If the mode name string is "ALL", push_getmode pushes a list of string pairs containing the
settings of all the modes to the expression stack. So, you can restore all mode settings
later at once using push_setmode.
void push_gettype (CESI); |
Executes TI-Basic 'getType' function.
void push_identity_mat (CESI); |
Executes TI-Basic 'identity' function.
void push_im (CESI); |
Executes TI-Basic 'imag' function.
void push_instring (CESI, CESI, CESI); |
Executes TI-Basic 'inString' function.
void push_integer_gcd (CESI, CESI); |
Executes TI-Basic 'gcd' function.
void push_integer_lcm (CESI, CESI); |
Executes TI-Basic 'lcm' function.
void push_integer_part (CESI); |
Executes TI-Basic 'iPart' function.
void push_integer_quotient (CESI, CESI); |
Executes TI-Basic 'intDiv' function.
void push_integer_remainder (CESI, CESI); |
Executes TI-Basic 'remain' function.
void push_is_prime (CESI); |
Executes TI-Basic 'isPrime' function.
void push_left (CESI, CESI); |
Executes TI-Basic 'left' function.
void push_lim (CESI, CESI, CESI, CESI); |
Executes TI-Basic 'limit' function.
void push_list_to_mat (CESI, CESI); |
Executes TI-Basic 'list>mat' function.
void push_ln (CESI); |
Executes TI-Basic 'ln' function.
void push_log10 (CESI); |
Executes TI-Basic 'log' function.
void push_mat_to_list (CESI); |
Executes TI-Basic 'mat>list' function.
void push_matnorm (CESI); |
Executes TI-Basic 'matNorm' function.
void push_max1 (CESI); |
Executes TI-Basic 'max' function for a single matrix.
void push_max2 (CESI, CESI); |
Executes TI-Basic 'max' function.
void push_max (CESI, CESI); |
Executes TI-Basic 'fMax' function.
Please see push_czeros entry for an important note for all solver ROM calls.
void push_mean (CESI); |
Executes TI-Basic 'mean' function.
void push_median (CESI); |
Executes TI-Basic 'median' function.
void push_mid (CESI, CESI, CESI); |
Executes TI-Basic 'mid' function.
void push_min1 (CESI); |
Executes TI-Basic 'min' function for a single matrix.
void push_min2 (CESI, CESI); |
Executes TI-Basic 'min' function.
void push_min (CESI, CESI); |
Executes TI-Basic 'fMin' function.
Please see push_czeros entry for an important note for all solver ROM calls.
void push_mod (CESI, CESI); |
Executes TI-Basic 'mod' function.
void push_mrow (CESI, CESI, CESI); |
Executes TI-Basic 'mRow' function.
void push_mrowadd (CESI, CESI, CESI, CESI); |
Executes TI-Basic 'mRowAdd' function.
void push_newlist (CESI); |
Executes TI-Basic 'newList' function.
void push_newmat (CESI, CESI); |
Executes TI-Basic 'newMat' function.
void push_nint (CESI, CESI, CESI, CESI); |
Executes TI-Basic 'nInt' function.
void push_nsolve (CESI, CESI); |
Executes TI-Basic 'nSolve' function.
void push_nth_derivative (CESI, CESI, CESI); |
Executes TI-Basic '¶' function.
void push_numerator (CESI); |
Executes TI-Basic 'getNum' function.
void push_ord (CESI); |
Executes TI-Basic 'ord' function.
void push_part (); |
Executes TI-Basic 'part' function.
void push_perm (CESI, CESI); |
Executes TI-Basic 'nPr' function.
void push_phase (CESI); |
Executes TI-Basic 'R>Pq' function for a complex number (?).
void push_prodlist (CESI); |
Executes TI-Basic 'product' function.
void push_pttest (CESI, CESI); |
Executes TI-Basic 'ptTest' function.
void push_pxltest (CESI, CESI); |
Executes TI-Basic 'pxlTest' function.
void push_r_cis (CESI, CESI); |
Executes TI-Basic 'R>Pq' function (?).
void push_rand (CESI Range); |
Executes TI-Basic 'rand' function.
push_rand pushes a random number on the expression stack. Range should
point either to END_TAG, or to an
integer expression. If Range points to
END_TAG, push_rand pushes a floating
point number between 0 and 1. If Range points to an integer value
n, push_rand pushes an integer number between 1 and
n if n is positive, or between -n and -1 if n is
negative.
Note: This function calls the TI-Basic random number generator, so it
has nothing to do with the random number generator from
stdlib.h (i.e. with the functions
rand,
random,
randomize, and
srand).
You can use the function
cmd_randseed (instead of
srand) to set the seed for the TI-Basic
random number generator. Note also that push_rand is much slower than the
random number generator implemented in
stdlib.h.
See also: cmd_randseed, rand, random
void push_randmat (CESI, CESI); |
Executes TI-Basic 'randMat' function.
void push_randnorm (CESI, CESI); |
Executes TI-Basic 'randNorm' function.
void push_randpoly (CESI, CESI); |
Executes TI-Basic 'randPoly' function.
void push_re (CESI); |
Executes TI-Basic 'real' function.
void push_rec_to_angle (CESI, CESI); |
Executes TI-Basic 'R>Pq' function.
void push_red_row_ech (CESI, CESI); |
Executes TI-Basic 'rref' function.
void push_right (CESI, CESI); |
Executes TI-Basic 'right' function.
void push_rotate (CESI, CESI); |
Executes TI-Basic 'rotate' function.
void push_round (CESI, CESI); |
Executes TI-Basic 'round' function.
void push_row_echelon (CESI, CESI); |
Executes TI-Basic 'ref' function.
void push_rowadd (CESI, CESI, CESI); |
Executes TI-Basic 'rowAdd' function.
void push_rowdim (CESI); |
Executes TI-Basic 'rowDim' function.
void push_rownorm (CESI); |
Executes TI-Basic 'rowNorm' function.
void push_rowswap (CESI, CESI, CESI); |
Executes TI-Basic 'rowSwap' function.
void push_sequence (CESI, CESI, CESI, CESI, CESI); |
Executes TI-Basic 'seq' function.
void push_setfold (CESI); |
Executes TI-Basic 'setFold' function.
void push_setgraph (CESI ModeNameString, CESI SettingString); |
Executes TI-Basic 'setGraph' function.
push_setgraph assumes that ModeNameString points to the tag of a string expression
(usually STR_TAG). It
sets the appropriate Graph mode to the new string pointed to by SettingString (it should
also point to the string tag), and pushes the previous setting string of that mode to the
expression stack. Possible mode strings and settings strings are listed in the table below:
Mode name | Possible settings |
"Coordinates" | "RECT", "POLAR", "OFF" |
"Graph Order" | "SEQ", "SIMUL" (not available in SEQUENCE, 3D or DIFF EQUATIONS graph mode) |
"Grid" | "OFF", "ON" (not available in 3D graph mode) |
"Axes" | "OFF", "ON" (not 3D graph mode) "OFF", "AXES", "BOX" (3D graph mode) |
"Leading Cursor" | "OFF", "ON" (not available in 3D graph mode) |
"Labels" | "OFF", "ON" |
"Style" | "WIRE FRAME", "HIDDEN SURFACE", "CONTOUR LEVELS", "WIRE AND CONTOUR", "IMPLICIT PLOT" (applies only to 3D graph mode) |
"Seq Axes" | "TIME", "WEB", "U1-VS-U2" (applies only to SEQUENCE graph mode) |
"DE Axes" | "TIME", "T-VS-Y'", "Y-VS-Y'", "Y1-VS-Y2", "Y1-VS-Y2'", "Y1'-VS-Y2'" (applies only to DIFF EQUATIONS graph mode) |
"Solution Method" | "RK", "EULER" (applies only to DIFF EQUATIONS graph mode) |
"Fields" | "SLPFLD", "DIRFLD", "FLDOFF" (applies only to DIFF EQUATIONS graph mode) |
void push_setmode (CESI ModeNameStringOrList, CESI SettingString); |
Executes TI-Basic 'setMode' function.
push_setmode assumes that ModeNameStringOrList points to the tag of a string expression
(usually to STR_TAG), or to a list expression (usually to
LIST_TAG). If it points to a string,
push_setmode sets the appropriate mode to the new string pointed to by SettingString (it should
also point to the string tag), and pushes the previous setting string of that mode to the
expression stack. Possible mode strings and settings strings are listed in the table below:
Mode name | Possible settings |
"Graph" | "FUNCTION", "PARAMETRIC", "POLAR", "SEQUENCE", "3D", "DIFF EQUATIONS" |
"Display Digits" | "FIX 0", "FIX 1", ..., "FIX 12", "FLOAT 1", "FLOAT 2", ..., "FLOAT 12" |
"Angle" | "RADIAN", "DEGREE" |
"Exponential Format" | "NORMAL", "SCIENTIFIC", "ENGINEERING" |
"Complex Format" | "REAL", "RECTANGULAR", "POLAR" |
"Vector Format" | "RECTANGULAR", "CYLINDRICAL", "SPHERICAL" |
"Pretty Print" | "OFF", "ON" |
"Split Screen" | "FULL", "TOP-BOTTOM", "LEFT-RIGHT" |
"Split 1 App" | "Home", "Y=Editor", "Window Editor", "Graph", "Table", "Data/Matrix Editor", "Program Editor", "Text Editor", "Numeric Solver" |
"Split 2 App" | "Home", "Y=Editor", "Window Editor", "Graph", "Table", "Data/Matrix Editor", "Program Editor", "Text Editor", "Numeric Solver" |
"Number of Graphs" | "1", "2" |
"Graph2" | "FUNCTION", "PARAMETRIC", "POLAR", "SEQUENCE", "3D", "DIFF EQUATIONS" |
"Exact/Approx" | "AUTO", "EXACT", "APPROXIMATE" |
"Base" | "DEC", "HEX", "BIN" |
void push_settable (CESI ModeNameString, CESI SettingString); |
Executes TI-Basic 'setTable' function.
push_settable assumes that ModeNameString points to the tag of a string expression
(usually STR_TAG). It
sets the appropriate table parameter to the new string pointed to by SettingString (it should
also point to the string tag), and pushes the previous setting string of that parameter to the
expression stack. Possible parameter name strings and settings strings are listed in the table below:
Parameter name | Possible settings |
"Graph <-> Table" | "OFF", "ON" |
"Independent" | "AUTO", "ASK" |
void push_shift (CESI, CESI); |
Executes TI-Basic 'shift' function.
void push_sign (CESI); |
Executes TI-Basic 'sign' function.
void push_simult (CESI, CESI, CESI); |
Executes TI-Basic 'simult' function.
void push_sin2 (CESI, CESI); |
Executes TI-Basic 'sin' and 'cos' functions.
void push_sin (CESI); |
Executes TI-Basic 'sin' function.
void push_sinh (CESI); |
Executes TI-Basic 'sinh' function.
void push_solve (CESI, CESI); |
Executes TI-Basic 'solve' function.
Please see push_czeros entry for an important note for all solver ROM calls.
void push_sqrt (CESI); |
Executes TI-Basic 'Ö' function.
void push_stddev (CESI); |
Executes TI-Basic 'stdDev' function.
void push_str_to_expr (CESI); |
Executes TI-Basic 'expr' function.
See also: push_string, push_parse_text
void push_string (CESI expr); |
Executes TI-Basic 'string' function.
push_string converts the expression pointed to by expr to a string and pushes this string on the expression stack. For example, after executing the code
push_shortint (100); push_quantum_pair (VAR_X_TAG, ADD_TAG); push_string (top_estack);
the string "x+100"
will be pushed on the expression stack.
See top_estack
and Tags for more info about this example.
Of course, expr may point to a string containing a variable name, but
it must not point to an ordinary string. Otherwise the string is truncated
at the first space (but not after the 8th character). If you only want to
push a string (not an expression converted to a string), a method which
always works would be:
push_expr_quantum (expr, STR_TAG);
See also: push_str_to_expr, push_zstr, display_statements
void push_submat (CESI, CESI, CESI, CESI, CESI); |
Executes TI-Basic 'subMat' function.
void push_sumlist (CESI); |
Executes TI-Basic 'sum' function.
void push_summation (CESI, CESI, CESI, CESI); |
Executes TI-Basic 'S' function.
void push_switch (CESI WinNum); |
Executes TI-Basic 'switch' function.
push_switch expects that WinNum points to an integer expression. If this integer is 0, push_switch pushes the active window number (1 for left or top window, 2 for right or bottom window) to the expression stack. If this integer is 1 or 2, push_switch activates window 1 or 2 and pushes the previously active window number to the expressions stack. If WinNum points to END_TAG, push_switch switches windows and pushes the previously active window number to the expression stack. Of course, window switching is ignored if the calculator is not displaying a split screen.
void push_tan (CESI); |
Executes TI-Basic 'tan' function.
void push_tanh (CESI); |
Executes TI-Basic 'tanh' function.
void push_unitv (CESI); |
Executes TI-Basic 'unitV' function.
void push_variance (CESI); |
Executes TI-Basic 'variance' function.
void push_when (CESI); |
Executes TI-Basic 'when' function.
void push_zeros (CESI, CESI); |
Executes TI-Basic 'zeros' function.
Please see push_czeros entry for an important note for all solver ROM calls.