abs.php 828 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. /**
  3. *
  4. * Function code for the complex abs() function
  5. *
  6. * @copyright Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
  7. * @license https://opensource.org/licenses/MIT MIT
  8. */
  9. namespace Complex;
  10. /**
  11. * Returns the absolute value (modulus) of a complex number.
  12. * Also known as the rho of the complex number, i.e. the distance/radius
  13. * from the centrepoint to the representation of the number in polar coordinates.
  14. *
  15. * This function is a synonym for rho()
  16. *
  17. * @param Complex|mixed $complex Complex number or a numeric value.
  18. * @return float The absolute (or rho) value of the complex argument.
  19. * @throws Exception If argument isn't a valid real or complex number.
  20. *
  21. * @see rho
  22. *
  23. */
  24. function abs($complex)
  25. {
  26. return rho($complex);
  27. }