/*
 *	Integrate library
 *
 *	by Daniele Finocchiaro
 *	   Gianluca Marcoccia
 *
 *	 1.11.1994	v1.0	IPISA94
 *	  6.2.1995	v1.0a
 */

/*
 *	Integrates f() function in the range [a,b], using all needed
 *	evaluations by calling f().
 *	The algorithm tries to reach (*prec) precision digits.
 *	Int_function returns the approximation of the integral and
 *	in the (*prec) variable, the number of exstimated correct digits.
 *	(hopefully at least the value of (*prec) when the function
 *	 was called)
 */

double Int_function( double (*f)(double), double from, double to, int *prec);

/*	Integrates expression contained in `expr'.		
 */

double Int_string( char *expr, double from, double to, int *prec);


/*
 *	PARSER
 *
 *	To use this routine you have to:
 *	- include this file .h
 *	- call Parse_addfunction() to add the particular functions you use
 *	- call Parse_eval() or Parse_evalx() with a string containing
 *	  the expression
 *	- test Parse_error to see if evaluation ended with no errors
 */

double	Parse_eval(char *expr);		/* Expr: expression to evaluate */
double	Parse_evalx(char *expr, double x);	/* x: value for 'x' */
int	Parse_addfunction(char *name, double (*f)(double) );
					/* Add a new function, 0=OK */

extern int Parse_error;		/* 0: all OK			*/
				/* 1: Syntax error 		*/
				/* 2: Unbalanced parentheses 	*/
				/* 3: No expression present 	*/
				/* 4: Division by zero 		*/
				/* 5: Internal error 		*/
				/* 6: Undefined function 	*/
				/* 7: Wrong assignment 		*/


/*
 *	Simple Integrators library
 */

double Int_eq_points(int n, double h, double fx[]);
double Int_points(int n,double x[], double fx[]);

double Int_eq_points_p(int n, double h, double fx[], double partial[]);
double Int_points_p(int n,double x[], double fx[], double partial[]);
