CFLib.org – Common Function Library Project

ComplexNumAbs(ComplexNumber)

Last updated November 15, 2001

author

Matthew Walker

Version: 1 | Requires: CF5 | Library: MathLib

Description:
This function calculates the real number representing the absolute value of a complex number, where the complex number is a structure created earlier using the ComplexNum() UDF. If the real and imaginary parts of the number are the horizontal and vertical sides of a right triangle, the absolute value is the hypotenuse.

Return Values:
Returns a numeric value.

Example:

<cfoutput>
	| 3+4i | = #ComplexNumAbs(ComplexNum(3,4))#
</cfoutput>

Parameters:

Name Description Required
ComplexNumber Structure containing the complex number you want the absolute value for. Yes

Full UDF Source:

/**
 * Absolute value |z| of a complex number.
 * Note that this function uses complex numbers stored as structures by the ComplexNum() UDF also available in this library.
 * 
 * @param ComplexNumber 	 Structure containing the complex number you want the absolute value for. 
 * @return Returns a numeric value. 
 * @author Matthew Walker (matthew@electricsheep.co.nz) 
 * @version 1, November 15, 2001 
 */
function ComplexNumAbs(ComplexNumber){
  return Sqr(ComplexNumber.R^2 + ComplexNumber.I^2);
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson