Formualizer Docs

IMCOS

Returns the cosine of a complex number.

Evaluates complex cosine and returns the result as complex text.

The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.

Syntax

=IMCOS(inumber)

Arguments

ArgumentTypeRequiredDefault
inumberanyRequired—

Return type

Can return text.

How it works

The complex cosine is (exp(iz) + exp(−iz)) / 2. It is defined everywhere in the complex plane.

Differences from Excel

The raw Formualizer text can contain more significant digits than Excel’s complex-number text. The examples round each coefficient to 15 significant digits for display.

Remarks

  • Input is coerced to complex-number text before parsing.
  • Uses hyperbolic components for the imaginary part.

Error cases

  • Invalid complex text returns #NUM!.

Examples

Calculate cosine with real angle 3 and imaginary part 4.

Formula =IMCOS("3+4i")

Expected result -27.0349456030742-3.85115333481178i

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Change the sign of the imaginary part to conjugate the cosine.

Formula =IMCOS("3-4j")

Expected result -27.0349456030742+3.85115333481178j

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

At a purely real angle of one radian this reduces to real cosine.

Formula =IMCOS("1")

Expected result 0.54030230586814

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

The text “invalid” has no complex value from which to take the complex cosine.

Formula =IMCOS("invalid")

Expected result #NUM!

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Cosine of zero

Formula =IMCOS("0")

Expected result 1

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Cosine on imaginary axis

Formula =IMCOS("i")

Expected result 1.54308063481524

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

FAQ

Why is the imaginary part negated in IMCOS?

Complex cosine uses cos(a+bi)=cos(a)cosh(b)-i sin(a)sinh(b), so the imaginary term carries a minus sign.

Implementation

Engine source

On this page