Logo

COMPLEX

Updated 2023-11-08 16:51:48.080000

Syntax

SELECT [westclintech].[wct].[COMPLEX] (
  <@Real_num, float,>
 ,<@i_num, float,>
 ,<@Suffix, nvarchar(4000),>)

Description

Use the scalar function COMPLEX to convert real and imaginary coefficients into a complex number of the form x + yi or x + yj.

Arguments

@Suffix

is the suffix for the imaginary component of the complex number. If omitted, @suffix is assumed to be "i".

@Real_num

is the real coefficient of the complex number. @Real_num is an expression of type float or of a type that can be implicitly converted to float.

@i_num

is the imaginary coefficient of the complex number. @i_num is an expression of type float or of a type that can be implicitly converted to float.

Return Type

nvarchar(4000)

Remarks

if @Suffix is entered and is not “i” or “j”, COMPLEX returns an error.

Examples

select wct.COMPLEX(3, 4, NULL);

This produces the following result.

{"columns":[{"field":"column 1"}],"rows":[{"column 1":"3+4i"}]}
select wct.COMPLEX(3, 4, 'j');

This produces the following result.

{"columns":[{"field":"column 1"}],"rows":[{"column 1":"3+4j"}]}
select wct.COMPLEX(0, 1, NULL);

This produces the following result.

{"columns":[{"field":"column 1"}],"rows":[{"column 1":"i"}]}
select wct.COMPLEX(1, 0, NULL);

This produces the following result.

{"columns":[{"field":"column 1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"column 1":"1"}]}