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.
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.
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.
Executes TI-Basic '¶' function.
Executes TI-Basic 'abs' function.
Executes TI-Basic 'cos-1' function.
Executes TI-Basic 'cosh-1' function.
Executes TI-Basic 'approx' function.
Executes TI-Basic 'sin-1' function.
Executes TI-Basic 'sinh-1' function.
Executes TI-Basic 'tan-1' function.
Executes TI-Basic 'tanh-1' function.
Executes TI-Basic 'augment' function.
Executes TI-Basic 'ceiling' function.
Executes TI-Basic 'char' function.
Executes TI-Basic 'colDim' function.
Executes TI-Basic 'colNorm' function.
Executes TI-Basic 'nCr' function.
Executes TI-Basic 'comDenom' function.
Executes TI-Basic 'conj' function.
Executes TI-Basic 'cos' function.
Executes TI-Basic 'cosh' function.
Executes TI-Basic 'crossP' function.
Executes TI-Basic 'cSolve' function.
Please see push_czeros entry for an important note for all solver ROM calls.
Executes TI-Basic 'cumSum' function.
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.
Executes TI-Basic 'ò' function.
Executes TI-Basic 'getDenom' function.
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.
Executes TI-Basic 'deSolve' function.
Please see push_czeros entry for an important note for all solver ROM calls.
Executes TI-Basic 'det' function.
Executes TI-Basic 'diag' function.
Executes TI-Basic 'dim' function.
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
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
Executes TI-Basic 'dotP' function.
Executes TI-Basic 'eigVc' function.
Executes TI-Basic 'eigVl' function.
Executes TI-Basic 'e^' function.
Executes TI-Basic 'expand' function.
Executes TI-Basic 'Õ' function.
Executes TI-Basic 'factor' function.
Executes TI-Basic 'floor' function.
Executes TI-Basic 'fPart' function.
Executes TI-Basic 'gcd' function.
Executes TI-Basic 'getFold' function.
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).
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.
Executes TI-Basic 'getType' function.
Executes TI-Basic 'identity' function.
Executes TI-Basic 'imag' function.
Executes TI-Basic 'inString' function.
Executes TI-Basic 'gcd' function.
Executes TI-Basic 'lcm' function.
Executes TI-Basic 'iPart' function.
Executes TI-Basic 'intDiv' function.
Executes TI-Basic 'remain' function.
Executes TI-Basic 'isPrime' function.
Executes TI-Basic 'left' function.
Executes TI-Basic 'limit' function.
Executes TI-Basic 'list>mat' function.
Executes TI-Basic 'ln' function.
Executes TI-Basic 'log' function.
Executes TI-Basic 'mat>list' function.
Executes TI-Basic 'matNorm' function.
Executes TI-Basic 'max' function for a single matrix.
Executes TI-Basic 'max' function.
Executes TI-Basic 'fMax' function.
Please see push_czeros entry for an important note for all solver ROM calls.
Executes TI-Basic 'mean' function.
Executes TI-Basic 'median' function.
Executes TI-Basic 'mid' function.
Executes TI-Basic 'min' function for a single matrix.
Executes TI-Basic 'min' function.
Executes TI-Basic 'fMin' function.
Please see push_czeros entry for an important note for all solver ROM calls.
Executes TI-Basic 'mod' function.
Executes TI-Basic 'mRow' function.
Executes TI-Basic 'mRowAdd' function.
Executes TI-Basic 'newList' function.
Executes TI-Basic 'newMat' function.
Executes TI-Basic 'nInt' function.
Executes TI-Basic 'nSolve' function.
Executes TI-Basic '¶' function.
Executes TI-Basic 'getNum' function.
Executes TI-Basic 'ord' function.
Executes TI-Basic 'part' function.
Executes TI-Basic 'nPr' function.
Executes TI-Basic 'R>Pq' function for a complex number (?).
Executes TI-Basic 'product' function.
Executes TI-Basic 'ptTest' function.
Executes TI-Basic 'pxlTest' function.
Executes TI-Basic 'R>Pq' function (?).
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
Executes TI-Basic 'randMat' function.
Executes TI-Basic 'randNorm' function.
Executes TI-Basic 'randPoly' function.
Executes TI-Basic 'real' function.
Executes TI-Basic 'R>Pq' function.
Executes TI-Basic 'rref' function.
Executes TI-Basic 'right' function.
Executes TI-Basic 'rotate' function.
Executes TI-Basic 'round' function.
Executes TI-Basic 'ref' function.
Executes TI-Basic 'rowAdd' function.
Executes TI-Basic 'rowDim' function.
Executes TI-Basic 'rowNorm' function.
Executes TI-Basic 'rowSwap' function.
Executes TI-Basic 'seq' function.
Executes TI-Basic 'setFold' function.
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:
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:
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:
Executes TI-Basic 'shift' function.
Executes TI-Basic 'sign' function.
Executes TI-Basic 'simult' function.
Executes TI-Basic 'sin' and 'cos' functions.
Executes TI-Basic 'sin' function.
Executes TI-Basic 'sinh' function.
Executes TI-Basic 'solve' function.
Please see push_czeros entry for an important note for all solver ROM calls.
Executes TI-Basic 'Ö' function.
Executes TI-Basic 'stdDev' function.
Executes TI-Basic 'expr' function.
See also: push_string, push_parse_text
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
Executes TI-Basic 'subMat' function.
Executes TI-Basic 'sum' function.
Executes TI-Basic 'S' function.
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.
Executes TI-Basic 'tan' function.
Executes TI-Basic 'tanh' function.
Executes TI-Basic 'unitV' function.
Executes TI-Basic 'variance' function.
Executes TI-Basic 'when' function.
Executes TI-Basic 'zeros' function.
Please see push_czeros entry for an important note for all solver ROM calls.