home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / misc / integra1_0a.lha / Integra / include / integra.h
Encoding:
C/C++ Source or Header  |  1995-02-06  |  1.7 KB  |  64 lines

  1. /*
  2.  *    Integrate library
  3.  *
  4.  *    by Daniele Finocchiaro
  5.  *       Gianluca Marcoccia
  6.  *
  7.  *     1.11.1994    v1.0    IPISA94
  8.  *      6.2.1995    v1.0a
  9.  */
  10.  
  11. /*
  12.  *    Integrates f() function in the range [a,b], using all needed
  13.  *    evaluations by calling f().
  14.  *    The algorithm tries to reach (*prec) precision digits.
  15.  *    Int_function returns the approximation of the integral and
  16.  *    in the (*prec) variable, the number of exstimated correct digits.
  17.  *    (hopefully at least the value of (*prec) when the function
  18.  *     was called)
  19.  */
  20.  
  21. double Int_function( double (*f)(double), double from, double to, int *prec);
  22.  
  23. /*    Integrates expression contained in `expr'.        
  24.  */
  25.  
  26. double Int_string( char *expr, double from, double to, int *prec);
  27.  
  28.  
  29. /*
  30.  *    PARSER
  31.  *
  32.  *    To use this routine you have to:
  33.  *    - include this file .h
  34.  *    - call Parse_addfunction() to add the particular functions you use
  35.  *    - call Parse_eval() or Parse_evalx() with a string containing
  36.  *      the expression
  37.  *    - test Parse_error to see if evaluation ended with no errors
  38.  */
  39.  
  40. double    Parse_eval(char *expr);        /* Expr: expression to evaluate */
  41. double    Parse_evalx(char *expr, double x);    /* x: value for 'x' */
  42. int    Parse_addfunction(char *name, double (*f)(double) );
  43.                     /* Add a new function, 0=OK */
  44.  
  45. extern int Parse_error;        /* 0: all OK            */
  46.                 /* 1: Syntax error         */
  47.                 /* 2: Unbalanced parentheses     */
  48.                 /* 3: No expression present     */
  49.                 /* 4: Division by zero         */
  50.                 /* 5: Internal error         */
  51.                 /* 6: Undefined function     */
  52.                 /* 7: Wrong assignment         */
  53.  
  54.  
  55. /*
  56.  *    Simple Integrators library
  57.  */
  58.  
  59. double Int_eq_points(int n, double h, double fx[]);
  60. double Int_points(int n,double x[], double fx[]);
  61.  
  62. double Int_eq_points_p(int n, double h, double fx[], double partial[]);
  63. double Int_points_p(int n,double x[], double fx[], double partial[]);
  64.