markrogoyski / math-php

Powerful modern math library for PHP: Features descriptive statistics and regressions; Continuous and discrete probability distributions; Linear algebra with matrices and vectors, Numerical analysis; special mathematical functions; Algebra
MIT License
2.33k stars 240 forks source link

Complex pow #425

Closed Beakerboy closed 3 years ago

markrogoyski commented 3 years ago

Thanks for this pull request. Looks good. I'll fix the link.

markrogoyski commented 3 years ago

Maybe I was too quick to merge it.

This test case is producing a complex with NAN + NANi.

            [
                ['r' => 0, 'i' => 0],
                ['r' => 0, 'i' => 0],
                ['r' => 1, 'i' => 0],
            ],

R thinks it is this:

> complex(real=0, imaginary=0)**complex(real=0, imaginary=0)
[1] 1+0i

And Python:

In [115]: complex(0,0)**complex(0,0)
Out[115]: (1+0j)
Beakerboy commented 3 years ago

In algebra and combinatorics, the generally agreed upon value is 0^0 = 1, whereas in mathematical analysis, the expression is sometimes left undefined. Computer programming languages and software also have differing ways of handling this expression.

coveralls commented 3 years ago

Coverage Status

Coverage decreased (-0.01%) to 99.919% when pulling 86c50e5ba8ef196af66fde27f3d5216ce5928ea9 on Beakerboy:complex-pow into c6349657397a183ffb57225b5bedc73000cecba4 on markrogoyski:develop.