PHPackages                             samsara/fermat - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. samsara/fermat

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

samsara/fermat
==============

A library providing math and statistics operations for numbers of arbitrary size.

v2.1.1(4y ago)653.1k6[10 issues](https://github.com/JordanRL/Fermat/issues)[2 PRs](https://github.com/JordanRL/Fermat/pulls)3GPL-2.0-or-laterPHPPHP &gt;=8.0

Since Jan 16Pushed 4mo ago6 watchersCompare

[ Source](https://github.com/JordanRL/Fermat)[ Packagist](https://packagist.org/packages/samsara/fermat)[ Docs](https://jordanrl.github.io/Fermat/)[ GitHub Sponsors](https://github.com/sponsors/JordanRL)[ RSS](/packages/samsara-fermat/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (5)Versions (15)Used By (3)

Fermat
======

[](#fermat)

[![CircleCI](https://camo.githubusercontent.com/06b4ffb69720abaff14e1f991d37b373a2dd0f099b09f14b9b2bbb5ff13f6b73/68747470733a2f2f646c2e636972636c6563692e636f6d2f7374617475732d62616467652f696d672f67682f4a6f7264616e524c2f4665726d61742f747265652f6d61737465722e7376673f7374796c653d736869656c64)](https://dl.circleci.com/status-badge/redirect/gh/JordanRL/Fermat/tree/master) [![Test Coverage](https://camo.githubusercontent.com/f60bcfacbf276728b60d7e0ea6bf59b506ab94b45fbd083d648397f3f925e1de/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f63653063353736316138663064336433376366322f746573745f636f766572616765)](https://codeclimate.com/github/JordanRL/Fermat/test_coverage) [![Maintainability](https://camo.githubusercontent.com/c99a620b1c10d92abcc56705f71ee26ffa7c7b0ece9ec8bf1d21f1c07a0c9e06/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f63653063353736316138663064336433376366322f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/JordanRL/Fermat/maintainability) [![Latest Stable Version](https://camo.githubusercontent.com/fa11e95ba4aed57f05015024a3ebd713c7fa4b9e5f5c400a2d39fd0ce1c48277/68747470733a2f2f706f7365722e707567782e6f72672f73616d736172612f6665726d61742f762f737461626c65)](https://packagist.org/packages/samsara/fermat) [![Total Downloads](https://camo.githubusercontent.com/619edb3d082dce1c1d5e7f2e1f1e0b989f8a004ff7bada6ca4a05effa9168f2a/68747470733a2f2f706f7365722e707567782e6f72672f73616d736172612f6665726d61742f646f776e6c6f616473)](https://packagist.org/packages/samsara/fermat) [![License](https://camo.githubusercontent.com/db389259e08a340bab62aed11833094ae0bdc8d324e9455ffe43b80c11ca72f2/68747470733a2f2f706f7365722e707567782e6f72672f73616d736172612f6665726d61742f6c6963656e7365)](https://packagist.org/packages/samsara/fermat)

**This project is unit tested against 8.1, and merges are not accepted unless the tests pass.**

Installation
------------

[](#installation)

To install, simply require the package using composer:

```
composer require "samsara/fermat:^2.1"

```

Or include it in your `composer.json` file:

```
{
    "require": {
        "samsara/fermat": "^2.1"
    }
}
```

The project namespace is `Samsara\Fermat\Core\*`. You can view the project on [Packagist](https://packagist.org/packages/samsara/fermat).

### Modules

[](#modules)

Modules are the namespaces outside of `Samsara\Fermat\Core` and provide functionality beyond integer, decimal, and rational numbers.

All of these modules depend on the Core namespace, while some depend on each other to various degrees.

- `Samsara\Fermat\Complex`: Provides complex number functionality. **NOTE:** Imaginary numbers are directly supported by `Core`. Complex numbers are numbers that have both a real part and an imaginary part.
- `Samsara\Fermat\Coordinates`: Provides different coordinate systems that can be used to characterize points and their relations to each other.
- `Samsara\Fermat\Expressions`: Provides various expressions, generally algebraic, that can be handled as a function instead of as a value.
- `Samsara\Fermat\LinearAlgebra`: Provides for math involving matrices and vectors.
- `Samsara\Fermat\Stats`: Provides for math involving statistics *and* probabilities.

Documentation
-------------

[](#documentation)

The `Samsara\Fermat\Core\Numbers` factory class provides a way to use the Value classes in Fermat without being as specific as those classes may require. Consider the following code:

```
