# community-dev mailing list archives

##### Site index · List index
Message view
Top
From " ." <mdzafir.alv...@gmail.com>
Subject Fwd: Request for correcting wrong Information on website
Date Wed, 20 Apr 2016 20:51:15 GMT
```---------- Forwarded message ----------
From: . <mdzafir.alvi.1@gmail.com>
Date: Thu, Apr 21, 2016 at 2:35 AM
Subject: Request for correcting wrong Information on website
To: apache@apache.org

Dear site admin ,
I was browsing this page below :
https://commons.apache.org/proper/commons-math/userguide/complex.html

Between /* */ I am copy pasting some lines from the page . After this /**/
mark i will post error and corrections

/*

The Complex class provides basic unary and binary complex number
operations. These operations provide the means to add, subtract, multiply
and divide complex numbers along with other complex number functions
similar to the real number functions found in java.math.BigDecimal:

Complex lhs = new Complex(1.0, 3.0);
Complex rhs = new Complex(2.0, 5.0);

Complex answer = lhs.add(rhs);       // add two complex numbers
answer = lhs.subtract(rhs);  // subtract two complex numbers
answer = lhs.abs();          // absolute value
answer = lhs.conjugate(rhs); // complex conjugate

7.3 Complex Transcendental Functions

Complex
<https://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math3/complex/Complex.html>
also
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 :

Complex first  = new Complex(1.0, 3.0);
Complex second = new Complex(2.0, 5.0);

Complex answer = first.log();        // natural logarithm.
answer = first.cos();        // cosine
answer = first.pow(second);  // first raised to the power of second

*/

First error :

see the line :   ------> answer = lhs.abs();          // absolute value

answer was declared in complex previously , so you must capture the
reply of lhs.abs() to a double variable

correct:

double answer = lhs.abs();
or
double ans = lhs.abs(); // we have already declared a variable name
//answer , so save this with a variable of different name

Error 2 :

see this line -->

answer = lhs.conjugate(rhs); // complex conjugate

Note that , Conjugate is a one input function , If z = 2+3i is a
complex , conjugate is 2-3i , Here you pushed 2 complex ( lhs , rhs )
instead of one conjugate ( either lhs or rhs ) . So this generates error

Correct :

either :

answer = lhs.conjugate();

or:

answer = rhs.conjugate();

both are correct If you think by chance I am wrong , you can even check
javadoc of your library , everything was correct there , but the example on
this web is wrong only. Thats all I had to say. I am a great fan of your
library Apache Commons Math 3.6.1 I was working on a project , in this
project I needed to use common math .jar . It helped me a lot by saving
time of many hard implementations . As a fan , I request you to correct
this information as soon as possible . Thanks in advanced . - From one of
your fans - Alvi

```
Mime
• Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message