Logo

IMADD

Updated 2024-03-13 15:31:52.337000

Syntax

SELECT [westclintech].[wct].[IMADD] (
  <@inumber1, nvarchar(4000),>
 ,<@inumber2, nvarchar(4000),>)

Description

Use the scalar function IMADD to return the sum of 2 complex numbers in x + yi or x + yj text format. The sum of 2 complex numbers is computed as:

(a+bi)+(c+di)=(a+c)+(b+d)i

Arguments

@inumber2

is the second value used in evaluating the function. @inumber2 is an expression of type varchar or of a type that can be implicitly converted to varchar and must be in the format x + yi or x + yj, where x is a real number that can be converted to float and yi (or yj) is an imaginary number, where the y part can be converted to float.

@inumber1

is the first value used in evaluating the function. @inumber1 is an expression of type varchar or of a type that can be implicitly converted to varchar and must be in the format x + yi or x + yj, where x is a real number that can be converted to float and yi (or yj) is an imaginary number, where the y part can be converted to float.

Return Type

nvarchar(4000)

Remarks

Use COMPLEX to convert real and imaginary coefficients into a complex number.

Examples

select wct.IMADD('7+24i', '6-25i');

This produces the following result.

{"columns":[{"field":"column 1"}],"rows":[{"column 1":"13-i"}]}