Скачиваний:
38
Добавлен:
01.05.2014
Размер:
7.46 Кб
Скачать

AP Library adapted for Visual Basic 6 AP Library adapted for Visual Basic 6 The document describes an AP library adapted for Visual Basic 6. The AP library for Visual Basic 6 contains a basic set of mathematical functions and constants needed to run the programs from the ALGLIB website.

Compatibility This library is developed for VB 6 only. It shouldn't be compatible with older compiler versions or with Visual Basic .NET.

Structure and Use The library includes the only module ap.bas. To use the library, you should include this file to the project.

AP library description Constants

Functions

Complex numbers operations

Constants MachineEpsilon

The constant represents the accuracy of machine operations, that is the minimum number for 1+machineepsilon≠1 in the given bit grid. The constant may be taken "oversized", that is real accuracy can be even higher.

MaxRealNumberThe constant represents the highest value of the positive real number, which could be represented on this machine. The constant may be taken "oversized", that is real boundary can be even higher.

MinRealNumber

The constant represents the lowest value of positive real number, which could be represented on this machine. The constant may be taken "oversized", that is real boundary can be even lower.

Functions Public Function MaxReal(ByVal M1 As Double, ByVal M2 As Double) As Double

Returns the maximum of two real numbers.

Public Function MinReal(ByVal M1 As Double, ByVal M2 As Double) As Double

Returns the minimum of two real numbers.

Public Function MaxInt(ByVal M1 As Long, ByVal M2 As Long) As Long

Returns the maximum of two integers.

Public Function MinInt(ByVal M1 As Long, ByVal M2 As Long) As Long

Returns the minimum of two integers.

Public Function ArcSin(ByVal X As Double) As Double

Returns arcsine (in radians).

Public Function ArcCos(ByVal X As Double) As Double

Returns arccosine (in radians).

Public Function SinH(ByVal X As Double) As Double

Returns hyperbolic sine.

Public Function CosH(ByVal X As Double) As Double

Returns hyperbolic cosine.

Public Function TanH(ByVal X As Double) As Double

Returns hyperbolic tangent.

Public Function Pi() As Double

Returns the value of π.

Public Function Power(ByVal Base As Double, ByVal Exponent As Double) As Double

Returns Base raised to a power of Exponent (introduced for compatibility).

Public Function Square(ByVal X As Double) As Double

Returns x2.

Public Function Log10(ByVal X As Double) As Double

Returns common logarithm from X.

Public Function Ceil(ByVal X As Double) As Double

Returns the smallest integer bigger or equal to X.

Public Function RandomInteger(ByVal X As Long) As Long

Returns a random integer between 0 and I-1.

Public Function Atn2(ByVal Y As Double, ByVal X As Double) As Double

Returns an argument of complex number X + iY. From interval from -π to π.

Complex numbers operations As there is no operator overloading in Visual Basic 6.0, operations with complex numbers could not be implemented as easy as with built-in data type. Therefore Complex data type is defined in a library. It is a record with two real number fields x and y, and all the operations are performed with the use of special functions implementing addition, multiplication, subtraction and division. An input can be complex or real, and output is complex. These functions are listed below.

Public Function C_Add(Z1 As Complex Z2 As Complex):Complex

Public Function C_AddR(Z1 As Complex R As Double):Complex

Calculate Z1*Z2 or Z1*R.

Public Function C_Sub(Z1 As Complex Z2 As Complex):Complex

Public Function C_SubR(Z1 As Complex R As Double):Complex

Public Function C_RSub(R As Double, Z1 As Complex):Complex

Calculate Z1-Z2, Z1-R or R-Z1.

Public Function C_Mul(Z1 As Complex Z2 As Complex):Complex

Public Function C_MulR(Z1 As Complex R As Double):Complex

Calculate Z1*Z2 or Z1*R.

Public Function C_Div(Z1 As Complex Z2 As Complex):Complex

Public Function C_DivR(Z1 As Complex R As Double):Complex

Public Function C_RDiv(R As Double, Z2 As Complex):Complex

Calculate Z1/Z2, Z1/R or R/Z2. Modulus calculation is performed using so called "safe" algorithm, that could never cause overflow when calculating intermediate results.

Public Function C_Equal(Z1 As Complex Z2 As Complex):Boolean

Public Function C_EqualR(Z1 As Complex R As Double):Boolean

Public Function C_NotEqual(Z1 As Complex Z2 As Complex):Boolean

Public Function C_NotEqualR(Z1 As Complex R As Double):Boolean

Compare Z1 and Z2 or Z1 and R.

Public Function C_Complex(X As Double):Complex

Converts a real number into equal complex number.

Public Function C_Opposite(Z As Complex):Complex

Returns -Z.

Public Function AbsComplex(Z As Complex):Double

Returns the modulus of complex number z. Modulus calculation is performed using so called "safe" algorithm, that could never cause overflow when calculating intermediate results.

Public Function Conj(Z As Complex):Complex

Returns complex conjugate to z.

Public Function CSqr(Z As Complex):Complex

Returns the square of z.

Соседние файлы в папке libs