Arithmetic/Complex: Difference between revisions

m
Line 217:
INTEGER, PARAMETER :: N = 50
INTEGER :: J
COMPLEX, DIMENSION(0:N-1) :: UNITCIRCLEUNIT_CIRCLE
ABDIFF = A - B
Line 224:
AREAL = REAL(A) ! Real part
AIMAG = IMAG(A) ! Imaginary part
ANORMNEWC = ABSCMPLX(AX,Y) ! Creating a !complex Complexon normthe (orfly "modulus"from ortwo "absolutereals value"),intrinsically use(initializer CABSonly beforeworks Fortranin 90declarations)
ACONJNEWC = CONJG(A)X + Y*I ! ComplexCreating a complex on the fly from two reals conjugatearithmetically
ANORM = ABS(A) ! Complex norm (or "modulus" or "absolute value") (use CABS before Fortran 90)
P2CART = RHO * EXP(I * THETA) ! Euler's polar complex notation to cartesian complex notation conversion,
ACONJ = CONJG(A) ! Complex conjugate (same as REAL(A) - ! use CEXP before Fortran 90I*IMAG(A))
NEWCP2CART = CMPLX(X,Y) RHO * EXP(I * THETA) ! creatingEuler's apolar complex onnotation theto flycartesian from twocomplex reals,notation intrinsicallyconversion (initializeruse onlyCEXP worksbefore inFortran declarations90)
NEWC = X + Y*I ! creating a complex on the fly from two reals, arithmetically
! CreatesThe following creates an array of N evenly spaced points around the complex unit circle
! useful for FFT calculations, among other things
UNITCIRCLEUNIT_CIRCLE = EXP(2*I*PI/N * (/ J, J=0, N-1 /) )
END PROGRAM CDEMO2
 
Anonymous user