+----------------------------------------------+
			|Library Estack_Lib by Florent Weber (FpgForce)|
			+----------------------------------------------+


--------------------------------------------------------------------------------------------------------------------------


I) What is Estack_Lib?
----------------------

Estack_Lib is a static library wich allows you to perform a lot of algebraic calculus.
It simplifies the manipulation of the estack.

--------------------------------------------------------------------------------------------------------------------------

II) How could I use Estack_Lib?
-------------------------------

1) First of all copy the files: estack_lib.h and estack_lib.a to your project folder.

	You must include the header (estack_lib.h) in your source code:

	#include "estack_lib.h"

2) Then for the compilation,

	If you usually use the command line:

	tigcc mysource.c estack_lib.a

	Or if you use the IDE just add the estack_lib.a to the archive file folder of your project.

Now you can access in your source code to every function of Estack_Lib.

--------------------------------------------------------------------------------------------------------------------------

III) Estack_Lib's functions
---------------------------

Important: the variable of the expression must be x ! (the VAR_X_TAG quantum)

1) Algebraic calculus:


a) integrate :
	
	void integrate (ESI function, ESI lower_bound, ESI upper_bound) ;
	
	This function integrates the function given as "function" between "lower_bound" and "upper_bound".
	The result is pushed onto the estack and is pointed by "top_estack".


b) differentiate_nth :

	void differentiate_nth (ESI function, unsigned short order) ;

	This function evaluates the differentiate of the function "function" at the order "order".
	The result is pushed onto the estack and is pointed by "top_estack".

	Example to calculate the differentiate second:
	differentiate_nth (function, 2) ;


c) anti_deriv_nth:

	short anti_deriv_nth (ESI function, unsigned short order) ;

	This function evaluate the anti-derivative of the function "function" at the order "order".
	The result is pushed onto the estack.


d) expand :

	void expand (ESI function) ;

	This function expands the expression "function".
	The result is pushed onto the estack and is pointed by "top_estack".


c) factor :

	void factor (ESI function) ;

	This function factors the expression "function".
	The result is pushed onto the estack and is pointed by "top_estack".


d) solve :

	void solve (ESI expr1, ESI expr2) ;

	This function solves the equation: expr1 = expr2 with respect of the variable x.
	The result is pushed onto the estack and is pointed by "top_estack".


e) zeros :

	void zeros (ESI function) ;

	This function solves the equation: function = 0.
	The result is pushed onto the estack as a list and is pointed by "top_estack".


f) czeros :

	void czeros (ESI function) ;

	This function solves in the complex domain the equation: function = 0.
	The result is pushed onto the estack as a list and is pointed by "top_estack".


g) limit :

	void limit (ESI function, ESI point, unsigned short direction) ;

	This function searches the limit of the function "function" at the point "point" (which could be
	a real or infinity, neginfinity) and at the direction "direction".

	"direction" can take these values:

	+-----------+------------------------------------------------+
	| direction |                   action                       |
	+-----------+------------------------------------------------+
	| LIM_LEFT  | Search the limit on the left of the "point"    |
	| LIM_POINT | Search the limit on the given "point"          |
	| LIM_RIGHT | Search the limit on the right of the "point"   |
	+-----------+------------------------------------------------+

	for example if you want the limit on 3 on the left you should do:

	limit (function, 3, -1) ;


h) desolve :

	void desolve (ESI function, ESI x, ESI y, BOOL condition) ;

	This function solves the differentiate equation of the function "function" with respect of (x,y)
	coordinates if "condition" is TRUE.


i) comdenom :

	void comdenom (ESI expr1, ESI expr2) ;

	This function gives the common denominator of the both expressions: expr1 and expr2
	The result is pushed onto the estack and is pointed by "top_estack".


j) propfrac :

	void propfrac (ESI function) ;

	This function transforms if possible the function "function" in a fraction.
	The result is pushed onto the estack and is pointed by "top_estack".


k) getdenom :

	void getdenom (ESI function) ;

	This function gets the denominator of the given function "function".
	The result is pushed onto the estack and is pointed by "top_estack".


l) texpand :

	void texpand (ESI function) ;

	This function expands the function if the given function "function" is trigonometric.
	The result is pushed onto the estack and is pointed by "top_estack".


m) tcollect :

	void tcollect (ESI function) ;

	This function collects the function if the given function "function" is trigonometric.
	The result is pushed onto the estack and is pointed by "top_estack".

n) taylor :

	void taylor (ESI function, ESI order) ;

	This function gives the taylor expansion of the given function "function" at the order "order".
	The result is pushed onto the estack and is pointed by "top_estack".


2) Advanced calculus :

	void tangent (ESI function, ESI point) ;

	This function evaluates the tangent of the function "function" at the point "point".
	The result is pushed onto the estack and is pointed by "top_estack".

3) list functions


a) sort_increase_ESI_list:

	void sort_increase_ESI_list (ESI array[], short offset, short dim) ;
	
	This function sort increasing a part of a ESI array "array" beginning at "offset" on a lenght of "dim".


b) sort_increase_ESI_list:

	void sort_decrease_ESI_list (ESI array[], short offset, short dim) ;
	
	This function sort decreasing a part of a ESI array "array" beginning at "offset" on a lenght of "dim".


c) estack_list_to_array:

	short estack_list_to_array (ESI start, ESI array[]) ;
	
	This function fetches a list on the estack beginning at "start" index and fill an array "array" with it.
	This function return the item count.


d) array_to_estack_list:

	void array_to_estack_list (ESI array[], short dim) ;
	
	This function push the "dim" items of an array "array" of expressions as a list on the estack.


4) io functions :


a) output_expr_xy :

	void output_expr_xy (int x, int y, ESI expression) ;

	This function displays the expression "expression" at the coordinates (x, y).
	This function acts on the IO screen who could be cleared using clear_io.


b) disp_str :

	void disp_str (char * str) ;

	This function is an equivalent of the TI-Basic's "disp" function, but only in order to display a string,
	you can't dispay an expression with it.
	See your calculator's guide for precisions about the "disp" function.
	This function acts on the IO screen who could be cleared using clear_io.


c) output_2d_expression :

	void output_2d_expr (ESI expression, short approx)

	This function is an equivalent of the TI-Basic's "pause" function used with an expression as argument.
	The expression is diplayed in pretty print and could be scrolled.
	If approx is TRUE, the expression is displayed in APPROX mode, if approx is FALSE, the expression is displayed
	in EXACT mode.
	This function acts on the IO screen who could be cleared using clear_io.

d) clear :

	void clear_io (void) ;

	This function clears the IO screen, it's an equivalent with the TI-Basic's "clrio" function.


5) Other :


a) str2ESI :

	void str2ESI (char * str) ;

	This function converts the string "str" into an ESI expression.
	Warning! The string "str" must contains a correct expression 
	The result is pushed onto the estack and is pointed by "top_estack".


b) decrease_estack :

	void decrease_estack (ESI old_top_estack) ;
	
	This function allows you to free the space you had use in your program:
	you just have to save the value of top_estack at the beginning of your prgrm and to pass it to
	decrease_estack at the end of your program.
	
	Example:
	beginning | ESI old_top_estack = top_estack ;
	          | ...
	end       | decrease_estack (old_top_estack) ;


6) Global Variables:

	ESTACK_LIB_VERSION_STR contains the version of the library.
	ESTACK_LIB_AUTHOR_STR contains the name of the author.

--------------------------------------------------------------------------------------------------------------------------

VI) Credits:
------------

Thanks to Onur Celebi, Spectras, Squale92, Kevin_Kofler for their help.