.\" '\" tep .\" to invoke 'tbl', 'eqn', 'pic' in the proper order .\" .\" @(#)cartpol.3 1.6 00/02/18 SMI; .\" .TH CARTPOL 3CC4 "24 March 1994" .\" .SH NAME cartpol \- cartesian/polar functions in the C++ complex number math library .SH SYNOPSIS .LP .nf .ft B #include .sp .5v class complex { public: friend double abs(const complex); friend double norm(const complex); friend double arg(const complex); friend complex conj(const complex); friend double imag(const complex&); friend double real(const complex&); friend complex polar(double magnitude, double angle= 0.0); ... \fI// remainder not shown here\fB }; .ft R .fi .\" .SH DESCRIPTION .LP These functions enable conversions between the Cartesian coordinates of the implementation and polar coordinates which are needed for some applications. .TP .B "double mag = abs(x)" Returns the absolute value, or magnitude, of complex number \fBx\fR. .TP .B "double mag = norm(x)" Returns the square of the absolute value of complex number \fBx\fR. This is faster than \fBabs\fR, since the square root is not calculated, and is useful for comparing magnitudes of complex numbers. .TP .B "double ang = arg(x)" Returns the angle, or argument, in radians from \-\(*p to +\(*p, of the polar coordinate representation of complex number \fBx\fR. .TP .B "complex z = conj(x)" Returns the complex conjugate of complex number \fBx\fR. If \fBx\fR has the value \fB(r,i)\fR, the complex conjugate has the value \fB(r,\-i)\fR. .TP .B "double i = imag(x)" Returns the \fIimaginary\fR part of complex number \fBx\fR. .TP .B "double r = real(x)" Returns the \fIreal\fR part of complex number \fBx\fR. .TP .B "complex x = polar(mag, ang)" Given a pair of polar coordinates \fBmag\fR (magnitude) and \fBang\fR (angle or argument) in radians from \-\(*p to +\(*p, returns a complex number with the same value. .\" .SH "SEE ALSO" .LP .na .BR cplx.intro (3CC4), .BR cplxerr (3CC4), .BR cplxexp (3CC4), .BR cplxops (3CC4), .BR cplxtrig (3CC4), .I "Complex Tutorial". .\" .TZ ???? .ad