Java Doc for ComplexUtils.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.ComplexUtils

ComplexUtils
public class ComplexUtils (Code)
Static implementations of common org.apache.commons.math.complex.Complex -valued functions. Included are trigonometric, exponential, log, power and square root functions.

Reference:

See individual method javadocs for the computational formulas used. In general, NaN values in either real or imaginary parts of input arguments result in Complex.NaN returned. Otherwise, infinite or NaN values are returned as they arise in computing the real functions specified in the computational formulas. Null arguments result in NullPointerExceptions.
version:
   $Revision: 349387 $ $Date: 2005-11-27 23:15:46 -0700 (Sun, 27 Nov 2005) $




Method Summary
public static  Complexacos(Complex z)
     Compute the inverse cosine for the given complex argument.
public static  Complexasin(Complex z)
     Compute the inverse sine for the given complex argument.

Implements the formula:

  asin(z) = -i (log(sqrt(1 - z2) + iz)) 

Returns Complex.NaN if either real or imaginary part of the input argument is NaN or infinite.
Parameters:
  z - the value whose inverse sine is to be returned.

public static  Complexatan(Complex z)
     Compute the inverse tangent for the given complex argument.

Implements the formula:

  atan(z) = (i/2) log((i + z)/(i - z)) 

Returns Complex.NaN if either real or imaginary part of the input argument is NaN or infinite.

public static  Complexcos(Complex z)
     Compute the cosine for the given complex argument.
public static  Complexcosh(Complex z)
     Compute the hyperbolic cosine for the given complex argument.

Implements the formula:

  cosh(a + bi) = cosh(a)cos(b) + sinh(a)sin(b)i
where the (real) functions on the right-hand side are java.lang.Math.sin , java.lang.Math.cos , MathUtils.cosh and MathUtils.sinh .

Returns Complex.NaN if either real or imaginary part of the input argument is NaN.

Infinite values in real or imaginary parts of the input may result in infinite or NaN values returned in parts of the result.

 Examples: 
 
 cosh(1 ± INFINITY i) = NaN + NaN i
 cosh(±INFINITY + i) = INFINITY ± INFINITY i
 cosh(±INFINITY ± INFINITY i) = NaN + NaN i

Throws NullPointerException if z is null.
Parameters:
  z - the value whose hyperbolic cosine is to be returned.

public static  Complexexp(Complex z)
     Compute the exponential function for the given complex argument.
public static  Complexlog(Complex z)
     Compute the natural logarithm for the given complex argument.

Implements the formula:

  log(a + bi) = ln(|a + bi|) + arg(a + bi)i
where ln on the right hand side is java.lang.Math.log , |a + bi| is the modulus, Complex.abs , and arg(a + bi) = java.lang.Math.atan2 (b, a)

Returns Complex.NaN if either real or imaginary part of the input argument is NaN.

Infinite (or critical) values in real or imaginary parts of the input may result in infinite or NaN values returned in parts of the result.

 Examples: 
 
 log(1 ± INFINITY i) = INFINITY ± (π/2)i
 log(INFINITY + i) = INFINITY + 0i
 log(-INFINITY + i) = INFINITY + πi
 log(INFINITY ± INFINITY i) = INFINITY ± (π/4)i
 log(-INFINITY ± INFINITY i) = INFINITY ± (3π/4)i
 log(0 + 0i) = -INFINITY + 0i
 
Throws NullPointerException if z is null.
Parameters:
  z - the value.
public static  Complexpolar2Complex(double r, double theta)
     Creates a complex number from the given polar representation.
public static  Complexpow(Complex y, Complex x)
     Returns of value of y raised to the power of x.

Implements the formula:

  yx = exp(x·log(y))
where exp and log are ComplexUtils.exp and ComplexUtils.log , respectively.

Returns Complex.NaN if either real or imaginary part of the input argument is NaN or infinite, or if y equals Complex.ZERO .
Parameters:
  y - the base.
Parameters:
  x - the exponent.

public static  Complexsin(Complex z)
     Compute the sine for the given complex argument.

Implements the formula:

  sin(a + bi) = sin(a)cosh(b) - cos(a)sinh(b)i
where the (real) functions on the right-hand side are java.lang.Math.sin , java.lang.Math.cos , MathUtils.cosh and MathUtils.sinh .

Returns Complex.NaN if either real or imaginary part of the input argument is NaN.

Infinite values in real or imaginary parts of the input may result in infinite or NaN values returned in parts of the result.

 Examples: 
 
 sin(1 ± INFINITY i) = 1 ± INFINITY i
 sin(±INFINITY + i) = NaN + NaN i
 sin(±INFINITY ± INFINITY i) = NaN + NaN i
Throws NullPointerException if z is null.
public static  Complexsinh(Complex z)
     Compute the hyperbolic sine for the given complex argument.
public static  Complexsqrt(Complex z)
     Compute the square root for the given complex argument.
public static  Complexsqrt1z(Complex z)
     Compute the square root of 1 - z2 for the given complex argument.

Computes the result directly as sqrt(Complex.ONE.subtract(z.multiply(z))).

Returns Complex.NaN if either real or imaginary part of the input argument is NaN.

Infinite values in real or imaginary parts of the input may result in infinite or NaN values returned in parts of the result.

public static  Complextan(Complex z)
     Compute the tangent for the given complex argument.
public static  Complextanh(Complex z)
     Compute the hyperbolic tangent for the given complex argument.



Method Detail
acos
public static Complex acos(Complex z)(Code)
Compute the inverse cosine for the given complex argument.

Implements the formula:

  acos(z) = -i (log(z + i (sqrt(1 - z2))))

Returns Complex.NaN if either real or imaginary part of the input argument is NaN or infinite.
Parameters:
  z - the value whose inverse cosine is to be returned the inverse cosine of z
throws:
  NullPointerException - if z is null




asin
public static Complex asin(Complex z)(Code)
Compute the inverse sine for the given complex argument.

Implements the formula:

  asin(z) = -i (log(sqrt(1 - z2) + iz)) 

Returns Complex.NaN if either real or imaginary part of the input argument is NaN or infinite.
Parameters:
  z - the value whose inverse sine is to be returned. the inverse sine of z.
throws:
  NullPointerException - if z is null




atan
public static Complex atan(Complex z)(Code)
Compute the inverse tangent for the given complex argument.

Implements the formula:

  atan(z) = (i/2) log((i + z)/(i - z)) 

Returns Complex.NaN if either real or imaginary part of the input argument is NaN or infinite.
Parameters:
  z - the value whose inverse tangent is to be returned the inverse tangent of z
throws:
  NullPointerException - if z is null




cos
public static Complex cos(Complex z)(Code)
Compute the cosine for the given complex argument.

Implements the formula:

  cos(a + bi) = cos(a)cosh(b) - sin(a)sinh(b)i
where the (real) functions on the right-hand side are java.lang.Math.sin , java.lang.Math.cos , MathUtils.cosh and MathUtils.sinh .

Returns Complex.NaN if either real or imaginary part of the input argument is NaN.

Infinite values in real or imaginary parts of the input may result in infinite or NaN values returned in parts of the result.

 Examples: 
 
 cos(1 ± INFINITY i) = 1 ∓ INFINITY i
 cos(±INFINITY + i) = NaN + NaN i
 cos(±INFINITY ± INFINITY i) = NaN + NaN i

Parameters:
  z - the value whose cosine is to be returned the cosine of z
throws:
  NullPointerException - if z is null



cosh
public static Complex cosh(Complex z)(Code)
Compute the hyperbolic cosine for the given complex argument.

Implements the formula:

  cosh(a + bi) = cosh(a)cos(b) + sinh(a)sin(b)i
where the (real) functions on the right-hand side are java.lang.Math.sin , java.lang.Math.cos , MathUtils.cosh and MathUtils.sinh .

Returns Complex.NaN if either real or imaginary part of the input argument is NaN.

Infinite values in real or imaginary parts of the input may result in infinite or NaN values returned in parts of the result.

 Examples: 
 
 cosh(1 ± INFINITY i) = NaN + NaN i
 cosh(±INFINITY + i) = INFINITY ± INFINITY i
 cosh(±INFINITY ± INFINITY i) = NaN + NaN i

Throws NullPointerException if z is null.
Parameters:
  z - the value whose hyperbolic cosine is to be returned. the hyperbolic cosine of z.




exp
public static Complex exp(Complex z)(Code)
Compute the exponential function for the given complex argument.

Implements the formula:

  exp(a + bi) = exp(a)cos(b) + exp(a)sin(b)i
where the (real) functions on the right-hand side are java.lang.Math.exp , java.lang.Math.cos , and java.lang.Math.sin .

Returns Complex.NaN if either real or imaginary part of the input argument is NaN.

Infinite values in real or imaginary parts of the input may result in infinite or NaN values returned in parts of the result.

 Examples: 
 
 exp(1 ± INFINITY i) = NaN + NaN i
 exp(INFINITY + i) = INFINITY + INFINITY i
 exp(-INFINITY + i) = 0 + 0i
 exp(±INFINITY ± INFINITY i) = NaN + NaN i

Throws NullPointerException if z is null.
Parameters:
  z - the value ez




log
public static Complex log(Complex z)(Code)
Compute the natural logarithm for the given complex argument.

Implements the formula:

  log(a + bi) = ln(|a + bi|) + arg(a + bi)i
where ln on the right hand side is java.lang.Math.log , |a + bi| is the modulus, Complex.abs , and arg(a + bi) = java.lang.Math.atan2 (b, a)

Returns Complex.NaN if either real or imaginary part of the input argument is NaN.

Infinite (or critical) values in real or imaginary parts of the input may result in infinite or NaN values returned in parts of the result.

 Examples: 
 
 log(1 ± INFINITY i) = INFINITY ± (π/2)i
 log(INFINITY + i) = INFINITY + 0i
 log(-INFINITY + i) = INFINITY + πi
 log(INFINITY ± INFINITY i) = INFINITY ± (π/4)i
 log(-INFINITY ± INFINITY i) = INFINITY ± (3π/4)i
 log(0 + 0i) = -INFINITY + 0i
 
Throws NullPointerException if z is null.
Parameters:
  z - the value. ln z.



polar2Complex
public static Complex polar2Complex(double r, double theta)(Code)
Creates a complex number from the given polar representation.

The value returned is r·ei·theta, computed as r·cos(theta) + r·sin(theta)i

If either r or theta is NaN, or theta is infinite, Complex.NaN is returned.

If r is infinite and theta is finite, infinite or NaN values may be returned in parts of the result, following the rules for double arithmetic.

 Examples: 
 
 polar2Complex(INFINITY, π/4) = INFINITY + INFINITY i
 polar2Complex(INFINITY, 0) = INFINITY + NaN i
 polar2Complex(INFINITY, -π/4) = INFINITY - INFINITY i
 polar2Complex(INFINITY, 5π/4) = -INFINITY - INFINITY i 

Parameters:
  r - the modulus of the complex number to create
Parameters:
  theta - the argument of the complex number to create r·ei·theta
throws:
  IllegalArgumentException - if r is negative
since:
   1.1



pow
public static Complex pow(Complex y, Complex x)(Code)
Returns of value of y raised to the power of x.

Implements the formula:

  yx = exp(x·log(y))
where exp and log are ComplexUtils.exp and ComplexUtils.log , respectively.

Returns Complex.NaN if either real or imaginary part of the input argument is NaN or infinite, or if y equals Complex.ZERO .
Parameters:
  y - the base.
Parameters:
  x - the exponent. yx
throws:
  NullPointerException - if either x or y is null




sin
public static Complex sin(Complex z)(Code)
Compute the sine for the given complex argument.

Implements the formula:

  sin(a + bi) = sin(a)cosh(b) - cos(a)sinh(b)i
where the (real) functions on the right-hand side are java.lang.Math.sin , java.lang.Math.cos , MathUtils.cosh and MathUtils.sinh .

Returns Complex.NaN if either real or imaginary part of the input argument is NaN.

Infinite values in real or imaginary parts of the input may result in infinite or NaN values returned in parts of the result.

 Examples: 
 
 sin(1 ± INFINITY i) = 1 ± INFINITY i
 sin(±INFINITY + i) = NaN + NaN i
 sin(±INFINITY ± INFINITY i) = NaN + NaN i
Throws NullPointerException if z is null.
Parameters:
  z - the value whose sine is to be returned. the sine of z.



sinh
public static Complex sinh(Complex z)(Code)
Compute the hyperbolic sine for the given complex argument.

Implements the formula:

  sinh(a + bi) = sinh(a)cos(b)) + cosh(a)sin(b)i
where the (real) functions on the right-hand side are java.lang.Math.sin , java.lang.Math.cos , MathUtils.cosh and MathUtils.sinh .

Returns Complex.NaN if either real or imaginary part of the input argument is NaN.

Infinite values in real or imaginary parts of the input may result in infinite or NaN values returned in parts of the result.

 Examples: 
 
 sinh(1 ± INFINITY i) = NaN + NaN i
 sinh(±INFINITY + i) = ± INFINITY + INFINITY i
 sinh(±INFINITY ± INFINITY i) = NaN + NaN i
Parameters:
  z - the value whose hyperbolic sine is to be returned the hyperbolic sine of z
throws:
  NullPointerException - if z is null



sqrt
public static Complex sqrt(Complex z)(Code)
Compute the square root for the given complex argument.

Implements the following algorithm to compute sqrt(a + bi):

  1. Let t = sqrt((|a| + |a + bi|) / 2)
  2. if  a ≥ 0 return t + (b/2t)i
     else return |b|/2t + sign(b)t i 
where

Returns Complex.NaN if either real or imaginary part of the input argument is NaN.

Infinite values in real or imaginary parts of the input may result in infinite or NaN values returned in parts of the result.

 Examples: 
 
 sqrt(1 ± INFINITY i) = INFINITY + NaN i
 sqrt(INFINITY + i) = INFINITY + 0i
 sqrt(-INFINITY + i) = 0 + INFINITY i
 sqrt(INFINITY ± INFINITY i) = INFINITY + NaN i
 sqrt(-INFINITY ± INFINITY i) = NaN ± INFINITY i
 

Parameters:
  z - the value whose square root is to be returned the square root of z
throws:
  NullPointerException - if z is null



sqrt1z
public static Complex sqrt1z(Complex z)(Code)
Compute the square root of 1 - z2 for the given complex argument.

Computes the result directly as sqrt(Complex.ONE.subtract(z.multiply(z))).

Returns Complex.NaN if either real or imaginary part of the input argument is NaN.

Infinite values in real or imaginary parts of the input may result in infinite or NaN values returned in parts of the result.
Parameters:
  z - the value the square root of 1 - z2
throws:
  NullPointerException - if z is null




tan
public static Complex tan(Complex z)(Code)
Compute the tangent for the given complex argument.

Implements the formula:

 tan(a + bi) = sin(2a)/(cos(2a)+cosh(2b)) + [sinh(2b)/(cos(2a)+cosh(2b))]i
where the (real) functions on the right-hand side are java.lang.Math.sin , java.lang.Math.cos , MathUtils.cosh and MathUtils.sinh .

Returns Complex.NaN if either real or imaginary part of the input argument is NaN.

Infinite (or critical) values in real or imaginary parts of the input may result in infinite or NaN values returned in parts of the result.

 Examples: 
 
 tan(1 ± INFINITY i) = 0 + NaN i
 tan(±INFINITY + i) = NaN + NaN i
 tan(±INFINITY ± INFINITY i) = NaN + NaN i
 tan(±&pi/2 + 0 i) = ±INFINITY + NaN i

Parameters:
  z - the value whose tangent is to be returned the tangent of z
throws:
  NullPointerException - if z is null



tanh
public static Complex tanh(Complex z)(Code)
Compute the hyperbolic tangent for the given complex argument.

Implements the formula:

 tan(a + bi) = sinh(2a)/(cosh(2a)+cos(2b)) + [sin(2b)/(cosh(2a)+cos(2b))]i
where the (real) functions on the right-hand side are java.lang.Math.sin , java.lang.Math.cos , MathUtils.cosh and MathUtils.sinh .

Returns Complex.NaN if either real or imaginary part of the input argument is NaN.

Infinite values in real or imaginary parts of the input may result in infinite or NaN values returned in parts of the result.

 Examples: 
 
 tanh(1 ± INFINITY i) = NaN + NaN i
 tanh(±INFINITY + i) = NaN + 0 i
 tanh(±INFINITY ± INFINITY i) = NaN + NaN i
 tanh(0 + (&pi/2)i) = NaN + INFINITY i

Parameters:
  z - the value whose hyperbolic tangent is to be returned the hyperbolic tangent of z
throws:
  NullPointerException - if z 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.