CSERD


  • userhome
  • catalog
  • resources
  • help

Complex class


Shodor > CSERD > Resources > Libraries > Complex class

  Download Source Code  •  Documentation  •  View License Agreement


Complex class documentation

Complex is a class used for mathematics of complex numbers. It includes addition, multiplication, conjugation, and exponentiation.

Languages:

  • C++
  • Java

    C++

    Member variables

    
     private:
       double r;        // real part of complex number
       double i;        // imaginary part of complex number
    

    Methods

  • Constructor: Complex()
  • Constructor: Complex(double r, double i)
  • Constructor: Complex(Complex *z)
  • Destructor: ~Complex()
  • void set(double r, double i)
  • void setReal(double r)
  • void setImag(double i)
  • Complex exp()
  • Complex conjugate()
  • double getReal()
  • double getImag()
  • Complex times(Complex z)
  • Complex times(double x)
  • Complex plus(Complex z)
  • Complex plus(double x)
  • Complex minus(Complex z)
  • Complex minus(double x)

    Java

    Member variables

    
        private double r;    // real part of complex number
        private double i;    // imaginary part of complex number
    

    Methods

  • Constructor: public Complex(){
  • Constructor: public Complex(double r, double i){
  • Constructor: public Complex(Complex z){
  • public void set(double r,double i){
  • public void setReal(double r){
  • public void setImag(double i){
  • public Complex exp(){
  • public Complex conjugate(){
  • public double getReal(){
  • public double getImag(){
  • public Complex times(Complex z){
  • public Complex times(double x){
  • public Complex plus(Complex z){
  • public Complex plus(double x){
  • public Complex minus(Complex z){
  • public Complex minus(double x){

  • ©1994-2024 Shodor