Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Complex numbers in java

  1. Aug 26, 2013 #1
    Hi, I'm doing a mini-project in java that involves some nasty calculations with complex numbers- particularly with complex numbers in exponents. Thus far, I've had success using this class: Complex.java . The problem that I'm encountering involves taking the natural logarithm of a complex number a + bi and getting the rectangular form of the new number. Is there any workaround for this? I feel like I'm missing something easy, since I can easily type in the natural logarithm of a complex number into google and it easily tells me the approximate rectangular value.

    By the way, if someone knows of another class which would actually allow me to use complex powers to begin with, I would greatly appreciate it if you shared it with me.
     
  2. jcsd
  3. Aug 26, 2013 #2
    Actually, never mind, I figured out an alternate approach to the problem!
     
  4. Aug 26, 2013 #3

    CompuChip

    User Avatar
    Science Advisor
    Homework Helper

    But the class you linked to has a method log() - isn't that exactly what you are looking for?
    Code (Text):

    Complex z = ...;
    Complex logZ = z.log();

    // Use logZ.real() and logZ.imag() to get the rectangular form
    // or logZ.toString() if you need the string representation
     
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Complex numbers in java
  1. Java-Bit Binary Number (Replies: 34)

Loading...