systemfailur / aforge

Automatically exported from code.google.com/p/aforge
0 stars 0 forks source link

Aforge.Math complex Bug #10

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The following is a code i wrote to test the Complex object in Aforge.Math. 
Complex[] dx = new Complex[512];
for (int i = 0; i < dx.Length-1; i++)
{
dx[i] = (Complex)(Math.Sin(i));//ERROR????
}
When I run this, the compiler(Visual studio.NET 2005) complains"Cannot 
convert type double to Aforge.Math.Complex".
Has anyone ever encountered this error.

Can anyone upload some more examples(tutorial) on the usage of Math 
functions in this library.
Cheers 

kel

Original issue reported on code.google.com by keleist...@yahoo.co.uk on 16 Jan 2007 at 7:32

GoogleCodeExporter commented 9 years ago
Hello

Hmmm. To be honest I cannot get where the expectation, that it should work, 
came 
from. It is obvious that it will not work.

If you would like to make result of Sin function to be a real part of complex 
number, then you can use:
dx[i] = new Complex( (float) Math.Sin(i), 0 );

The complex class does not have a constructor, which receives only one 
parameter - 
you should specify two parameters: real part and imaginary.

So, at this point there is no any error in the library. There could be 
improvements -
 I agree.

Original comment by andrew.k...@gmail.com on 20 Jan 2007 at 10:56