IMCOT Function (LibreOffice Calc)
Learn the IMCOT function in LibreOffice Calc: Returns the cotangent of a complex number.
Verification status: Selected examples were executed in LibreOffice Calc 25.2.3.2. This does not establish that every formula and edge case was tested. How formula examples are checked
Quick answer
IMCOT calculates the cotangent of a complex number. Type =IMCOT("1+i") in a Calc cell to calculate a complex result. Native Calc 25.2.3.2 observed: 0.217621561854403-0.868014142895925i. The result is text, not a native spreadsheet complex-number data type; =ISTEXT(IMCOT(2)) was TRUE in the native tests. Official function reference.
Syntax and arguments
IMCOT(Complex_number)
Complex_number — Required. A complex number as text, such as "1+i", "4-3i", or "1+2j"; or a real numeric value such as 2 when the imaginary part is zero. It may also be a reference to a cell containing a valid complex-number string, or a result of COMPLEX.
There is one required argument and no optional/default arguments. LibreOffice’s official Help says the function has been available since LibreOffice 3.6. Current documentation is served at the latest URL; the checked page displayed 26.2 Help (cached view of /latest/ URL) on 2026-10-11. Native calculations in the recorded checks used 25.2.3.2 on Linux; newer-version behaviour and Windows/macOS were not tested. LibreOffice IMCOT Help.
Regional settings: English function names are used in this article. Function arguments in Calc can be separated with semicolons, as shown in =COMPLEX(3;4;"i"); IMCOT itself has only one argument. Complex-number text has the i or j suffix; do not assume that a locale’s displayed decimal separators or formatting can be pasted into a complex-number string unchanged. The simple examples use whole-number components to avoid that ambiguity.
Mathematical meaning: For z = a + bi, cotangent is the reciprocal of tangent where it is defined; complex values are expressed as text with i or j. Specifically, cot(z) = cos(z) / sin(z) when the denominator is nonzero. A direct IMCOT call avoids manually assembling the ratio and preserves Calc’s documented complex-string output. Function definition.
Reproducible sample sheet
Create an ordinary Calc worksheet and enter the following text values exactly in column A (type complex inputs as text). Fill column B with the formulas shown, using the sample English function name. Each displayed result below was read back from an actual headless LibreOffice Calc 25.2.3.2 spreadsheet on 2026-10-11.
On a narrow screen, scroll this table sideways to see every column.
| Cell A | Input | Cell B formula | Native observed output |
|---|---|---|---|
| A2 | 1+i (text) |
=IMCOT(A2) |
0.217621561854403-0.868014142895925i |
| A3 | 4-3i (text) |
=IMCOT(A3) |
0.00490118239430447+0.999266927805902i |
| A4 | 1+2j (text) |
=IMCOT(A4) |
0.0327977555337526-0.984329226458191j |
The formula =IMCOT("4-3i") independently returned 0.00490118239430447+0.999266927805902i without a cell reference, matching LibreOffice’s official example to the displayed precision. Vendor example.
For a real argument, =IMCOT(2) returned the text -0.457657554360286. A real input value is allowed, but a real-looking answer is still a string. This differs from calling an ordinary real-valued trigonometric function such as TAN or COS.
Advanced example: compose complex input and check a reciprocal identity
To build input from separate coefficients, enter numeric 3 in B2 and 4 in C2, and use:
=IMCOT(COMPLEX(B2;C2;"i"))
Native observed: -0.000187587737983659-1.00064439247156i. The COMPLEX function constructs the complex string from numeric parts. Check the i vs j suffix when moving results between workbooks. LibreOffice Calc add-in function reference.
For an internal consistency check with the worksheet’s A2 = 1+i, calculate:
=IMPRODUCT(IMTAN(A2);IMCOT(A2))
Native observed: 0.999999999999996-8.88178419700125e-16i, approximately 1+0i (floating-point roundoff may leave tiny residual components). This relation is valid only away from zero denominators; it is a consistency check, not proof that every input or workbook conversion is safe. Unlike the sampled formula outputs, the general mathematical identity follows from the definitions of the trigonometric functions.
A realistic use case
A use case is expressing a complex response as the ratio of the cosine to the sine. Avoid dividing by a numerically near-zero sine without checking its magnitude. In a larger worksheet, keep raw complex inputs in column A, apply IMCOT in column B, and use IMREAL or IMAGINARY in reporting columns if you need a numeric real or imaginary coefficient. A standalone IMCOT result should not be blindly averaged or summed with ordinary numeric spreadsheet functions because its return type is text. IMREAL and IMAGINARY are separate Calc functions documented in the add-in guide; component-extraction columns were not executed in the recorded checks.
Errors, edge cases and limitations
On a narrow screen, scroll this table sideways to see every column.
| Situation | What happens / what to check | Evidence type |
|---|---|---|
Malformed input such as =IMCOT("bad") |
Err:502 (502), not a valid complex result |
Observed in Calc 25.2.3.2 |
Invalid imaginary unit such as =IMCOT("1+2k") |
Err:502 (502) |
Observed in Calc 25.2.3.2 |
| Input zero | =IMCOT(0) returned Err:502 in this run. |
Native observed on Calc 25.2.3.2 |
| Pole / singularity | IMCOT is undefined when sin(z) is zero. =IMCOT(0) produced Err:502 in Calc 25.2.3.2, so treat that case explicitly instead of supplying a made-up infinity. |
Mathematical definition; where stated, single-case native observation |
| Result looks like a real number | It can still be text. Confirm with ISTEXT; use component functions before numeric aggregation. |
Native type check, official documentation |
Unexpected i/j notation |
Verify that input and output are valid complex strings, and do not mix suffix conventions unintentionally. | Official documentation, practical troubleshooting |
Complex functions can be sensitive near singularities or for very large arguments; this batch verified selected examples only, not numerical stability over the whole complex plane. Exact error displays can differ with locale, versions, and application settings. This draft does not contain screenshots.
Troubleshooting checklist
- Verify input text. If the argument is meant to be complex, ensure
A2actually contains1+i, not a numeric zero or a display-only label. Re-enter the string and calculate again. - Check the imaginary unit. LibreOffice expects
iorj. The letterkin1+2kcausedErr:502in the recorded checks. - Check the formula name.
IMCOTtakes one argument. To build a number from two components, useCOMPLEX(real; imaginary; "i")insideIMCOTinstead of passing two top-level arguments. - Consider the function’s domain. cot(z) = cos(z) / sin(z); if sin(z) is zero, a finite result is mathematically undefined.
- Check output type. Calc returns complex results as text;
ISTEXTis an appropriate diagnostic. UseIMREAL/IMAGINARYwhen subsequent formulas need numeric components. - Recheck migrated formulas. OpenDocument and Excel both document functions with this spelling, but workbook conversion, prefix handling and regional settings can change portability. Test a copy of the target workbook before relying on results.
Compatibility with Excel and other spreadsheet software
LibreOffice documents IMCOT with one complex-number argument and reports it as a string. Microsoft Excel independently documents the same function name with one required inumber argument, also returning a complex number in x+yi or x+yj text format; its published invalid-input error names (for example #NUM!) should not be substituted for the Err:502 observed in LibreOffice. See Microsoft’s IMCOT reference.
The LibreOffice help identifies IMCOT as part of OpenDocument 1.2, but that alone does not guarantee round-trip formula compatibility in every XLSX or ODS export setting. Exact behaviour in Google Sheets, Apple Numbers and other spreadsheet software was not verified in this run. An available mathematical alternative is cosine divided by sine, subject to the same zero-denominator limitations.
Related LibreOffice function tutorials
Official references
- Direct vendor source: LibreOffice IMCOT function (checked 2026-10-11; displayed help version 26.2 Help (cached view of /latest/ URL)).
- Category / construction help: LibreOffice add-in engineering functions (checked 2026-10-11; complex representations and
COMPLEX). - Cross-software source: Microsoft IMCOT function (checked 2026-10-11; Excel argument syntax and output type only).
- Testing: Native LibreOffice Calc 25.2.3.2 on Linux using a real Calc spreadsheet via UNO, with independent Python
cmathchecks to 1e-9 relative/absolute scale. Tests forIMCOTincluded text/real inputs, cell references,jnotation, constructed complex inputs, and a reciprocal identity. The original test records are retained with the release audit. No Excel, Google Sheets, Mac or Windows native execution was performed.
How this guide was checked
Selected example formulas were run in LibreOffice Calc 25.2.3.2 on Linux on October 12, 2026. The official Help may cover a newer version. Tests of selected formulas do not certify every locale, interactive array operation or file round trip. View the example-check record.