Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 310 and 311] [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403] [Versions 39 and 311]

Class for the management of Complex numbers

Copyright: Copyright (c) 2013-2018 Mark Baker (https://github.com/MarkBaker/PHPComplex)
License: https://opensource.org/licenses/MIT MIT
File Size: 390 lines (11 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Complex:: (14 methods):
  parseComplex()
  __construct()
  getReal()
  getImaginary()
  getSuffix()
  isReal()
  isComplex()
  format()
  __toString()
  validateComplexArgument()
  reverse()
  invertImaginary()
  invertReal()
  __call()


Class: Complex  - X-Ref

Complex Number object.

parseComplex($complexNumber)   X-Ref
Validates whether the argument is a valid complex number, converting scalar or array values if possible

param: mixed    $complexNumber   The value to parse
return: array

__construct($realPart = 0.0, $imaginaryPart = null, $suffix = 'i')   X-Ref
No description

getReal()   X-Ref
Gets the real part of this complex number

return: Float

getImaginary()   X-Ref
Gets the imaginary part of this complex number

return: Float

getSuffix()   X-Ref
Gets the suffix of this complex number

return: String

isReal()   X-Ref
Returns true if this is a real value, false if a complex value

return: Bool

isComplex()   X-Ref
Returns true if this is a complex value, false if a real value

return: Bool

format()   X-Ref
No description

__toString()   X-Ref
No description

validateComplexArgument($complex)   X-Ref
Validates whether the argument is a valid complex number, converting scalar or array values if possible

param: mixed    $complex   The value to validate
return: Complex

reverse()   X-Ref
Returns the reverse of this complex number

return: Complex

invertImaginary()   X-Ref
No description

invertReal()   X-Ref
No description

__call($functionName, $arguments)   X-Ref
Returns the result of the function call or operation

return: Complex|float