[2645] | 1 | <html> |
---|
| 2 | <head> |
---|
| 3 | |
---|
| 4 | <title>AP Library adapted for C#</title> |
---|
| 5 | <style type="text/css"> |
---|
| 6 | <!-- |
---|
| 7 | h1 { font-family: Tahoma,sans-serif; font-size : larger; } |
---|
| 8 | h2 { font-family: Arial,sans-serif; font-size : 11pt; } |
---|
| 9 | h3 { font-family: Arial,sans-serif; font-size : 9pt; } |
---|
| 10 | .cond { color:blue; } |
---|
| 11 | .const { color:#222222; } |
---|
| 12 | .func { color:#111111; } |
---|
| 13 | --> |
---|
| 14 | </style> |
---|
| 15 | </head> |
---|
| 16 | <body> |
---|
| 17 | |
---|
| 18 | <h1>AP Library adapted for C#</h1> |
---|
| 19 | |
---|
| 20 | <p align=justify> |
---|
| 21 | The document describes an AP library adapted for C#. The AP library for C# contains a basic set of mathematical functions and collection classes needed to run the programs from the <a href="http://www.alglib.net/">ALGLIB</a> website. |
---|
| 22 | </p> |
---|
| 23 | |
---|
| 24 | <h1>Compatibility</h1> |
---|
| 25 | |
---|
| 26 | <p align=justify> |
---|
| 27 | This library must be compatible with any C# compiler. |
---|
| 28 | </p> |
---|
| 29 | |
---|
| 30 | <h1>Structure and Use</h1> |
---|
| 31 | |
---|
| 32 | <p align=justify> |
---|
| 33 | The library includes the only file <code>ap.cs</code> |
---|
| 34 | </p> |
---|
| 35 | |
---|
| 36 | <h1>AP Library Description</h1> |
---|
| 37 | |
---|
| 38 | <font size=-1> |
---|
| 39 | <a href="#constants">Constants</a><br> |
---|
| 40 | <a href="#functions">Functions</a><br> |
---|
| 41 | <a href="#complex">Complex numbers</a><br> |
---|
| 42 | </font> |
---|
| 43 | |
---|
| 44 | <a name="constants"><h1>Constants</h1></a> |
---|
| 45 | |
---|
| 46 | <p align=justify> |
---|
| 47 | <span class=const>AP.Math.MachineEpsilon</span><br> |
---|
| 48 | The constant represents the accuracy of machine operations, that is the minimum number for <code>1+machineepsilon≠1</code> in the given bit grid. The constant may be taken "oversized", that is real accuracy can be even higher. |
---|
| 49 | </p> |
---|
| 50 | |
---|
| 51 | <p align=justify> |
---|
| 52 | <span class=const>AP.Math.MaxRealNumber</span><br> |
---|
| 53 | The 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. |
---|
| 54 | </p> |
---|
| 55 | |
---|
| 56 | <p align=justify> |
---|
| 57 | <span class=const>AP.Math.MinRealNumber</span><br> |
---|
| 58 | 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. |
---|
| 59 | </p> |
---|
| 60 | |
---|
| 61 | <a name="functions"><h1>Functions</h1></a> |
---|
| 62 | |
---|
| 63 | <p align=justify> |
---|
| 64 | <span class=func><b>public static double</b> AP.Math.RandomReal()</span><br> |
---|
| 65 | Returns a random real number from half-interval [0,1). |
---|
| 66 | </p> |
---|
| 67 | |
---|
| 68 | <p align=justify> |
---|
| 69 | <span class=func><b>public static int</b> AP.Math.RandomInteger(<b>int</b> N)</span><br> |
---|
| 70 | Returns a random integer between 0 and maxv-1. |
---|
| 71 | </p> |
---|
| 72 | |
---|
| 73 | <p align=justify> |
---|
| 74 | <span class=func><b>public static double</b> AP.Math.Sqr(<b>double</b> x)</span><br> |
---|
| 75 | Returns x<sup>2</sup>. |
---|
| 76 | </p> |
---|
| 77 | |
---|
| 78 | <a name="complex"><h1>Class of complex numbers</h1></a> |
---|
| 79 | |
---|
| 80 | <p align=justify> |
---|
| 81 | AP library includes the <code>AP.Complex</code> structure that supports operations with compex numbers. Access to real and imaginary parts of complex number is implemented through the public fields <code>x</code> and <code>y</code>. Arithmetical operations are supported, the same as with embedded data types, by overloading of operations: addition, subtraction, multiplication and division. Addition, subtraction and multiplication are performed by a usual way (i.e., according to their definition which can be found in any textdook in algebra), division is performed using so called "safe" algorithm that could never cause overflow when calculating intermediate results. The library also includes several functions performing elementary operations with complex numbers. |
---|
| 82 | </p> |
---|
| 83 | |
---|
| 84 | <p align=justify> |
---|
| 85 | <span class=func><b>double</b> AP.Math.AbsComplex(AP.Complex z)</span><br> |
---|
| 86 | Returns the modulus of complex number z. It should be noted that the modulus calculation is performed using so called "safe" algorithm, that could never cause overflow when calculating intermediate results. |
---|
| 87 | </p> |
---|
| 88 | |
---|
| 89 | <p align=justify> |
---|
| 90 | <span class=func>AP.Complex AP.Math.Conj(AP.Complex z)</span><br> |
---|
| 91 | Returns complex conjugate to z. |
---|
| 92 | </p> |
---|
| 93 | |
---|
| 94 | <p align=justify> |
---|
| 95 | <span class=func>AP.Complex AP.Math.CSqr(AP.Complex z)</span><br> |
---|
| 96 | Returns the square of z. |
---|
| 97 | </p> |
---|
| 98 | |
---|
| 99 | </body> |
---|
| 100 | </html> |
---|