Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

BaseDefinitions.h File Reference

#include <stdio.h>
#include <fstream.h>

Include dependency graph for BaseDefinitions.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define Zahl   double
#define min(a, b)   (a<b)?a:b
#define epsilon   0.0000000001
#define M_SQRTPI   1.772453850905516027298167483341145182798
#define M_1SQRT2PI   0.398942280401432677939946059934
#define Free(ptr)   delete[] ptr;ptr=NULL;
#define lfloor(f)   (long)floor(f)
#define min(x, y)   (x<y)?x:y
#define max(x, y)   (x>y)?x:y

Functions

Zahl AsymErfc (Zahl zsq)
void WriteDoubleArray (ofstream &str, long len, double *vals, char *endchar, long dim)
long power (long m, long n)
double power (double m, long n)
long binom (long i, long k)
double vectabs (double a1, double a2, double a3)
double Phi (long base, long x)
long LongToCoeff (long nr, long base, long *cfs, long cflen)
double CoeffToDoubleModified (long base, long *cfs, long cflen, long modfact)
double CoeffToDouble (long base, long *cfs, long cflen)
bool IsPrimitiveRoot (long proot, long base)
long CalcDeterminant (long *A, long dim, long i)

Variables

long ERFCMAXREK


Define Documentation

#define Free( ptr )   delete[] ptr;ptr=NULL;
 

Frees the array-pointer ptr and sets it to NULL afterwards.

#define M_1SQRT2PI   0.398942280401432677939946059934
 

#define M_SQRTPI   1.772453850905516027298167483341145182798
 

approximate value for the square root of pi.

#define Zahl   double
 

We want to use double, but who knows, maybe sometimes we need long double or just float.

By using our own type we only have to change this here and then to recompile

#define epsilon   0.0000000001
 

#define lfloor( f )   (long)floor(f)
 

#define max( x, y )   (x>y)?x:y
 

Macro, returns the maximum of two given values.

#define min( x, y )   (x<y)?x:y
 

Macro, returns the minimum of two given values.

#define min( a, b )   (a<b)?a:b
 

Macro, returns the minimum of two given values.


Function Documentation

Zahl AsymErfc ( Zahl zsq )
 

Calculates the Erfc by means of its asymptotic expansion.

Parameters:
zsq   The variable z^2 in the expansion.

long CalcDeterminant ( long * A,
long dim,
long dimtocalc )
 

calculates the determinant of the (upper left) i*i submatrix of the dim*dim Matrix A.

This is really slow, but never mind... flag the rows used so that we don't need another array for the cofactor. This saves a lot of mem...

double CoeffToDouble ( long base,
long * cfs,
long cflen )
 

returns the double-representation of the cofficients in base "base" given in cfs.

E.g. cfs={1,2,1,2,1}, base=3 => returns 1/3 + 2/9 + 1/27 + 2/81 + 1/243

double CoeffToDoubleModified ( long base,
long * cfs,
long cflen,
long modfact )
 

returns the double-representation of the cofficients in base "base" given in cfs.

E.g. cfs={1,2,1,2,1}, base=3 => returns 1/3 + 2/9 + 1/27 + 2/81 + 1/243 This is the modified version, needed by Atanassov's sequence. (Not quite implemented yet ...)

bool IsPrimitiveRoot ( long proot,
long base )
 

Checks if proot is a primitive root modulo base.

long LongToCoeff ( long nr,
long base,
long * cfs,
long cflen )
 

Expands n in base "base".

Parameters:
nr   the number to develop in base
base   Which base to use for the expansion
cfs   long-array where the coefficients should be stored
cflen   length of the buffer cfs
Returns:
Returns the number of coefficients (lowest n s.t. nr<base^n) or cflen, depending in which one is smaller

double Phi ( long base,
long x )
 

The digit inversion function.

This inverts x (written down in base "base") at the comma. E.g. Phi(3, 25): 25=2*9+2*3+1=221_3 => 0.112_3=1/3 + 1/9 + 2/27

void WriteDoubleArray ( ofstream & str,
long len,
double * vals,
char * endchar,
long dim )
 

Writes the "dim"-dimensional array vals in Mathematica-List format to the file str.

Parameters:
endchar   defines a string which should be written out after the list, e.g. ";" or "//MatrixForm"
len  
vals   The dim-dimensional array of double-Values
endchar   String that is appended to the file after the List is written out.
dim  

long binom ( long i,
long k )
 

Returns the binomial coefficient (i k).

double power ( double m,
long n )
 

Returns m^n where n and m are double variable.

The result is of type double, too.

long power ( long m,
long n )
 

Returns m^n, where n and m are long variables.

The result, of course, is also of type long.

double vectabs ( double a1,
double a2,
double a3 )
 

Returns the length of the 3-dimensional vector (a1, a2, a3) (just sqrt(a1*a1 + a2*a2 + a3*a3) ).


Variable Documentation

long ERFCMAXREK
 

Defines how many term in the asymptotic expansion of erfc=1-erf should be used for the calculation.


Generated at Wed Jun 20 19:47:43 2001 for LDSequences by doxygen1.2.7 written by Dimitri van Heesch, © 1997-2001