Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

>> REGISTER NOW TO START POSTING

# Thread: Complex Numbers in Java

1. ## Complex Numbers in Java

Hello Everyone,

I am new to programming in Java. Been a Matlab programmer for the past 8-9 years. I have a question (This might look like a very dumb question to many of you Java programmers)?

Let say Z(n) is an array of complex number defined as (3+4*i)/(9-(7*i)*n); where for simplicity n=0,1,23,.....9;

T(n) is an array of complex number defined as (2.25-(9*i)*n)/(8+11.34*i); where n=0,1,23,.....9;

1. Now how do i store this complex numbers into an array using Java?

I prefer using a "for" loop
for (int n=0, n<10,n++){
Z[n]=(3+4*i)/(9-(7*i)*n);}

But i know Java don't recognize "i" which is sqrt(-1). How to go about creating a Z array then?

2. Next, how do i find the product of Z*T; lets say Z is saved as "nx1" vector (matrix) and T is saved as "1xn" vector (matrix)? I want the result to be "nxn" matrix.

I have looked at Michael Flanagan's Java library on Complex (Michael Thomas Flanagan's Java Scientific and Numerical Library), but still can't figure out. Any suggestions would be greatly appreciated.

Thanks!
Derrick

2. ## Re: Complex Numbers in Java

You've sort of hidden you posting in the Member Introduction part of the forum.