Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id AFD84200C2F for ; Mon, 6 Mar 2017 15:50:40 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id AE547160B76; Mon, 6 Mar 2017 14:50:40 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 03B78160B73 for ; Mon, 6 Mar 2017 15:50:39 +0100 (CET) Received: (qmail 46120 invoked by uid 500); 6 Mar 2017 14:50:39 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 46109 invoked by uid 99); 6 Mar 2017 14:50:39 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Mar 2017 14:50:39 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 8D6CB18396C for ; Mon, 6 Mar 2017 14:50:38 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -2.347 X-Spam-Level: X-Spam-Status: No, score=-2.347 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-2.999, SPF_NEUTRAL=0.652] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id m7zRBZRcH4g7 for ; Mon, 6 Mar 2017 14:50:37 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 17AFA5FCDA for ; Mon, 6 Mar 2017 14:50:37 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 33F23E04E7 for ; Mon, 6 Mar 2017 14:50:33 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id D5F5A2416E for ; Mon, 6 Mar 2017 14:50:32 +0000 (UTC) Date: Mon, 6 Mar 2017 14:50:32 +0000 (UTC) From: "Eric Barnhill (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (NUMBERS-10) Revamp "Complex" representation ? MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 06 Mar 2017 14:50:40 -0000 [ https://issues.apache.org/jira/browse/NUMBERS-10?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15897428#comment-15897428 ] Eric Barnhill commented on NUMBERS-10: -------------------------------------- "What do other libraries do when conversion would provide some advantage?" Complex.js calls "parse" within the constructor, which can be for Cartesian or Polar, then only stores Cartesian, and all operations are cartesian. This is basically what the old Complex did, with slightly smoother usage. C++ 11 has an Imaginary object with its own behavior. This is mathematically more rigorous as many of the complex trig functions have "slits" where the result depends which side of the phase-circle slit you are on. The key for replicating that sort of behavior is to have a signed zero. As far as I can tell, a method that allowed retention of the polar state of the complex number is not in any other library. It's always converted to real and imaginary. > Revamp "Complex" representation ? > --------------------------------- > > Key: NUMBERS-10 > URL: https://issues.apache.org/jira/browse/NUMBERS-10 > Project: Commons Numbers > Issue Type: Wish > Reporter: Gilles > Labels: API, design, review > Fix For: 1.0 > > Attachments: CartesianRepresentation.java, Complex.java, MixedRepresentation.java, PolarRepresentation.java > > > 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 > {code} > final Complex c1 = Complex.valueOf(1, 2); > final Complex c2 = ComplexUtils.polar2Complex(2, 7); > final Complex r = c1.add(c2); > {code} > with the current code, to > {code} > final Complex c1 = Complex.createCartesian(1, 2); > final Complex c2 = Complex.createPolar(2, 7); > final Complex r = c1.add(c2); > {code} > 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? -- This message was sent by Atlassian JIRA (v6.3.15#6346)