CFLib.org – Common Function Library Project

ComplexNum(Real, Imaginary)

Last updated November 15, 2001

author

Matthew Walker

Version: 1 | Requires: CF5 | Library: MathLib

Description:
This function simply builds a structure representing a complex number. This is a useful format to enable working with complex numbers.

Return Values:
Returns a structure representing a complex number with the keys R and I.

Example:

<cfset c = ComplexNum(5,-1)>
<cfdump var="#c#">

Parameters:

Name Description Required
Real Real part of the complex number. Yes
Imaginary Imaginary part of the complex number. Yes

Full UDF Source:

/**
 * Create a complex number as a structure.
 * 
 * @param Real      Real part of the complex number. 
 * @param Imaginary      Imaginary part of the complex number. 
 * @return Returns a structure representing a complex number with the keys R and I. 
 * @author Matthew Walker (matthew@electricsheep.co.nz) 
 * @version 1, November 15, 2001 
 */
function ComplexNum(Real,Imaginary) {
  var ComplexNumber = StructNew();
  ComplexNumber.R=Real;
  ComplexNumber.I=Imaginary;
  return ComplexNumber;
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson