You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2017/04/25 23:00:39 UTC
commons-numbers git commit: NUMBERS-28: Added cis() method to Complex
Repository: commons-numbers
Updated Branches:
refs/heads/cis-method [created] 4f28fca00
NUMBERS-28: Added cis() method to Complex
Project: http://git-wip-us.apache.org/repos/asf/commons-numbers/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-numbers/commit/4f28fca0
Tree: http://git-wip-us.apache.org/repos/asf/commons-numbers/tree/4f28fca0
Diff: http://git-wip-us.apache.org/repos/asf/commons-numbers/diff/4f28fca0
Branch: refs/heads/cis-method
Commit: 4f28fca006f6e9076c8e52c42dbb6b0682ea3166
Parents: 1e4947b
Author: Eric Barnhill <er...@apache.org>
Authored: Wed Apr 26 01:00:13 2017 +0200
Committer: Eric Barnhill <er...@apache.org>
Committed: Wed Apr 26 01:00:13 2017 +0200
----------------------------------------------------------------------
.../java/org/apache/commons/numbers/complex/Complex.java | 11 +++++++++++
1 file changed, 11 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/4f28fca0/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java
----------------------------------------------------------------------
diff --git a/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java b/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java
index 4e9022e..c7c7b0b 100644
--- a/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java
+++ b/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java
@@ -95,6 +95,17 @@ public class Complex implements Serializable {
}
/**
+ * For a real constructor argument x, returns a new Complex object c
+ * where {@code c = cos(x) + i sin (x)}
+ *
+ * @param x {@code double} to build the cis number
+ * @return {@code Complex}
+ */
+ public Complex cis(double x) {
+ return new Complex(Math.cos(x), Math.sin(x));
+ }
+
+ /**
* Return the absolute value of this complex number.
* Returns {@code NaN} if either real or imaginary part is {@code NaN}
* and {@code Double.POSITIVE_INFINITY} if neither part is {@code NaN},