<commit_before># Math

Little library to deal with some mathematical stuff.

Implemented or partially implemented are: Complex number, Matrix, Normal distribution, Random, Angle.

## Angle

You can use angles as **deg**, **gon**, **rad** or **turn*. By default, radians is used.

```php
$a = new \Malenki\Math\Angle(pi()/2);
var_dump($a->deg); // get degrees
var_dump($a->rad); // get radians
var_dump($a->gon); // get radians
var_dump($a->turn); // get turns
```

You can get DMS style too:

```php
$a = new \Malenki\Math\Angle(34.53, \Malenki\Math\Angle::TYPE_DEG);
var_dump($a->dms); // get DMS object
var_dump($a->dms->str); // get DMS string '34°31′48″'
```

## Matrix

Creating matrix is simple, first step, you instanciate it with column numbers and row numbers, second step, you put data into it.

```php
//instanciate
$m = new \Malenki\Math\Matrix(3, 2);
//then populate
$m->populate(array(1,2,3,4,5,6));
//or
$m->addRow(array(1, 2));<commit_msg>Blahblah about Angle class into README<commit_after># Math

Little library to deal with some mathematical stuff.

Implemented or partially implemented are: Complex number, Matrix, Normal distribution, Random, Angle.

## Angle

You can use angles as **deg**, **gon**, **rad** or **turn**. By default, radians is used.

```php
$a = new \Malenki\Math\Angle(pi()/2);
var_dump($a->deg); // get degrees
var_dump($a->rad); // get radians
var_dump($a->gon); // get radians
var_dump($a->turn); // get turns
```

You can get DMS style too:

```php
$a = new \Malenki\Math\Angle(34.53, \Malenki\Math\Angle::TYPE_DEG);
var_dump($a->dms); // get DMS object
var_dump($a->dms->str); // get DMS string '34°31′48″'
```

You can test whether current angle is **right**, **straight** or **perigon**:

```php
$a = new \Malenki\Math\Angle(pi() / 2);
var_dump($a->isRight()); // should return TRUE
$b = new \Malenki\Math\Angle(pi());
var_dump($b->isStraight()); // should return TRUE
$c = new \Malenki\Math\Angle(2 * pi());
var_dump($c->isPerigon()); // should return TRUE
$d = new \Malenki\Math\Angle(450, \Malenki\Math\Angle::TYPE_DEG); //yes, ignore multiple turns :)
var_dump($d->isRight()); // should return TRUE
```

You can test current angle with another to know is they are **complementary** or **supplementary**:

```php
$a = new \Malenki\Math\Angle(pi() / 3);
$b = new \Malenki\Math\Angle(pi() / 6);
var_dump($a->isComplementary($b)); // should be TRUE
var_dump($b->isComplementary($a)); // should be TRUE

$c = new \Malenki\Math\Angle(pi() / 2);
$d = new \Malenki\Math\Angle(90, \Malenki\Math\Angle::TYPE_DEG);
var_dump($c->isSupplementary($d)); // should be TRUE
var_dump($d->isSupplementary($c)); // should be TRUE
```

## Matrix

Creating matrix is simple, first step, you instanciate it with column numbers and row numbers, second step, you put data into it.

```php
//instanciate
$m = new \Malenki\Math\Matrix(3, 2);
//then populate
$m->populate(array(1,2,3,4,5,6));
//or
$m->addRow(array(1, 2));
{'fraction_non_alphanumeric': 0.19219015280135823, 'fraction_numerical': 0.01765704584040747, 'mean_word_length': 4.415441176470588, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3763992', 'n_tokens_mistral': 1105, 'n_tokens_neox': 1054, 'n_words': 317}