Uploaded image for project: 'Commons Numbers'
  1. Commons Numbers
  2. NUMBERS-10

Revamp "Complex" representation ?

    XMLWordPrintableJSON

Details

    • Wish
    • Status: Closed
    • Major
    • Resolution: Won't Do
    • None
    • 1.0-beta1
    • None

    Description

      This is a proposal to enhance the internal representation of complex numbers.

      The purpose is to allow usage of both cartesian and polar representations, with the aim that calculations are performed (transparently) with the one that will be more accurate and/or faster.

      The API would certainly be improved, from

              final Complex c1 = Complex.valueOf(1, 2);
              final Complex c2 = ComplexUtils.polar2Complex(2, 7);
              final Complex r = c1.add(c2);
       

      with the current code, to

              final Complex c1 = Complex.createCartesian(1, 2);
              final Complex c2 = Complex.createPolar(2, 7);
              final Complex r = c1.add(c2);
      

      Please refer to the attached files (they are self-documenting, but of course, Javadoc must be added if the proposal is validated).

      Would there be merit in pursuing in that direction?
      Or is there any show-stopper?

      Attachments

        1. MixedRepresentation.java
          0.9 kB
          Gilles Sadowski
        2. PolarRepresentation.java
          1 kB
          Gilles Sadowski
        3. CartesianRepresentation.java
          0.9 kB
          Gilles Sadowski
        4. Complex.java
          3 kB
          Gilles Sadowski

        Activity

          People

            Unassigned Unassigned
            erans Gilles Sadowski
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: