|
| 1 | +# Math Package |
| 2 | + |
| 3 | +A math pacakage written in pure Nuru by [VictorKariuki](https://github.com/VictorKariuki) |
| 4 | + |
| 5 | + |
| 6 | +## Explanation |
| 7 | + |
| 8 | +A detailed list of all methods and description and example: |
| 9 | + |
| 10 | +### abs(namba) |
| 11 | + |
| 12 | +Description: Calculates the absolute value of a number. |
| 13 | +Example: Hisabati.abs(-42) returns 42. |
| 14 | + |
| 15 | +### acos(x) |
| 16 | +Description: Calculates the arccosine (inverse cosine) of a number in radians. |
| 17 | +Example: Hisabati.acos(0.5) returns the arccosine of 0.5. |
| 18 | + |
| 19 | +### acosh(x) |
| 20 | +Description: Calculates the inverse hyperbolic cosine of a number. |
| 21 | +Example: Hisabati.acosh(2) returns the inverse hyperbolic cosine of 2. |
| 22 | + |
| 23 | +### arcsin(x) |
| 24 | +Description: Calculates the arcsine (inverse sine) of a number using a Taylor series. |
| 25 | +Example: Hisabati.arcsin(0.5) returns the arcsine of 0.5. |
| 26 | + |
| 27 | +### arsinh(x) |
| 28 | +Description: Calculates the inverse hyperbolic sine of a number. |
| 29 | +Example: Hisabati.arsinh(1) returns the inverse hyperbolic sine of 1. |
| 30 | + |
| 31 | +### atan(x) |
| 32 | +Description: Calculates the arctangent (inverse tangent) of a number in radians using a Taylor series. |
| 33 | +Example: Hisabati.atan(1) returns the arctangent of 1. |
| 34 | + |
| 35 | +### atan2(y, x) |
| 36 | +Description: Calculates the angle in radians between the positive x-axis and the point (x, y). |
| 37 | +Example: Hisabati.atan2(1, 1) returns the angle for the point (1, 1). |
| 38 | + |
| 39 | +### atanh(x) |
| 40 | +Description: Calculates the inverse hyperbolic tangent of a number. |
| 41 | +Example: Hisabati.atanh(0.5) returns the inverse hyperbolic tangent of 0.5. |
| 42 | + |
| 43 | +### cbrt(x) |
| 44 | +Description: Calculates the cube root of a number. |
| 45 | +Example: Hisabati.cbrt(8) returns the cube root of 8. |
| 46 | + |
| 47 | +### ceil(x) |
| 48 | +Description: Rounds up to the smallest integer greater than or equal to a given number. |
| 49 | +Example: Hisabati.ceil(4.2) returns 5. |
| 50 | + |
| 51 | +### cos(x, terms) |
| 52 | +Description: Calculates the cosine of a number in radians using a Taylor series. |
| 53 | +Example: Hisabati.cos(1) returns the cosine of 1. |
| 54 | + |
| 55 | +### cosh(x) |
| 56 | +Description: Calculates the hyperbolic cosine of a number. |
| 57 | +Example: Hisabati.cosh(2) returns the hyperbolic cosine of 2. |
| 58 | + |
| 59 | +### exp(x, precision) |
| 60 | +Description: Calculates the value of the mathematical constant e raised to the power of x using a Taylor series. |
| 61 | +Example: Hisabati.exp(2) returns e^2. |
| 62 | + |
| 63 | +### expm1(x) |
| 64 | +Description: Calculates the value of e^x - 1 using a Taylor series. |
| 65 | +Example: Hisabati.expm1(1) returns e - 1. |
| 66 | + |
| 67 | +### floor(x) |
| 68 | +Description: Rounds down to the largest integer less than or equal to a given number. |
| 69 | +Example: Hisabati.floor(4.9) returns 4. |
| 70 | + |
| 71 | +### hypot(values) |
| 72 | +Description: Calculates the Euclidean norm (square root of the sum of squares) of a list of values. |
| 73 | +Example: Hisabati.hypot([3, 4]) returns 5, which is the hypotenuse of a right triangle. |
| 74 | + |
| 75 | +### log(x) |
| 76 | +Description: Calculates the natural logarithm of a number using a Taylor series. |
| 77 | +Example: Hisabati.log(2) returns the natural logarithm of 2. |
| 78 | + |
| 79 | +### log10(x) |
| 80 | +Description: Calculates the base 10 logarithm of a number using the natural logarithm. |
| 81 | +Example: Hisabati.log10(100) returns 2. |
| 82 | + |
| 83 | +### log1p(x) |
| 84 | +Description: Calculates the natural logarithm of 1 + x using a Taylor series. |
| 85 | +Example: Hisabati.log1p(0.5) returns the natural logarithm of 1.5. |
| 86 | + |
| 87 | +### log2(x) |
| 88 | +Description: Calculates the base 2 logarithm of a number. |
| 89 | +Example: Hisabati.log2(8) returns 3. |
| 90 | + |
| 91 | +### max(numbers) |
| 92 | +Description: Returns the largest number from a list of numbers. |
| 93 | +Example: Hisabati.max([3, 7, 2, 9]) returns 9. |
| 94 | + |
| 95 | +### min(numbers) |
| 96 | +Description: Returns the smallest number from a list of numbers. |
| 97 | +Example: Hisabati.min([3, 7, 2, 9]) returns 2. |
| 98 | + |
| 99 | +### round(x, method) |
| 100 | +Description: Rounds a number to the nearest integer using different rounding methods. |
| 101 | +Example: Hisabati.round(3.6, "rpi") rounds to the nearest integer (4) using "round half up." |
| 102 | + |
| 103 | +### sign(x) |
| 104 | +Description: Returns the sign of a number: 1 for positive, -1 for negative, and 0 for zero. |
| 105 | +Example: Hisabati.sign(-7) returns -1. |
| 106 | + |
| 107 | +### sin(x, terms) |
| 108 | +Description: Calculates the sine of a number in radians using a Taylor series. |
| 109 | +Example: Hisabati.sin(0.5) returns the sine of 0.5. |
| 110 | + |
| 111 | +### sinh(x) |
| 112 | +Description: Calculates the hyperbolic sine of a number. |
| 113 | +Example: Hisabati.sinh(1) returns the hyperbolic sine of 1. |
| 114 | + |
| 115 | +### sqrt(x) |
| 116 | +Description: Calculates the square root of a number using the Newton-Raphson method. |
| 117 | +Example: Hisabati.sqrt(16) returns 4. |
| 118 | + |
| 119 | +### sine(x) |
| 120 | +Description: Calculates the sine of a number in radians using a Taylor series. |
| 121 | +Example: Hisabati.sine(1.5) returns the sine of 1.5 |
0 commit comments