Learn R Programming

gmwm (version 2.0.0)

Mod_cpp: Absolute Value or Modulus of a Complex Number.

Description

Computes the value of the Modulus.

Usage

Mod_cpp(x)

Arguments

x
A cx_vec.

Value

A vec containing the modulus for each element.

Details

Consider a complex number defined as: $z = x + i y$ with real $x$ and $y$, The modulus is defined as: $r = Mod(z) = \sqrt{(x^2 + y^2)}$

Examples

Run this code
Mod_cpp(c(1+.5i, 2+1i, 5+9i))

Run the code above in your browser using DataLab