Java Doc for Complex.java in  » Science » Apache-commons-math-1.1 » org » apache » commons » math » complex » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Science » Apache commons math 1.1 » org.apache.commons.math.complex 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.commons.math.complex.Complex

Complex
public class Complex implements Serializable(Code)
Representation of a Complex number - a number which has both a real and imaginary part.

Implementations of arithmetic operations handle NaN and infinite values according to the rules for java.lang.Double arithmetic, applying definitional formulas and returning NaN or infinite values in real or imaginary parts as these arise in computation. See individual method javadocs for details.

Complex.equals identifies all values with NaN in either real or imaginary part - e.g.,

 1 + NaNi  == NaN + i == NaN + NaNi.

author:
   Apache Software Foundation
version:
   $Revision: 349309 $ $Date: 2005-11-27 13:55:08 -0700 (Sun, 27 Nov 2005) $


Field Summary
final public static  ComplexI
     The square root of -1.
final public static  ComplexNaN
    
final public static  ComplexONE
    
final public static  ComplexZERO
    
protected  doubleimaginary
    
protected  doublereal
    

Constructor Summary
public  Complex(double real, double imaginary)
     Create a complex number given the real and imaginary parts.

Method Summary
public  doubleabs()
     Return the absolute value of this complex number.
public  Complexadd(Complex rhs)
     Return the sum of this complex number and the given complex number.

Uses the definitional formula

 (a + bi) + (c + di) = (a+c) + (b+d)i
 

If either this or rhs has a NaN value in either part, Complex.NaN is returned; otherwise Inifinite and NaN values are returned in the parts of the result according to the rules for java.lang.Double arithmetic.

public  Complexconjugate()
     Return the conjugate of this complex number.
public  Complexdivide(Complex rhs)
     Return the quotient of this complex number and the given complex number.
public  booleanequals(Object other)
     Test for the equality of two Complex objects.

If both the real and imaginary parts of two Complex numbers are exactly the same, and neither is Double.NaN, the two Complex objects are considered to be equal.

public  doublegetImaginary()
     Access the imaginary part.
public  doublegetReal()
     Access the real part.
public  inthashCode()
     Get a hashCode for the complex number.
public  booleanisInfinite()
     Returns true if either the real or imaginary part of this complex number takes an infinite value (either Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY) and neither part is NaN.
public  booleanisNaN()
    
public  Complexmultiply(Complex rhs)
     Return the product of this complex number and the given complex number.

Implements the definitional formula:


 (a + bi)(c + di) = (ac - bd) + (ad + bc)i
 

Returns Complex.NaN if either this or rhs has one or more NaN parts.

Returns NaN or infinite values in components of the result per the definitional formula and and the rules for java.lang.Double arithmetic.

public  Complexnegate()
     Return the additive inverse of this complex number.
public  Complexsubtract(Complex rhs)
     Return the difference between this complex number and the given complex number.

Uses the definitional formula

 (a + bi) - (c + di) = (a-c) + (b-d)i
 

If either this or rhs has a NaN value in either part, Complex.NaN is returned; otherwise inifinite and NaN values are returned in the parts of the result according to the rules for java.lang.Double arithmetic.


Field Detail
I
final public static Complex I(Code)
The square root of -1. A number representing "0.0 + 1.0i"



NaN
final public static Complex NaN(Code)
A complex number representing "NaN + NaNi"



ONE
final public static Complex ONE(Code)
A complex number representing "1.0 + 0.0i"



ZERO
final public static Complex ZERO(Code)
A complex number representing "0.0 + 0.0i"



imaginary
protected double imaginary(Code)
The imaginary part



real
protected double real(Code)
The real part




Constructor Detail
Complex
public Complex(double real, double imaginary)(Code)
Create a complex number given the real and imaginary parts.
Parameters:
  real - the real part
Parameters:
  imaginary - the imaginary part




Method Detail
abs
public double abs()(Code)
Return the absolute value of this complex number.

Returns NaN if either real or imaginary part is NaN and Double.POSITIVE_INFINITY if neither part is NaN, but at least one part takes an infinite value. the absolute value




add
public Complex add(Complex rhs)(Code)
Return the sum of this complex number and the given complex number.

Uses the definitional formula

 (a + bi) + (c + di) = (a+c) + (b+d)i
 

If either this or rhs has a NaN value in either part, Complex.NaN is returned; otherwise Inifinite and NaN values are returned in the parts of the result according to the rules for java.lang.Double arithmetic.
Parameters:
  rhs - the other complex number the complex number sum
throws:
  NullPointerException - if rhs is null




conjugate
public Complex conjugate()(Code)
Return the conjugate of this complex number. The conjugate of "A + Bi" is "A - Bi".

Complex.NaN is returned if either the real or imaginary part of this Complex number equals Double.NaN.

If the imaginary part is infinite, and the real part is not NaN, the returned value has infinite imaginary part of the opposite sign - e.g. the conjugate of 1 + POSITIVE_INFINITY i is 1 - NEGATIVE_INFINITY i the conjugate of this Complex object




divide
public Complex divide(Complex rhs)(Code)
Return the quotient of this complex number and the given complex number.

Implements the definitional formula


 a + bi          ac + bd + (bc - ad)i
 ----------- = -------------------------
 c + di               c2 + d2
 
but uses prescaling of operands to limit the effects of overflows and underflows in the computation.

Infinite and NaN values are handled / returned according to the following rules, applied in the order presented:

  • If either this or rhs has a NaN value in either part, Complex.NaN is returned.
  • If rhs equals Complex.ZERO , Complex.NaN is returned.
  • If this and rhs are both infinite, Complex.NaN is returned.
  • If this is finite (i.e., has no infinite or NaN parts) and rhs is infinite (one or both parts infinite), Complex.ZERO is returned.
  • If this is infinite and rhs is finite, NaN values are returned in the parts of the result if the java.lang.Double rules applied to the definitional formula force NaN results.

Parameters:
  rhs - the other complex number the complex number quotient
throws:
  NullPointerException - if rhs is null



equals
public boolean equals(Object other)(Code)
Test for the equality of two Complex objects.

If both the real and imaginary parts of two Complex numbers are exactly the same, and neither is Double.NaN, the two Complex objects are considered to be equal.

All NaN values are considered to be equal - i.e, if either (or both) real and imaginary parts of the complex number are equal to Double.NaN, the complex number is equal to Complex.NaN.
Parameters:
  other - Object to test for equality to this true if two Complex objects are equal, false ifobject is null, not an instance of Complex, ornot equal to this Complex instance




getImaginary
public double getImaginary()(Code)
Access the imaginary part. the imaginary part



getReal
public double getReal()(Code)
Access the real part. the real part



hashCode
public int hashCode()(Code)
Get a hashCode for the complex number.

All NaN values have the same hash code. a hash code value for this object




isInfinite
public boolean isInfinite()(Code)
Returns true if either the real or imaginary part of this complex number takes an infinite value (either Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY) and neither part is NaN. true if one or both parts of this complex number are infiniteand neither part is NaN



isNaN
public boolean isNaN()(Code)
Returns true if either or both parts of this complex number is NaN; false otherwise true if either or both parts of this complex number is NaN;false otherwise



multiply
public Complex multiply(Complex rhs)(Code)
Return the product of this complex number and the given complex number.

Implements the definitional formula:


 (a + bi)(c + di) = (ac - bd) + (ad + bc)i
 

Returns Complex.NaN if either this or rhs has one or more NaN parts.

Returns NaN or infinite values in components of the result per the definitional formula and and the rules for java.lang.Double arithmetic. Examples:


 (1 + i) (INF + i)  =  INF + INFi
 (1 + INFi) (1 - INFi) = INF + NaNi
 (-INF + -INFi)(1 + NaNi) = NaN + NaNi
 

Parameters:
  rhs - the other complex number the complex number product
throws:
  NullPointerException - if rhs is null



negate
public Complex negate()(Code)
Return the additive inverse of this complex number.

Returns Complex.NaN if either real or imaginary part of this Complex number equals Double.NaN. the negation of this complex number




subtract
public Complex subtract(Complex rhs)(Code)
Return the difference between this complex number and the given complex number.

Uses the definitional formula

 (a + bi) - (c + di) = (a-c) + (b-d)i
 

If either this or rhs has a NaN value in either part, Complex.NaN is returned; otherwise inifinite and NaN values are returned in the parts of the result according to the rules for java.lang.Double arithmetic.
Parameters:
  rhs - the other complex number the complex number difference
throws:
  NullPointerException - if rhs is null




Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.