1 Expressions

  An  expression can include any  of the parameters  which can be used for
  numbers (see  HELP  Numbers  for more   details). It is   a FORTRAN-like
  calculation   including  `+,-,*,/,**  (or  ^),   sin,  cos,  sqrt'  etc.
  Parentheses  are also  allowed.   The code has   been adapted  from Paul
  Avery's MULFIT, so all  the operations listed there  are  available.  If
  you want to use an expression in a cut or as a  variable to project onto
  I recommend that you enclose it in parentheses. The following operations
  are available:

  +, -, *, /, ** (or ^)
  SQRT, SIN, COS, TAN, ALOG, ALOG10, EXP, ASIN, ACOS, ATAN
  ABS, INT, NINT, MIN, MAX, MOD, SIGN
  DATE, TIME, DATE_TIM, DATE_MIN, TIME_MIN

  Note the result of an expression is always returned as a floating
  point number, i.e. also the results of `INT' and `NINT' are
  converted back to floating point immediately. `MIN' and `MAX' take 2
  arguments.

  The `DATE' function expects the date in the form `YYMMDD', `TIME' is
  in the form `HHMMSS', `DATE_TIM' and `DATE_MIN' take 2 arguments
  `YYMMDD,HHMMSS'. `DATE_MIN' and `TIME_MIN' expect the time in the
  form `HHMM'. The date functions return the number of
  days,hours,minutes or seconds (depending on the time mode that has
  been set with the `SET TIME' command) since the reference time (or
  1-Jan-1980 if not reference time has been set). The time functions
  return the same things, but always starting from midnight.

  In addition the following operations on functions are available:

  FPOS, FNEG, DFPOS, DFNEG, DDFPOS, DDFNEG, FINT

  where `POS' and `NEG' mean the value of the function at the given
  value of `X' or just below it. `DFPOS, DFNEG' are the first
  derivatives of the function and `DDFPOS, DDFNEG' are the second
  derivatives. `FINT' is the integral of the function between 2
  limits, which you give as arguments.

  The syntax is `FPOSn(x)' where `n' is the function number
  and `x' is the value at which it should be evaluated. For `FINT' the
  syntax is `FINTn(xlo,xhi)'. `x', `xlo' and `xhi' can also be
  registers, parameters, or even expressions.

  For the derivative the step size is currently set to 1.0. It is
  possible to set it using the `SET FUNCTION STEP' command. The number
  of intervals to integrate over can be set using the command
  `SET FUNCTION INTEGRATE nint' (default is 100). The function number can
  be that of a single function, or `0' to mean all currently selected
  functions.

  For evaluating expressions with functions, if the bin width is set
  (i.e. you have done a fit, or used the `FUNCTION HISTOGRAM'
  command), then it is used. You can turn off the use of the bin width
  with the `SET FUNCTION BIN_WIDTH' command.

2 Examples

!\begin{enumerate}
!\item
!^
  Example 1:

    Calculate the integral of a Gaussian using either `INTEGRATE' or
    `FINT':

    fun add gaus sigma
    1000
    0
    1
    integrate 1
    0 3
    message 'Integral is {r101,(f6.2)}'
    dep r1 = 0
    dep r2 = 1.5
    dep r3=fint1(r1,2*r2)
    message 'Integral is {r3,(f6.2)}'

!\item
!^
  Example 2:

    Illustating the effect of the bin width:

    fun add gaus sigma
    1000
    0
    1
    dep r1 = fpos1(0)
    fun hist 1 &1 0 100 -2 2
    set function bin_width on
    dep r2 = fpos1(0)
    set function bin_width off
    dep r3 = fpos1(0)

!\end{enumerate}


