.. _api_javascript_complex: ======================== JavaScript API Reference ======================== ------- ------- complex ------- .. code:: javascript new dime.Complex(real, imaginary) Creates a new DiME Complex object. +-----------------------------------------------------------------------------------------------------------------------------+ | Parameters | +==================+================================+=========================================================================+ | Name | Type | Description | +------------------+--------------------------------+-------------------------------------------------------------------------+ | real | number | The real number part of the complex number. | +------------------+--------------------------------+-------------------------------------------------------------------------+ | imaginary | number | The imaginary part of the complex number. | +------------------+--------------------------------+-------------------------------------------------------------------------+ | +-----------------------------------------------------------------------------------------------------+ | Returns | +================================+====================================================================+ | Type | Description | +--------------------------------+--------------------------------------------------------------------+ | Complex | The newly created Complex object. | +--------------------------------+--------------------------------------------------------------------+ --- add --- .. code:: javascript Complex.add(rhs) Adds two Complex objects. +-----------------------------------------------------------------------------------------------------------------------------+ | Parameters | +==================+================================+=========================================================================+ | Name | Type | Description | +------------------+--------------------------------+-------------------------------------------------------------------------+ | rhs | Complex | The Complex object on the right hand side of the equation. | +------------------+--------------------------------+-------------------------------------------------------------------------+ | +-----------------------------------------------------------------------------------------------------+ | Returns | +================================+====================================================================+ | Type | Description | +--------------------------------+--------------------------------------------------------------------+ | Complex | The sum of the two Complex objects. | +--------------------------------+--------------------------------------------------------------------+ --- sub --- .. code:: javascript Complex.sub(rhs) Subtracts two Complex objects. +-----------------------------------------------------------------------------------------------------------------------------+ | Parameters | +==================+================================+=========================================================================+ | Name | Type | Description | +------------------+--------------------------------+-------------------------------------------------------------------------+ | rhs | Complex | The Complex object on the right hand side of the equation | | | | (the subtractor). | +------------------+--------------------------------+-------------------------------------------------------------------------+ | +-----------------------------------------------------------------------------------------------------+ | Returns | +================================+====================================================================+ | Type | Description | +--------------------------------+--------------------------------------------------------------------+ | Complex | The difference of the two Complex objects. | +--------------------------------+--------------------------------------------------------------------+ --- mul --- .. code:: javascript Complex.mul(rhs) Multiplies two Complex objects. +-----------------------------------------------------------------------------------------------------------------------------+ | Parameters | +==================+================================+=========================================================================+ | Name | Type | Description | +------------------+--------------------------------+-------------------------------------------------------------------------+ | rhs | Complex | The Complex object on the right hand side of the equation. | +------------------+--------------------------------+-------------------------------------------------------------------------+ | +-----------------------------------------------------------------------------------------------------+ | Returns | +================================+====================================================================+ | Type | Description | +--------------------------------+--------------------------------------------------------------------+ | Complex | The product of the two Complex objects. | +--------------------------------+--------------------------------------------------------------------+ --- div --- .. code:: javascript Complex.div(rhs) Divides two Complex objects. +-----------------------------------------------------------------------------------------------------------------------------+ | Parameters | +==================+================================+=========================================================================+ | Name | Type | Description | +------------------+--------------------------------+-------------------------------------------------------------------------+ | rhs | Complex | The Complex object on the right hand side of the equation | | | | (the divisor). | +------------------+--------------------------------+-------------------------------------------------------------------------+ | +-----------------------------------------------------------------------------------------------------+ | Returns | +================================+====================================================================+ | Type | Description | +--------------------------------+--------------------------------------------------------------------+ | Complex | The product of the two Complex objects. | +--------------------------------+--------------------------------------------------------------------+