[UP]


Manual Reference Pages  - cartesian_to_polar (3)

NAME

cartesian_to_polar(3f) - [M_units:TRIGONOMETRY] convert Cartesian coordinates to polar coordinates (LICENSE:PD)

CONTENTS

Synopsis
Description
Options
Results
Examples
Author
License

SYNOPSIS

subroutine cartesian_to_polar(x,y,radius,inclination)

    real,intent(in)  :: y,z
    real,intent(out) :: radius,inclination

DESCRIPTION

Convert a cartesian point <X,Y,Z> to polar coordinates <radius, inclination> with angles in radians using the formulas

      radius=sqrt(x**2+y**2)
      inclination=atan2(y,x)

OPTIONS

X The distance along the x-axis
Y The distance along the y-axis

RESULTS

RADIUS The radial distance from the origin (O) to the point (P)
INCLINATION
  The inclination angle in radians between the inclination reference direction (x-axis) and the orthogonal projection of the line OP of the reference plane (x-y plane).

EXAMPLES

examples of usage

   program demo_cartesian_to_polar
   use M_units, only : cartesian_to_polar
   implicit none
   real    :: x,y
   real    :: r,i
   integer :: ios
   INFINITE: do
      read(*,*,iostat=ios) x, y
      if(ios.ne.0)exit INFINITE
      call cartesian_to_polar(x,y,r,i)
      write(*,*)’x=’,x,’ y=’,y,’radius=’,r,’inclination=’,i
   enddo INFINITE
   end program demo_cartesian_to_polar

AUTHOR

John S. Urban

LICENSE

Public Domain


cartesian_to_polar (3) March 11, 2021
Generated by manServer 1.08 from a288b7e7-911f-4b51-8b9c-ec91c928b709 using man macros.