ETHZ_Logo RAMSES_Logo_Right   RAMSES   RAMSES_Logo_Left Systems Ecology  
Start    search button      Modules:   A-Z   Function   Layer        QuickRefs:   DM   AuxLib   AuxLibE   SciLib   EasyMW   MW   ISIS   RMSLib

DEFINITION MODULE LMathProcs;

  (*******************************************************************
  
    Module  LMathProcs     (Version 1.0)
    
      Copyright (c) 1986-2007 by Andreas Fischlin, Olivier Roth 
      and ETH Zurich
      
    Purpose   Some often used mathematical functions (LONGREAL variant)
    
    Remarks   This module is a double precision (LONGREAL) variant of 
              the companion module MathProcs
    
    
    Programming
    
      o Design
        Andreas Fischlin         19/08/2007
        
      o Implementation
        Andreas Fischlin         19/08/2007
        Olivier Roth             13/11/1986
        
        
    ETH Zurich 
    Systems Ecology 
    CHN E 35.1 
    Universitaetstrasse 16 
    8092 Zurich 
    SWITZERLAND 
    
    URLs: 
        <mailto:RAMSES@env.ethz.ch> 
        <http://www.sysecol.ethz.ch> 
        <http://www.sysecol.ethz.ch/SimSoftware/RAMSES> 
    
        
    Last revision of definition:  19/08/2007  AF
    
  *******************************************************************)


  (****************************************)
  (*#####   MATHEMATICAL FUNCTIONS   #####*)
  (****************************************)
  
  PROCEDURE LongEqual ( x,y: LONGREAL ): BOOLEAN;
  (*
    Returns wether two reals x and y are equal or differ at
    most by a small amount epsilon (ABS(x-y)<=epsilon).  The
    parameter epsilon is computed in a machine dependent way
    and represents the absolute minimum difference between two
    double precision real variables as defined by the floating
    point precision of the machine on which this module
    currently executes.  
  *)

  PROCEDURE LSIGN (x: LONGREAL): LONGREAL;
  (* returns the sign of x, i.e. -1.0 or +1.0 depending on the sign of x *)
  
  PROCEDURE LongInt (x: LONGREAL): LONGINT;
  (* returns the truncated integer part of real x (see also DMPortab.LITRUNC) *)
  
  PROCEDURE LongRound(x: LONGREAL): LONGINT;
  (* returns the rounded integer part of real x *)
  
  PROCEDURE LongFrac (x: LONGREAL): LONGREAL;
  (* returns the fractional part of x (part after the decimal point) *)

  
  PROCEDURE LongPowerI(x: LONGREAL; iexp: LONGINT): LONGREAL;
  (* returns x to the power of iexp *)

  PROCEDURE LongPower(x, exp: LONGREAL): LONGREAL;
  (* returns x to the power of exp *)

  PROCEDURE LongLg(x: LONGREAL): LONGREAL;
  (* returns the logarithm of x to base 10 *)

  PROCEDURE LongFac(k: LONGCARD): LONGCARD;
  (*
    returns the factorial for k, i.e. k!  =
    k*(k-1)*(k-2)*(k-3)...*1 (note 0!  = 1) 
  *)

  PROCEDURE LIMax(i1,i2: LONGINT): LONGINT;
  (* returns maximum value of the two integers i1 and i2 *)

  PROCEDURE LIMin(i1,i2: LONGINT): LONGINT;
  (* returns minimum value of the two integers i1 and i2 *)

  PROCEDURE LRMax(x1,x2: LONGREAL): LONGREAL;
  (* returns maximum value of the two reals x1 and x2 *)

  PROCEDURE LRMin(x1,x2: LONGREAL): LONGREAL;
  (* returns minimum value of the two reals x1 and x2 *)


  (******************************)
  (*#####   TRIGONOMETRY   #####*)
  (******************************)

  PROCEDURE LongPi(): LONGREAL;
  (* returns pi *)

  PROCEDURE LongRad(deg: LONGREAL): LONGREAL;
  (* returns radian value for degrees deg *)
  
  PROCEDURE LongDeg(rad: LONGREAL): LONGREAL;
  (* returns degrees for radian value rad *)
  
  PROCEDURE LongTan(alpha: LONGREAL): LONGREAL;
  (* returns the tangens of angle x in radians *)

  PROCEDURE LongArcSin(a: LONGREAL): LONGREAL;
  (*
    Returns the inverse in radians of sine x (Note, with x
    in [-1.0..1.0] LongArcSin(x) returns values in [-pi/2 .. +pi/2]).
  *)

  PROCEDURE LongArcCos(a: LONGREAL): LONGREAL;
  (*
    Returns the inverse in radians of cosine x (Note, with x
    in [-1.0..1.0] LongArcCos(x) returns values in [0 .. pi]).
  *)


END LMathProcs.

  Contact RAMSES@env.ethz.ch Last updated: 25-Jul-2011 [Top of page]