Documentation/Calc Functions/IMSUB

From The Document Foundation Wiki
Jump to navigation Jump to search

Function name:

IMSUB

Category:

Add-in

Summary:

Calculates the result of subtracting one complex number from another.

Syntax:

IMSUB(ComplexNumber1; ComplexNumber2)

Returns:

Returns a text string giving the complex number that results when subtracting one complex number from another.

Arguments:

ComplexNumber1 is a string (in quotation marks) representing a complex number in the form a+bi or a+bj, or a reference to a cell containing that string, which is the minuend of the subtraction operation. a and b are real numbers.

ComplexNumber2 is a string (in quotation marks) representing a complex number in the form a+bi or a+bj, or a reference to a cell containing that string, which is the subtrahend of the subtraction operation. a and b are real numbers.

  • If either ComplexNumber1 or ComplexNumber2 does not have an imaginary part (b or d equal to 0), that argument’s real part can be passed to IMSUB as a number rather than a string.
  • If either ComplexNumber1 or ComplexNumber2 is not a valid complex number, IMSUB reports an invalid argument error (Err:502).
  • If ComplexNumber1 and ComplexNumber2 use different imaginary units (i or j), IMSUB returns the result using the imaginary unit of ComplexNumber1.

Additional details:

Details specific to IMSUB function

For complex numbers of the form a+bi and c+di, IMSUB implements the following equation:

Equation for IMSUB function

General information about Calc's handling of complex numbers

Note pin.svg

For convenience, the information in this subsection is repeated on all pages describing functions that manipulate complex numbers.


  • A complex number is a number that can be expressed in the form a+bi, where a and b are real numbers and i is a symbol for the imaginary unit, such that i2=−1. a is known as the real part of the complex number and b is known as its imaginary part.
  • In some disciplines using i to indicate the imaginary unit may be undesirable and, in such cases, the symbol j may be used instead. The functions provided by Calc to process complex numbers can use either i or j.
  • For additional general background information, visit Wikipedia’s Complex number page.
  • Within Calc, a complex number is represented as a string expression of the form "a+bi" or "a+bj", where a and b are real numbers. If the complex number happens to be a real number (b=0), then it can be represented as either a string expression or a numeric value. Complex number string expressions should not contain any space characters. Examples of valid Calc complex numbers include "2", -6, "2+3i", "3j", "12.34+56.78i", and "1e+23-1e-22j". Calc would not recognize the strings "1+j2", "i+1", and "i+j" as valid complex numbers.
  • The representation of the complex numbers in strings can have up to 15 significant digits and scientific style is automatically used if needed (visit Wikipedia’s Scientific notation page for more information). The decimal delimiter in complex number string expressions is always a dot, irrespective of locale setting.

Examples:

Formula Description Returns
=IMSUB("-238+240i";"10+24i") Here the function calculates the result of subtracting the second complex number from the first. -248+216i
=IMSUB("9+8j"; "1+2i") Here the function calculates the result of subtracting the second complex number from the first, using the imaginary unit of the first argument. 8+6j
=IMSUB(3; -2) Here the function calculates the result of subtracting the second number from the first. 5
=IMSUB(E1; E2) where cells E1 and E2 contain the complex numbers 1.2-3.4i and 5.6+7.8j respectively. Here the function calculates the result of subtracting the second complex number from the first, again using the imaginary unit of the first argument. The two complex numbers are entered in cells. -4.4-11.2i

Related LibreOffice functions:

IMDIV

IMPRODUCT

IMSUM

ODF standard:

Section 6.8.25, part 2

Equivalent Excel functions:

IMSUB