Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402]

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: 388 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