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

Fortran Complex Argument

  1. Nov 27, 2007 #1
    I need help with programming the following:

    (T/(T-2*d))^(i*Nu)=exp(-i*Nu*ln|T/(T-2*d)| +Nu*arg(T/(T-2*d))

    I don't know how to do the arg bit in Fortran90...this is what I've tried so far


    but obviously it threw back an error message at the 'ARG(A)' bit...I've tried searching the web and help directories but still unsure as to what to do, HELP!!
  2. jcsd
  3. Nov 28, 2007 #2
    I've also tried the following....


    ....since arg(x+iy)=tan^(-1)(y/x). I think I'm not using the right function to find the real and imaginary parts of A, can anyone help at all?
  4. Nov 28, 2007 #3

    Dr Transport

    User Avatar
    Science Advisor
    Gold Member

    atan2(real(A),imag(A)), if that isn't right, reverse the arguments.
  5. Nov 30, 2007 #4
    that didn't work...how do you get arg(z) in fortran?
  6. Nov 30, 2007 #5
    Ten en cuenta que usas ATAN2 si es simple presicion y DATAN2 si es doble presicion

    ATAN2(parte imaginaria, parte real)

    Parte imaginaria: IMAG (o AIMAG) y DIMAG (Simple y doble presicion)
    Parte real: REAL o DREAL


    ATAN2 (2.679676, 1.0) has the value 1.213623.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook