Mercurial > repos > deepakjadmin > mayatool3_test3
comparison mayachemtools/docs/modules/txt/MathUtil.txt @ 0:73ae111cf86f draft
Uploaded
| author | deepakjadmin |
|---|---|
| date | Wed, 20 Jan 2016 11:55:01 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:73ae111cf86f |
|---|---|
| 1 NAME | |
| 2 MathUtil | |
| 3 | |
| 4 SYNOPSIS | |
| 5 use MathUtil; | |
| 6 | |
| 7 use MathUtil qw(:all); | |
| 8 | |
| 9 DESCRIPTION | |
| 10 MathUtil module provides a variety of common math functions not | |
| 11 available in core Perl package or some other useful math utilities. In | |
| 12 order to be consistent with other Perl functions, name of all the | |
| 13 functions in this package are in lowercase which differs from | |
| 14 MayaChemTools naming convention for function names. | |
| 15 | |
| 16 MathUtil module provides the following functions: | |
| 17 | |
| 18 GeneratePrimeNumbersUpToCount, GeneratePrimeNumbersUpToLimit, acos, | |
| 19 asin, ceil, floor, log10, max, min, random, round, srandom, tan | |
| 20 | |
| 21 FUNCTIONS | |
| 22 GeneratePrimeNumbersUpToCount | |
| 23 $PrimesRef = GeneratePrimeNumbersUpToCount(); | |
| 24 $PrimesRef = GeneratePrimeNumbersUpToCount($Count); | |
| 25 | |
| 26 Generate prime numbers up to specified *Count* of prime numbers and | |
| 27 return a reference to an array containing the prime numbers. | |
| 28 | |
| 29 By default, the first 1000 prime numbers are generated. The 1000th | |
| 30 prime number is 7919. | |
| 31 | |
| 32 The algorithm to generate prime numbers is a modification of Sieve | |
| 33 of Erastothenes prime number generator. | |
| 34 | |
| 35 GeneratePrimeNumbersUpToLimit | |
| 36 $PrimesRef = GeneratePrimeNumbersUpToLimit(); | |
| 37 $PrimesRef = GeneratePrimeNumbersUpToLimit($Limit); | |
| 38 | |
| 39 Generate prime numbers up to a specified *Limit* and return a | |
| 40 reference to an array containing the prime numbers. | |
| 41 | |
| 42 By default, the first 1000 prime numbers are generated. The 1000th | |
| 43 prime number is 7919 and that's why default limit is set to 7920. | |
| 44 | |
| 45 The algorithm to generate prime numbers is a modification of Sieve | |
| 46 of Erastothenes prime number generator. | |
| 47 | |
| 48 acos | |
| 49 $Value = acos($AngleInRadians); | |
| 50 | |
| 51 Returns the nverse cosine of an angle expressed in *Radians* using | |
| 52 Math::Trig::acos function. | |
| 53 | |
| 54 asin | |
| 55 $Value = asin($AngleInRadians); | |
| 56 | |
| 57 Returns the inverse sine of an angle expressed in *Radians* using | |
| 58 Math::Trig::asin function. | |
| 59 | |
| 60 ceil | |
| 61 $IntegerValue = ceil($Value); | |
| 62 | |
| 63 Returns the next largest integer for *Value* using POSIX::ceil | |
| 64 function. | |
| 65 | |
| 66 floor | |
| 67 $IntegerValue = floor($Value); | |
| 68 | |
| 69 Returns the previous smallest integer for *Value* using POSIX::floor | |
| 70 function. | |
| 71 | |
| 72 log10 | |
| 73 $Log10Value = log10($Value); | |
| 74 | |
| 75 Returns the log of *Value* using base 10. | |
| 76 | |
| 77 max | |
| 78 $Number = max($Number1, $Number2); | |
| 79 | |
| 80 Returns a Number corresponding to the maximum of *Number1* and | |
| 81 *Number2*. | |
| 82 | |
| 83 min | |
| 84 $Number = min($Number1, $Number2); | |
| 85 | |
| 86 Returns a Number corresponding to the minimum of *Number1* and | |
| 87 *Number2*. | |
| 88 | |
| 89 round | |
| 90 $RoundedValue = round($Number); | |
| 91 $RoundedValue = round($Number, $DecimalPlaces); | |
| 92 | |
| 93 Returns a value corresponding to a nearst ingeter for *Number* or | |
| 94 formatted to *DecimalPlaces*. | |
| 95 | |
| 96 random | |
| 97 $RandomNumber = random(); | |
| 98 $RandomNumber = random($Size); | |
| 99 | |
| 100 Returns a random number between 0 and less than 1 or specified size. | |
| 101 | |
| 102 The random number generator implemented in MayaChemTools is a | |
| 103 variant of linear congruential generator (LCG) as described by | |
| 104 Miller et al. [ Ref 120 ]. It is also referred to as Lehmer random | |
| 105 number generator or Park-Miller random number generator. | |
| 106 | |
| 107 Unlike Perl's core random number generator function rand, the random | |
| 108 number generator implemented in MayaChemTools generates consistent | |
| 109 random values across different platforms - Windows, CygWin, Linux, | |
| 110 Unix - for a specific random seed. | |
| 111 | |
| 112 srandom | |
| 113 $Seed = srandom($Seed); | |
| 114 | |
| 115 Sets random number seed to be used by <random> function and returns | |
| 116 seed value. | |
| 117 | |
| 118 The random number seed is recommeded to be an integer between 1 and | |
| 119 2**31 - 2 [Ref 120] which translates to be 1 and 2147483646. | |
| 120 | |
| 121 The default seed is set to 123456789. | |
| 122 | |
| 123 tan | |
| 124 $Value = tan($AngleInRadians); | |
| 125 | |
| 126 Returns the tangent of an angle expressed in *Radians*. | |
| 127 | |
| 128 AUTHOR | |
| 129 Manish Sud <msud@san.rr.com> | |
| 130 | |
| 131 SEE ALSO | |
| 132 Constants.pm, ConversionsUtil.pm | |
| 133 | |
| 134 COPYRIGHT | |
| 135 Copyright (C) 2015 Manish Sud. All rights reserved. | |
| 136 | |
| 137 This file is part of MayaChemTools. | |
| 138 | |
| 139 MayaChemTools is free software; you can redistribute it and/or modify it | |
| 140 under the terms of the GNU Lesser General Public License as published by | |
| 141 the Free Software Foundation; either version 3 of the License, or (at | |
| 142 your option) any later version. | |
| 143 |
