⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 math::complex.3

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 3
📖 第 1 页 / 共 2 页
字号:
.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05).\".\" Standard preamble:.\" ========================================================================.de Sh \" Subsection heading.br.if t .Sp.ne 5.PP\fB\\$1\fR.PP...de Sp \" Vertical space (when we can't use .PP).if t .sp .5v.if n .sp...de Vb \" Begin verbatim text.ft CW.nf.ne \\$1...de Ve \" End verbatim text.ft R.fi...\" Set up some character translations and predefined strings.  \*(-- will.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left.\" double quote, and \*(R" will give a right double quote.  \*(C+ will.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,.\" nothing in troff, for use with C<>..tr \(*W-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'.ie n \{\.    ds -- \(*W-.    ds PI pi.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch.    ds L" "".    ds R" "".    ds C` "".    ds C' ""'br\}.el\{\.    ds -- \|\(em\|.    ds PI \(*p.    ds L" ``.    ds R" '''br\}.\".\" Escape single quotes in literal strings from groff's Unicode transform..ie \n(.g .ds Aq \(aq.el       .ds Aq '.\".\" If the F register is turned on, we'll generate index entries on stderr for.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index.\" entries marked with X<> in POD.  Of course, you'll have to process the.\" output yourself in some meaningful fashion..ie \nF \{\.    de IX.    tm Index:\\$1\t\\n%\t"\\$2"...    nr % 0.    rr F.\}.el \{\.    de IX...\}.\".\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2)..\" Fear.  Run.  Save yourself.  No user-serviceable parts..    \" fudge factors for nroff and troff.if n \{\.    ds #H 0.    ds #V .8m.    ds #F .3m.    ds #[ \f1.    ds #] \fP.\}.if t \{\.    ds #H ((1u-(\\\\n(.fu%2u))*.13m).    ds #V .6m.    ds #F 0.    ds #[ \&.    ds #] \&.\}.    \" simple accents for nroff and troff.if n \{\.    ds ' \&.    ds ` \&.    ds ^ \&.    ds , \&.    ds ~ ~.    ds /.\}.if t \{\.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u".    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'.\}.    \" troff and (daisy-wheel) nroff accents.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'.ds 8 \h'\*(#H'\(*b\h'-\*(#H'.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#].ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#].ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#].ds ae a\h'-(\w'a'u*4/10)'e.ds Ae A\h'-(\w'A'u*4/10)'E.    \" corrections for vroff.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'.    \" for low resolution devices (crt and lpr).if \n(.H>23 .if \n(.V>19 \\{\.    ds : e.    ds 8 ss.    ds o a.    ds d- d\h'-1'\(ga.    ds D- D\h'-1'\(hy.    ds th \o'bp'.    ds Th \o'LP'.    ds ae ae.    ds Ae AE.\}.rm #[ #] #H #V #F C.\" ========================================================================.\".IX Title "Math::Complex 3".TH Math::Complex 3 "2007-12-18" "perl v5.10.0" "Perl Programmers Reference Guide".\" For nroff, turn off justification.  Always turn off hyphenation; it makes.\" way too many mistakes in technical documents..if n .ad l.nh.SH "NAME"Math::Complex \- complex numbers and associated mathematical functions.SH "SYNOPSIS".IX Header "SYNOPSIS".Vb 1\&        use Math::Complex;\&\&        $z = Math::Complex\->make(5, 6);\&        $t = 4 \- 3*i + $z;\&        $j = cplxe(1, 2*pi/3);.Ve.SH "DESCRIPTION".IX Header "DESCRIPTION"This package lets you create and manipulate complex numbers. By default,\&\fIPerl\fR limits itself to real numbers, but an extra \f(CW\*(C`use\*(C'\fR statement bringsfull complex support, along with a full set of mathematical functionstypically associated with and/or extended to complex numbers..PPIf you wonder what complex numbers are, they were invented to be able to solvethe following equation:.PP.Vb 1\&        x*x = \-1.Ve.PPand by definition, the solution is noted \fIi\fR (engineers use \fIj\fR instead since\&\fIi\fR usually denotes an intensity, but the name does not matter). The number\&\fIi\fR is a pure \fIimaginary\fR number..PPThe arithmetics with pure imaginary numbers works just like you would expectit with real numbers... you just have to remember that.PP.Vb 1\&        i*i = \-1.Ve.PPso you have:.PP.Vb 5\&        5i + 7i = i * (5 + 7) = 12i\&        4i \- 3i = i * (4 \- 3) = i\&        4i * 2i = \-8\&        6i / 2i = 3\&        1 / i = \-i.Ve.PPComplex numbers are numbers that have both a real part and an imaginarypart, and are usually noted:.PP.Vb 1\&        a + bi.Ve.PPwhere \f(CW\*(C`a\*(C'\fR is the \fIreal\fR part and \f(CW\*(C`b\*(C'\fR is the \fIimaginary\fR part. Thearithmetic with complex numbers is straightforward. You have tokeep track of the real and the imaginary parts, but otherwise therules used for real numbers just apply:.PP.Vb 2\&        (4 + 3i) + (5 \- 2i) = (4 + 5) + i(3 \- 2) = 9 + i\&        (2 + i) * (4 \- i) = 2*4 + 4i \-2i \-i*i = 8 + 2i + 1 = 9 + 2i.Ve.PPA graphical representation of complex numbers is possible in a plane(also called the \fIcomplex plane\fR, but it's really a 2D plane).The number.PP.Vb 1\&        z = a + bi.Ve.PPis the point whose coordinates are (a, b). Actually, it wouldbe the vector originating from (0, 0) to (a, b). It follows that the additionof two complex numbers is a vectorial addition..PPSince there is a bijection between a point in the 2D plane and a complexnumber (i.e. the mapping is unique and reciprocal), a complex numbercan also be uniquely identified with polar coordinates:.PP.Vb 1\&        [rho, theta].Ve.PPwhere \f(CW\*(C`rho\*(C'\fR is the distance to the origin, and \f(CW\*(C`theta\*(C'\fR the angle betweenthe vector and the \fIx\fR axis. There is a notation for this using theexponential form, which is:.PP.Vb 1\&        rho * exp(i * theta).Ve.PPwhere \fIi\fR is the famous imaginary number introduced above. Conversionbetween this form and the cartesian form \f(CW\*(C`a + bi\*(C'\fR is immediate:.PP.Vb 2\&        a = rho * cos(theta)\&        b = rho * sin(theta).Ve.PPwhich is also expressed by this formula:.PP.Vb 1\&        z = rho * exp(i * theta) = rho * (cos theta + i * sin theta).Ve.PPIn other words, it's the projection of the vector onto the \fIx\fR and \fIy\fRaxes. Mathematicians call \fIrho\fR the \fInorm\fR or \fImodulus\fR and \fItheta\fRthe \fIargument\fR of the complex number. The \fInorm\fR of \f(CW\*(C`z\*(C'\fR ismarked here as \f(CWabs(z)\fR..PPThe polar notation (also known as the trigonometric representation) ismuch more handy for performing multiplications and divisions ofcomplex numbers, whilst the cartesian notation is better suited foradditions and subtractions. Real numbers are on the \fIx\fR axis, andtherefore \fIy\fR or \fItheta\fR is zero or \fIpi\fR..PPAll the common operations that can be performed on a real number havebeen defined to work on complex numbers as well, and are merely\&\fIextensions\fR of the operations defined on real numbers. This meansthey keep their natural meaning when there is no imaginary part, providedthe number is within their definition set..PPFor instance, the \f(CW\*(C`sqrt\*(C'\fR routine which computes the square root ofits argument is only defined for non-negative real numbers and yields anon-negative real number (it is an application from \fBR+\fR to \fBR+\fR).If we allow it to return a complex number, then it can be extended tonegative real numbers to become an application from \fBR\fR to \fBC\fR (theset of complex numbers):.PP.Vb 1\&        sqrt(x) = x >= 0 ? sqrt(x) : sqrt(\-x)*i.Ve.PPIt can also be extended to be an application from \fBC\fR to \fBC\fR,whilst its restriction to \fBR\fR behaves as defined above by usingthe following definition:.PP.Vb 1\&        sqrt(z = [r,t]) = sqrt(r) * exp(i * t/2).Ve.PPIndeed, a negative real number can be noted \f(CW\*(C`[x,pi]\*(C'\fR (the modulus\&\fIx\fR is always non-negative, so \f(CW\*(C`[x,pi]\*(C'\fR is really \f(CW\*(C`\-x\*(C'\fR, a negativenumber) and the above definition states that.PP.Vb 1\&        sqrt([x,pi]) = sqrt(x) * exp(i*pi/2) = [sqrt(x),pi/2] = sqrt(x)*i.Ve.PPwhich is exactly what we had defined for negative real numbers above.The \f(CW\*(C`sqrt\*(C'\fR returns only one of the solutions: if you want the both,use the \f(CW\*(C`root\*(C'\fR function..PPAll the common mathematical functions defined on real numbers thatare extended to complex numbers share that same property of working\&\fIas usual\fR when the imaginary part is zero (otherwise, it would notbe called an extension, would it?)..PPA \fInew\fR operation possible on a complex number that isthe identity for real numbers is called the \fIconjugate\fR, and is notedwith a horizontal bar above the number, or \f(CW\*(C`~z\*(C'\fR here..PP.Vb 2\&         z = a + bi\&        ~z = a \- bi.Ve.PPSimple... Now look:.PP.Vb 1\&        z * ~z = (a + bi) * (a \- bi) = a*a + b*b.Ve.PPWe saw that the norm of \f(CW\*(C`z\*(C'\fR was noted \f(CWabs(z)\fR and was defined as thedistance to the origin, also known as:.PP.Vb 1\&        rho = abs(z) = sqrt(a*a + b*b).Ve.PPso.PP.Vb 1\&        z * ~z = abs(z) ** 2.Ve.PPIf z is a pure real number (i.e. \f(CW\*(C`b == 0\*(C'\fR), then the above yields:.PP.Vb 1\&        a * a = abs(a) ** 2.Ve.PPwhich is true (\f(CW\*(C`abs\*(C'\fR has the regular meaning for real number, i.e. standsfor the absolute value). This example explains why the norm of \f(CW\*(C`z\*(C'\fR isnoted \f(CWabs(z)\fR: it extends the \f(CW\*(C`abs\*(C'\fR function to complex numbers, yetis the regular \f(CW\*(C`abs\*(C'\fR we know when the complex number actually has noimaginary part... This justifies \fIa posteriori\fR our use of the \f(CW\*(C`abs\*(C'\fRnotation for the norm..SH "OPERATIONS".IX Header "OPERATIONS"Given the following notations:.PP.Vb 3\&        z1 = a + bi = r1 * exp(i * t1)\&        z2 = c + di = r2 * exp(i * t2)\&        z = <any complex or real number>.Ve.PPthe following (overloaded) operations are supported on complex numbers:.PP.Vb 10\&        z1 + z2 = (a + c) + i(b + d)\&        z1 \- z2 = (a \- c) + i(b \- d)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -