Merged userguide updates from MATH_1_1 release branch.

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@358646 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Phil Steitz 2005-12-22 22:14:02 +00:00
parent 7f8947c03c
commit a793820331
2 changed files with 25 additions and 7 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!--
Copyright 2003-2004 The Apache Software Foundation
Copyright 2003-2005 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -20,7 +20,7 @@
<!-- $Revision$ $Date$ -->
<document url="stat.html">
<properties>
<title>The Commons Math User Guide - Statistics</title>
<title>The Commons Math User Guide - Complex Numbers</title>
</properties>
<body>
<section name="7 Complex Numbers">
@ -38,6 +38,18 @@
type that forms the basis for the complex functionality found in
commons-math.
</p>
<p>
Complex functions and arithmetic operations are implemented in
commons-math by applying standard computational formulas and
following the rules for <code>java.lang.Double</code> arithmetic in
handling infinite and <code>NaN</code> values. No attempt is made
to comply with ANSII/IEC C99x Annex G or any other standard for
Complex arithmetic. See the class and method javadocs for the
<a href="../apidocs/org/apache/commons/math/complex/Complex.html">
Complex</a> and
<a href="../apidocs/org/apache/commons/math/complex/ComplexUtils.html">
ComplexUtils</a> classes for details on computing formulas.
</p>
<p>
To create a complex number, simply call the constructor passing in two
floating-point arguments, the first being the real part of the
@ -45,9 +57,14 @@
<source>Complex c = new Complex(1.0, 3.0); // 1 + 3i</source>
</p>
<p>
The <code>Complex</code> class provides many unary and binary
Complex numbers may also be created from polar representations
using the <code>polar2Complex</code> method in
<code>ComplexUtils</code>.
</p>
<p>
The <code>Complex</code> class provides basic unary and binary
complex number operations. These operations provide the means to add,
subtract, multiple and, divide complex numbers along with other
subtract, multiply and divide complex numbers along with other
complex number functions similar to the real number functions found in
<code>java.math.BigDecimal</code>:
<source>Complex lhs = new Complex(1.0, 3.0);
@ -62,7 +79,7 @@ Complex answer = lhs.add(rhs); // add two complex numbers
<subsection name="7.3 Complex Transcendental Functions" href="function">
<p>
<a href="../apidocs/org/apache/commons/math/complex/ComplexUtils.html">
org.apache.commons.math.complex.ComplexMath</a> provides
org.apache.commons.math.complex.ComplexUtils</a> provides
implementations of serveral transcendental functions involving complex
number arguments. These operations provide the means to compute the
log, sine, tangent and, other complex values similar to the real

View File

@ -56,9 +56,10 @@ RealMatrix m = new RealMatrixImpl(matrixData);
// One more with three rows, two columns
double[][] matrixData2 = { {1d,2d}, {2d,5d}, {1d, 7d}};
RealMatrix n = new RealMatrixImpl(matrixData2);
RealMatrix n = new RealMatixImpl(matrixData2);
// Note: The constructor copies the input double[][] array.
// Note: constructor makes a
// Fresh copy of the input double[][] array
// Now multiply m by n
RealMatrix p = m.multiply(n);