Skip to content

Commit

Permalink
Updates to the README document
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkBaker committed Jun 29, 2021
1 parent 10e4e6d commit ab8bc27
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PHPComplex

---

PHP Class for handling Complex numbers
PHP Class Library for working with Complex numbers

[![Build Status](https://github.com/MarkBaker/PHPComplex/workflows/main/badge.svg)](https://github.com/MarkBaker/PHPComplex/actions)
[![Total Downloads](https://img.shields.io/packagist/dt/markbaker/complex)](https://packagist.org/packages/markbaker/complex)
Expand Down Expand Up @@ -65,6 +65,24 @@ together with functions for

---

# Installation

```shell
composer require markbaker/complex:^3.0
```

# Important BC Note

If you've previously been using procedural calls to functions and operations using this library, then from version 3.0 you should use [MarkBaker/PHPComplexFunctions](https://github.com/MarkBaker/PHPComplexFunctions) instead (available on packagist as [markbaker/complex-functions](https://packagist.org/packages/markbaker/complex-functions)).

You'll need to replace `markbaker/complex`in your `composer.json` file with the new library, but otherwise there should be no difference in the namespacing, or in the way that you have called the Complex functions in the past, so no actual code changes are required.

```shell
composer require markbaker/complex-functions:^1.0
```

You should not reference this library (`markbaker/complex`) in your `composer.json`, composer wil take care of that for you.

# Usage

To create a new complex object, you can provide either the real, imaginary and suffix parts as individual values, or as an array of values passed passed to the constructor; or a string representing the value. e.g
Expand Down Expand Up @@ -117,7 +135,7 @@ echo Complex\Operations::add($complexString1, $complexString2);
```
If you want to perform the same operation against multiple values (e.g. to add three or more complex numbers), then you can pass multiple arguments to any of the operations.

You can pass these arguments as Complex objects, or as an array or string that will parse to a complex object.
You can pass these arguments as Complex objects, or as an array, or string that will parse to a complex object.

## Using functions

Expand All @@ -135,6 +153,8 @@ $complexString = '1.23-4.56i';

echo Complex\Functions::sinh($complexString);
```
As with operations, you can pass these arguments as Complex objects, or as an array or string that will parse to a complex object.


In the case of the `pow()` function (the only implemented function that requires an additional argument) you need to pass both arguments when calling the function

Expand Down

0 comments on commit ab8bc27

Please sign in to comment.