# rakam

1.0.0-2Β β’Β PublicΒ β’Β Published

# RAKAM ββπ

Rakam or (Ψ±ΩΩ) in Arabic, which means "number". This is a math library. One of the reasons to give this package a try is that, the performance is in our considerations. As some great projects such as plotto and desmos make intense calculations in tons of iterations to generate the graph. The need of such an open-source project cares about these situations arises, so that we can cooperate and contribute to reach the optimal performance π.

### Features:

• Compile math expression from a string into js function, ready for evaluation, considering the performance as the main goal.
• Parse math expression.
• The same for latex.
• Convert between latex and math expression.
• Geometric shapes and properties and intersections: now lines are avaliable.
• Get a float number as a numerator over a denomerator { s: sign<1|-1>, n: integer, d: integer }.
• As well as getting the quotient, the reminder and the denomerator of a fraction, { s: sign<1|-1>, q: integer, r: integer, d: integer }. AKA: quotient is the whole number, and the decimal part will be converted to a numerator and a denomerator.

You can get any import any of the APIs elements directly, saving load time and bundle size.

### Documentations tree (API):

• core lcm, gcd, lcm2, gcd2, dist, constrain, trunc, toFixed, random, randomInt
• engine
• math2js
• math2latex
• mathParser
• latexParser
• latex2js
• latex2math
• geometry
• fraction

# π  engine

## math2js

Rakam uses @scicave/math-parser library to parse math expression, then handle the AST, or say the parser tree, to generate the equivalent js code, in a very customizable way. After all of these steps, we easily use Function constructor, new Function(...).

See documentations for more about math2js.

# π geometry

## angles

You can:

• Convert angles from unit to another one (e.g. from deg to red, or rad to grad, etc...).
• Calculate the angle between two vectors, { x: number, y: number }. You can also calculate the angle between two lines.
• In both cases, between vectors or lines, you can get the minimal or maximal angle or get the angle by which the first vector (or line) rotates to reach the other vector (or line).
• Calculate the angle in degree (as float number), and get it as {deg: number, min: number, sec: number}, degree, minutes and seconds respectively.
• Or get it as 12Β° 26' 53.48"

Documentations: angles.

## lines

You can:

• Get a line equation parameters: "a", "b" and "c" in ax + by + c = 0 .
• Get the 2 lines intersection point.
• Project a point onto a line.
• Get the distance between a point ad a line.

Documentations: lines

# β fraction

Documentation: fraction

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

## Package Sidebar

npm i rakam

### Repository

github.com/scicave/rakam

2

1.0.0-2

Apache-2.0

1.6 MB

95