home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / progs / pari / pari_137 / tex / tutorial.tex < prev    next >
LaTeX Document  |  1992-05-20  |  31.5 KB

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: LaTeX Document (document/latex).

You can browse this item here: tutorial.tex

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert LaTeX Document (document/latex) magic Supported
1% dexvert Corel 10 Texture (image/corel10Texture) ext Unsupported
1% dexvert Croteam texture file (image/croteamTextureFile) ext Unsupported
1% dexvert Text File (text/txt) fallback Supported
100% file LaTeX document text default
99% file LaTeX document, ASCII text default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% detectItEasy Format: plain text[LF] default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 5c 63 68 61 70 74 65 72 | 7b 41 20 47 50 20 74 75 |\chapter|{A GP tu|
|00000010| 74 6f 72 69 61 6c 7d 0a | 0a 54 68 69 73 20 63 68 |torial}.|.This ch|
|00000020| 61 70 74 65 72 20 69 73 | 20 69 6e 74 65 6e 64 65 |apter is| intende|
|00000030| 64 20 74 6f 20 62 65 20 | 61 20 67 75 69 64 65 64 |d to be |a guided|
|00000040| 20 74 6f 75 72 20 61 6e | 64 20 61 20 74 75 74 6f | tour an|d a tuto|
|00000050| 72 69 61 6c 20 74 6f 20 | 74 68 65 20 47 50 20 63 |rial to |the GP c|
|00000060| 61 6c 63 75 6c 61 74 6f | 72 2e 0a 4d 61 6e 79 20 |alculato|r..Many |
|00000070| 65 78 61 6d 70 6c 65 73 | 20 77 69 6c 6c 20 62 65 |examples| will be|
|00000080| 20 67 69 76 65 6e 2c 20 | 62 75 74 20 65 61 63 68 | given, |but each|
|00000090| 20 74 69 6d 65 20 61 20 | 6e 65 77 20 66 75 6e 63 | time a |new func|
|000000a0| 74 69 6f 6e 20 69 73 20 | 75 73 65 64 2c 20 74 68 |tion is |used, th|
|000000b0| 65 20 72 65 61 64 65 72 | 0a 73 68 6f 75 6c 64 20 |e reader|.should |
|000000c0| 6c 6f 6f 6b 20 61 74 20 | 74 68 65 20 61 70 70 72 |look at |the appr|
|000000d0| 6f 70 72 69 61 74 65 20 | 73 65 63 74 69 6f 6e 20 |opriate |section |
|000000e0| 69 6e 20 74 68 65 20 6d | 61 6e 75 61 6c 20 66 6f |in the m|anual fo|
|000000f0| 72 20 64 65 74 61 69 6c | 65 64 20 65 78 70 6c 61 |r detail|ed expla|
|00000100| 6e 61 74 69 6f 6e 73 2e | 0a 48 65 6e 63 65 20 61 |nations.|.Hence a|
|00000110| 6c 74 68 6f 75 67 68 20 | 74 68 69 73 20 63 68 61 |lthough |this cha|
|00000120| 70 74 65 72 20 63 61 6e | 20 62 65 20 72 65 61 64 |pter can| be read|
|00000130| 20 69 6e 64 65 70 65 6e | 64 65 6e 74 6c 79 20 6f | indepen|dently o|
|00000140| 66 20 74 68 65 20 72 65 | 73 74 20 28 66 6f 72 20 |f the re|st (for |
|00000150| 65 78 61 6d 70 6c 65 0a | 74 6f 20 67 65 74 20 72 |example.|to get r|
|00000160| 61 70 69 64 6c 79 20 61 | 63 71 75 61 69 6e 74 65 |apidly a|cquainte|
|00000170| 64 20 77 69 74 68 20 74 | 68 65 20 70 6f 73 73 69 |d with t|he possi|
|00000180| 62 69 6c 69 74 69 65 73 | 20 6f 66 20 47 50 20 77 |bilities| of GP w|
|00000190| 69 74 68 6f 75 74 20 68 | 61 76 69 6e 67 20 74 6f |ithout h|aving to|
|000001a0| 20 72 65 61 64 0a 74 68 | 65 20 77 68 6f 6c 65 20 | read.th|e whole |
|000001b0| 72 65 66 65 72 65 6e 63 | 65 20 6d 61 6e 75 61 6c |referenc|e manual|
|000001c0| 29 2c 20 74 68 65 20 72 | 65 61 64 65 72 20 77 69 |), the r|eader wi|
|000001d0| 6c 6c 20 70 72 6f 66 69 | 74 20 6d 6f 73 74 20 66 |ll profi|t most f|
|000001e0| 72 6f 6d 20 69 74 20 62 | 79 20 72 65 61 64 69 6e |rom it b|y readin|
|000001f0| 67 20 69 74 0a 69 6e 20 | 63 6f 6e 6a 75 6e 63 74 |g it.in |conjunct|
|00000200| 69 6f 6e 20 77 69 74 68 | 20 74 68 65 20 72 65 66 |ion with| the ref|
|00000210| 65 72 65 6e 63 65 20 6d | 61 6e 75 61 6c 2e 0a 0a |erence m|anual...|
|00000220| 5c 73 65 63 74 69 6f 6e | 7b 47 72 65 65 74 69 6e |\section|{Greetin|
|00000230| 67 73 21 7d 0a 0a 53 6f | 20 79 6f 75 20 61 72 65 |gs!}..So| you are|
|00000240| 20 73 69 74 74 69 6e 67 | 20 69 6e 20 66 72 6f 6e | sitting| in fron|
|00000250| 74 20 6f 66 20 79 6f 75 | 72 20 77 6f 72 6b 73 74 |t of you|r workst|
|00000260| 61 74 69 6f 6e 20 28 6f | 72 20 74 65 72 6d 69 6e |ation (o|r termin|
|00000270| 61 6c 2c 20 6f 72 20 50 | 43 2c 5c 64 6f 74 73 29 |al, or P|C,\dots)|
|00000280| 2c 20 61 6e 64 20 79 6f | 75 0a 74 79 70 65 20 7b |, and yo|u.type {|
|00000290| 5c 62 66 20 67 70 7d 20 | 74 6f 20 67 65 74 20 74 |\bf gp} |to get t|
|000002a0| 68 65 20 70 72 6f 67 72 | 61 6d 20 73 74 61 72 74 |he progr|am start|
|000002b0| 65 64 20 28 72 65 6d 65 | 6d 62 65 72 20 74 6f 20 |ed (reme|mber to |
|000002c0| 61 6c 77 61 79 73 20 68 | 69 74 20 74 68 65 20 7b |always h|it the {|
|000002d0| 5c 74 74 20 65 6e 74 65 | 72 7d 20 6b 65 79 0a 61 |\tt ente|r} key.a|
|000002e0| 6e 64 20 6e 6f 74 20 74 | 68 65 20 7b 5c 74 74 20 |nd not t|he {\tt |
|000002f0| 72 65 74 75 72 6e 7d 20 | 6b 65 79 20 6f 6e 20 61 |return} |key on a|
|00000300| 20 4d 61 63 69 6e 74 6f | 73 68 20 63 6f 6d 70 75 | Macinto|sh compu|
|00000310| 74 65 72 29 2e 20 0a 0a | 49 74 20 73 61 79 73 20 |ter). ..|It says |
|00000320| 68 65 6c 6c 6f 20 69 6e | 20 69 74 73 20 70 61 72 |hello in| its par|
|00000330| 74 69 63 75 6c 61 72 20 | 6d 61 6e 6e 65 72 2c 20 |ticular |manner, |
|00000340| 61 6e 64 20 74 68 65 6e | 20 77 61 69 74 73 20 66 |and then| waits f|
|00000350| 6f 72 20 79 6f 75 20 61 | 66 74 65 72 20 69 74 73 |or you a|fter its|
|00000360| 20 7b 5c 74 74 20 70 72 | 6f 6d 70 74 7d 2c 0a 69 | {\tt pr|ompt},.i|
|00000370| 6e 69 74 69 61 6c 6c 79 | 20 7b 5c 62 66 20 3f 7d |nitially| {\bf ?}|
|00000380| 2e 0a 0a 54 79 70 65 20 | 24 32 2b 32 24 2e 20 57 |...Type |$2+2$. W|
|00000390| 68 61 74 20 68 61 70 70 | 65 6e 73 3f 20 4d 61 79 |hat happ|ens? May|
|000003a0| 62 65 20 6e 6f 74 20 77 | 68 61 74 20 79 6f 75 20 |be not w|hat you |
|000003b0| 65 78 70 65 63 74 2e 20 | 46 69 72 73 74 20 6f 66 |expect. |First of|
|000003c0| 20 61 6c 6c 2c 0a 6f 66 | 20 63 6f 75 72 73 65 2c | all,.of| course,|
|000003d0| 20 79 6f 75 20 73 68 6f | 75 6c 64 20 74 65 6c 6c | you sho|uld tell|
|000003e0| 20 47 50 20 74 68 61 74 | 20 79 6f 75 72 20 69 6e | GP that| your in|
|000003f0| 70 75 74 20 69 73 20 66 | 69 6e 69 73 68 65 64 2c |put is f|inished,|
|00000400| 20 61 6e 64 20 74 68 69 | 73 20 69 73 20 64 6f 6e | and thi|s is don|
|00000410| 65 20 62 79 20 68 69 74 | 74 69 6e 67 0a 74 68 65 |e by hit|ting.the|
|00000420| 20 7b 5c 74 74 20 72 65 | 74 75 72 6e 7d 20 28 6f | {\tt re|turn} (o|
|00000430| 72 20 7b 5c 74 74 20 6e | 65 77 6c 69 6e 65 7d 29 |r {\tt n|ewline})|
|00000440| 20 6b 65 79 2c 20 6f 72 | 20 74 68 65 20 7b 5c 74 | key, or| the {\t|
|00000450| 74 20 65 6e 74 65 72 7d | 20 6b 65 79 20 6f 6e 20 |t enter}| key on |
|00000460| 74 68 65 20 4d 61 63 2e | 20 49 66 20 79 6f 75 0a |the Mac.| If you.|
|00000470| 64 6f 20 65 78 61 63 74 | 6c 79 20 74 68 69 73 2c |do exact|ly this,|
|00000480| 20 79 6f 75 20 77 69 6c | 6c 20 67 65 74 20 74 68 | you wil|l get th|
|00000490| 65 20 65 78 70 65 63 74 | 65 64 20 61 6e 73 77 65 |e expect|ed answe|
|000004a0| 72 2e 20 48 6f 77 65 76 | 65 72 20 73 6f 6d 65 20 |r. Howev|er some |
|000004b0| 6f 66 20 79 6f 75 20 6d | 61 79 20 62 65 20 75 73 |of you m|ay be us|
|000004c0| 65 64 0a 74 6f 20 6f 74 | 68 65 72 20 73 79 73 74 |ed.to ot|her syst|
|000004d0| 65 6d 73 20 6c 69 6b 65 | 20 4d 61 63 73 79 6d 61 |ems like| Macsyma|
|000004e0| 20 6f 72 20 4d 61 70 6c | 65 2e 20 49 6e 20 74 68 | or Mapl|e. In th|
|000004f0| 69 73 20 63 61 73 65 2c | 20 79 6f 75 20 77 69 6c |is case,| you wil|
|00000500| 6c 20 68 61 76 65 20 73 | 75 62 63 6f 6e 73 63 69 |l have s|ubconsci|
|00000510| 6f 75 73 6c 79 0a 65 6e | 64 65 64 20 74 68 65 20 |ously.en|ded the |
|00000520| 6c 69 6e 65 20 77 69 74 | 68 20 61 20 73 65 6d 69 |line wit|h a semi|
|00000530| 63 6f 6c 6f 6e 20 7b 5c | 62 66 20 3b 7d 20 62 65 |colon {\|bf ;} be|
|00000540| 66 6f 72 65 20 68 69 74 | 74 69 6e 67 20 7b 5c 74 |fore hit|ting {\t|
|00000550| 74 20 72 65 74 75 72 6e | 7d 2c 20 73 69 6e 63 65 |t return|}, since|
|00000560| 20 74 68 69 73 20 69 73 | 0a 68 6f 77 20 69 74 20 | this is|.how it |
|00000570| 69 73 20 64 6f 6e 65 20 | 6f 6e 20 74 68 6f 73 65 |is done |on those|
|00000580| 20 73 79 73 74 65 6d 73 | 2e 20 49 6e 20 74 68 61 | systems|. In tha|
|00000590| 74 20 63 61 73 65 2c 20 | 79 6f 75 20 77 69 6c 6c |t case, |you will|
|000005a0| 20 73 69 6d 70 6c 79 20 | 73 65 65 20 47 50 20 61 | simply |see GP a|
|000005b0| 6e 73 77 65 72 69 6e 67 | 0a 79 6f 75 20 77 69 74 |nswering|.you wit|
|000005c0| 68 20 61 20 73 6d 75 67 | 20 65 78 70 72 65 73 73 |h a smug| express|
|000005d0| 69 6f 6e 2c 20 69 2e 65 | 2e 20 61 20 6e 65 77 20 |ion, i.e|. a new |
|000005e0| 70 72 6f 6d 70 74 20 61 | 6e 64 20 6e 6f 20 61 6e |prompt a|nd no an|
|000005f0| 73 77 65 72 21 0a 54 68 | 69 73 20 69 73 20 62 65 |swer!.Th|is is be|
|00000600| 63 61 75 73 65 20 61 20 | 73 65 6d 69 63 6f 6c 6f |cause a |semicolo|
|00000610| 6e 20 61 74 20 74 68 65 | 0a 65 6e 64 20 6f 66 20 |n at the|.end of |
|00000620| 61 20 6c 69 6e 65 20 69 | 6e 20 47 50 20 74 65 6c |a line i|n GP tel|
|00000630| 6c 73 20 69 74 20 74 6f | 20 6b 65 65 70 20 74 68 |ls it to| keep th|
|00000640| 65 20 72 65 73 75 6c 74 | 2c 20 62 75 74 20 6e 6f |e result|, but no|
|00000650| 74 20 74 6f 20 70 72 69 | 6e 74 20 69 74 20 28 79 |t to pri|nt it (y|
|00000660| 6f 75 20 77 69 6c 6c 0a | 63 65 72 74 61 69 6e 6c |ou will.|certainl|
|00000670| 79 20 77 61 6e 74 20 74 | 6f 20 75 73 65 20 74 68 |y want t|o use th|
|00000680| 69 73 20 66 65 61 74 75 | 72 65 20 69 66 20 74 68 |is featu|re if th|
|00000690| 65 20 6f 75 74 70 75 74 | 20 69 73 20 73 65 76 65 |e output| is seve|
|000006a0| 72 61 6c 20 70 61 67 65 | 73 20 6c 6f 6e 67 29 2e |ral page|s long).|
|000006b0| 0a 0a 54 72 79 20 24 32 | 37 2a 33 37 24 2e 20 57 |..Try $2|7*37$. W|
|000006c0| 6f 77 21 20 65 76 65 6e | 20 6d 75 6c 74 69 70 6c |ow! even| multipl|
|000006d0| 69 63 61 74 69 6f 6e 20 | 77 6f 72 6b 73 2e 0a 0a |ication |works...|
|000006e0| 4e 6f 77 20 74 68 69 73 | 20 73 65 73 73 69 6f 6e |Now this| session|
|000006f0| 20 69 73 20 67 65 74 74 | 69 6e 67 20 6c 65 6e 67 | is gett|ing leng|
|00000700| 74 68 79 2c 20 73 6f 20 | 74 68 65 20 73 65 63 6f |thy, so |the seco|
|00000710| 6e 64 20 74 68 69 6e 67 | 20 6f 6e 65 20 6e 65 65 |nd thing| one nee|
|00000720| 64 73 20 74 6f 20 6c 65 | 61 72 6e 20 69 73 20 74 |ds to le|arn is t|
|00000730| 6f 0a 71 75 69 74 2e 20 | 45 61 63 68 20 73 79 73 |o.quit. |Each sys|
|00000740| 74 65 6d 20 68 61 73 20 | 69 74 73 20 71 75 69 74 |tem has |its quit|
|00000750| 20 73 69 67 6e 61 6c 20 | 28 74 6f 20 6e 61 6d 65 | signal |(to name|
|00000760| 20 61 20 66 65 77 3a 20 | 7b 5c 74 74 20 71 75 69 | a few: |{\tt qui|
|00000770| 74 7d 2c 20 7b 5c 74 74 | 20 71 75 69 74 28 29 3b |t}, {\tt| quit();|
|00000780| 7d 2c 0a 7b 5c 74 74 20 | 65 78 69 74 7d 2c 20 7b |},.{\tt |exit}, {|
|00000790| 5c 74 74 20 73 79 73 74 | 65 6d 7d 2c 5c 64 6f 74 |\tt syst|em},\dot|
|000007a0| 73 29 2e 20 49 6e 20 47 | 50 20 69 74 20 69 73 20 |s). In G|P it is |
|000007b0| 7b 5c 74 74 20 5c 62 73 | 20 71 7d 20 28 62 61 63 |{\tt \bs| q} (bac|
|000007c0| 6b 73 6c 61 73 68 29 2c | 20 74 68 65 0a 7b 5c 74 |kslash),| the.{\t|
|000007d0| 74 20 71 7d 20 62 65 69 | 6e 67 20 6f 66 20 63 6f |t q} bei|ng of co|
|000007e0| 75 72 73 65 20 66 6f 72 | 20 71 75 69 74 2e 20 54 |urse for| quit. T|
|000007f0| 72 79 20 69 74 2e 0a 0a | 4e 6f 77 20 79 6f 75 27 |ry it...|Now you'|
|00000800| 76 65 20 64 6f 6e 65 20 | 69 74 21 20 59 6f 75 27 |ve done |it! You'|
|00000810| 72 65 20 6f 75 74 20 6f | 66 20 47 50 2c 20 73 6f |re out o|f GP, so|
|00000820| 20 68 6f 77 20 64 6f 20 | 79 6f 75 20 77 61 6e 74 | how do |you want|
|00000830| 20 74 6f 20 63 6f 6e 74 | 69 6e 75 65 20 73 74 75 | to cont|inue stu|
|00000840| 64 79 69 6e 67 20 74 68 | 69 73 0a 74 75 74 6f 72 |dying th|is.tutor|
|00000850| 69 61 6c 3f 20 47 65 74 | 20 62 61 63 6b 20 69 6e |ial? Get| back in|
|00000860| 20 70 6c 65 61 73 65 20 | 28 73 65 65 20 61 62 6f | please |(see abo|
|00000870| 76 65 29 2e 0a 0a 4c 65 | 74 27 73 20 67 65 74 20 |ve)...Le|t's get |
|00000880| 74 6f 20 6d 6f 72 65 20 | 73 65 72 69 6f 75 73 20 |to more |serious |
|00000890| 73 74 75 66 66 2e 20 4c | 65 74 27 73 20 73 65 65 |stuff. L|et's see|
|000008a0| 2c 20 49 20 73 65 65 6d | 20 74 6f 20 72 65 6d 65 |, I seem| to reme|
|000008b0| 6d 62 65 72 20 74 68 61 | 74 20 74 68 65 20 64 65 |mber tha|t the de|
|000008c0| 63 69 6d 61 6c 0a 65 78 | 70 61 6e 73 69 6f 6e 20 |cimal.ex|pansion |
|000008d0| 6f 66 20 24 31 2f 37 24 | 20 68 61 73 20 73 6f 6d |of $1/7$| has som|
|000008e0| 65 20 69 6e 74 65 72 65 | 73 74 69 6e 67 20 70 72 |e intere|sting pr|
|000008f0| 6f 70 65 72 74 69 65 73 | 2e 20 4c 65 74 27 73 20 |operties|. Let's |
|00000900| 73 65 65 20 77 68 61 74 | 20 47 50 20 68 61 73 20 |see what| GP has |
|00000910| 74 6f 20 73 61 79 0a 61 | 62 6f 75 74 20 74 68 69 |to say.a|bout thi|
|00000920| 73 2e 20 54 79 70 65 20 | 24 31 2f 37 24 2e 20 57 |s. Type |$1/7$. W|
|00000930| 68 61 74 3f 20 54 68 69 | 73 20 63 6f 6d 70 75 74 |hat? Thi|s comput|
|00000940| 65 72 20 69 73 20 6d 61 | 6b 69 6e 67 20 66 75 6e |er is ma|king fun|
|00000950| 20 6f 66 20 6d 65 2c 20 | 69 74 20 6a 75 73 74 20 | of me, |it just |
|00000960| 73 70 69 74 73 20 62 61 | 63 6b 0a 74 6f 20 6d 65 |spits ba|ck.to me|
|00000970| 20 6d 79 20 6f 77 6e 20 | 69 6e 70 75 74 2c 20 74 | my own |input, t|
|00000980| 68 61 74 27 73 20 6e 6f | 74 20 77 68 61 74 20 49 |hat's no|t what I|
|00000990| 20 77 61 6e 74 21 20 0a | 0a 4e 6f 77 20 73 74 6f | want! .|.Now sto|
|000009a0| 70 20 63 6f 6d 70 6c 61 | 69 6e 69 6e 67 2c 20 61 |p compla|ining, a|
|000009b0| 6e 64 20 74 68 69 6e 6b | 20 61 20 6c 69 74 74 6c |nd think| a littl|
|000009c0| 65 2e 20 54 68 69 73 20 | 73 79 73 74 65 6d 20 68 |e. This |system h|
|000009d0| 61 73 20 62 65 65 6e 20 | 77 72 69 74 74 65 6e 20 |as been |written |
|000009e0| 6d 61 69 6e 6c 79 20 66 | 6f 72 0a 70 75 72 65 20 |mainly f|or.pure |
|000009f0| 6d 61 74 68 65 6d 61 74 | 69 63 69 61 6e 73 2c 20 |mathemat|icians, |
|00000a00| 61 6e 64 20 6e 6f 74 20 | 66 6f 72 20 70 68 79 73 |and not |for phys|
|00000a10| 69 63 69 73 74 73 20 28 | 61 6c 74 68 6f 75 67 68 |icists (|although|
|00000a20| 20 74 68 65 79 20 61 72 | 65 20 77 65 6c 63 6f 6d | they ar|e welcom|
|00000a30| 65 20 74 6f 20 75 73 65 | 20 69 74 20 3a 2d 29 2e |e to use| it :-).|
|00000a40| 0a 41 6e 64 20 6d 61 74 | 68 65 6d 61 74 69 63 61 |.And mat|hematica|
|00000a50| 6c 6c 79 2c 20 24 31 2f | 37 24 20 69 73 20 61 6e |lly, $1/|7$ is an|
|00000a60| 20 65 6c 65 6d 65 6e 74 | 20 6f 66 20 74 68 65 20 | element| of the |
|00000a70| 66 69 65 6c 64 20 24 5c | 42 62 62 20 51 24 20 6f |field $\|Bbb Q$ o|
|00000a80| 66 20 72 61 74 69 6f 6e | 61 6c 20 6e 75 6d 62 65 |f ration|al numbe|
|00000a90| 72 73 2c 0a 73 6f 20 68 | 6f 77 20 65 6c 73 65 20 |rs,.so h|ow else |
|00000aa0| 62 75 74 20 24 31 2f 37 | 24 20 63 61 6e 20 74 68 |but $1/7|$ can th|
|00000ab0| 65 20 63 6f 6d 70 75 74 | 65 72 20 67 69 76 65 20 |e comput|er give |
|00000ac0| 74 68 65 20 61 6e 73 77 | 65 72 20 74 6f 20 79 6f |the answ|er to yo|
|00000ad0| 75 3f 20 28 77 65 6c 6c | 20 6d 61 79 62 65 20 24 |u? (well| maybe $|
|00000ae0| 32 2f 31 34 24 2c 20 62 | 75 74 0a 77 68 79 20 63 |2/14$, b|ut.why c|
|00000af0| 6f 6d 70 6c 69 63 61 74 | 65 20 6d 61 74 74 65 72 |omplicat|e matter|
|00000b00| 73 3f 29 2e 20 53 65 72 | 69 6f 75 73 6c 79 2c 20 |s?). Ser|iously, |
|00000b10| 74 68 65 20 62 61 73 69 | 63 20 70 6f 69 6e 74 20 |the basi|c point |
|00000b20| 68 65 72 65 20 69 73 20 | 74 68 61 74 20 50 41 52 |here is |that PAR|
|00000b30| 49 20 28 68 65 6e 63 65 | 20 47 50 29 0a 77 69 6c |I (hence| GP).wil|
|00000b40| 6c 20 61 6c 6d 6f 73 74 | 20 61 6c 77 61 79 73 20 |l almost| always |
|00000b50| 74 72 79 20 74 6f 20 67 | 69 76 65 20 79 6f 75 20 |try to g|ive you |
|00000b60| 61 20 72 65 73 75 6c 74 | 20 77 68 69 63 68 20 69 |a result| which i|
|00000b70| 73 20 61 73 20 70 72 65 | 63 69 73 65 20 61 73 20 |s as pre|cise as |
|00000b80| 70 6f 73 73 69 62 6c 65 | 0a 28 77 65 20 77 69 6c |possible|.(we wil|
|00000b90| 6c 20 73 65 20 77 68 79 | 20 60 60 61 6c 6d 6f 73 |l se why| ``almos|
|00000ba0| 74 27 27 20 6c 61 74 65 | 72 29 2c 20 68 65 6e 63 |t'' late|r), henc|
|00000bb0| 65 20 73 69 6e 63 65 20 | 68 65 72 65 20 79 6f 75 |e since |here you|
|00000bc0| 20 67 61 76 65 20 61 6e | 20 6f 70 65 72 61 74 69 | gave an| operati|
|00000bd0| 6f 6e 20 77 68 6f 73 65 | 0a 72 65 73 75 6c 74 20 |on whose|.result |
|00000be0| 63 61 6e 20 62 65 20 72 | 65 70 72 65 73 65 6e 74 |can be r|epresent|
|00000bf0| 65 64 20 65 78 61 63 74 | 6c 79 2c 20 74 68 61 74 |ed exact|ly, that|
|00000c00| 27 73 20 77 68 61 74 20 | 69 74 20 67 69 76 65 73 |'s what |it gives|
|00000c10| 20 79 6f 75 2e 0a 0a 4f | 4b 2c 20 62 75 74 20 49 | you...O|K, but I|
|00000c20| 20 73 74 69 6c 6c 20 77 | 61 6e 74 20 74 68 65 20 | still w|ant the |
|00000c30| 64 65 63 69 6d 61 6c 20 | 65 78 70 61 6e 73 69 6f |decimal |expansio|
|00000c40| 6e 20 6f 66 20 24 31 2f | 37 24 2e 20 4e 6f 20 70 |n of $1/|7$. No p|
|00000c50| 72 6f 62 6c 65 6d 2e 20 | 54 79 70 65 20 6f 6e 65 |roblem. |Type one|
|00000c60| 20 6f 66 20 74 68 65 0a | 66 6f 6c 6c 6f 77 69 6e | of the.|followin|
|00000c70| 67 3a 20 24 31 2e 2f 37 | 24 2c 20 24 31 2f 37 2e |g: $1./7|$, $1/7.|
|00000c80| 24 2c 20 24 31 2e 2f 37 | 2e 24 2c 20 24 30 2e 2b |$, $1./7|.$, $0.+|
|00000c90| 31 2f 37 24 2c 5c 64 6f | 74 73 2e 20 49 6d 6d 65 |1/7$,\do|ts. Imme|
|00000ca0| 64 69 61 74 65 6c 79 20 | 32 38 20 64 65 63 69 6d |diately |28 decim|
|00000cb0| 61 6c 73 20 6f 66 20 74 | 68 69 73 0a 66 72 61 63 |als of t|his.frac|
|00000cc0| 74 69 6f 6e 20 61 70 70 | 65 61 72 2c 20 61 6e 64 |tion app|ear, and|
|00000cd0| 20 74 68 65 20 72 65 70 | 65 61 74 69 6e 67 20 70 | the rep|eating p|
|00000ce0| 61 74 74 65 72 6e 20 69 | 73 20 24 31 34 32 38 35 |attern i|s $14285|
|00000cf0| 37 24 2e 20 54 68 65 20 | 72 65 61 73 6f 6e 20 69 |7$. The |reason i|
|00000d00| 73 20 74 68 61 74 20 79 | 6f 75 20 68 61 76 65 0a |s that y|ou have.|
|00000d10| 69 6e 63 6c 75 64 65 64 | 20 69 6e 20 74 68 65 20 |included| in the |
|00000d20| 6f 70 65 72 61 74 69 6f | 6e 73 20 6e 75 6d 62 65 |operatio|ns numbe|
|00000d30| 72 73 20 6c 69 6b 65 20 | 24 30 2e 24 2c 20 24 31 |rs like |$0.$, $1|
|00000d40| 2e 24 20 6f 72 20 24 37 | 2e 24 20 77 68 69 63 68 |.$ or $7|.$ which|
|00000d50| 20 61 72 65 20 7b 5c 73 | 6c 20 69 6d 70 72 65 63 | are {\s|l imprec|
|00000d60| 69 73 65 5c 2f 7d 0a 72 | 65 61 6c 20 6e 75 6d 62 |ise\/}.r|eal numb|
|00000d70| 65 72 73 2c 20 68 65 6e | 63 65 20 47 50 20 63 61 |ers, hen|ce GP ca|
|00000d80| 6e 6e 6f 74 20 67 69 76 | 65 20 79 6f 75 20 61 6e |nnot giv|e you an|
|00000d90| 20 65 78 61 63 74 20 72 | 65 73 75 6c 74 2e 0a 0a | exact r|esult...|
|00000da0| 57 68 79 20 32 38 20 64 | 65 63 69 6d 61 6c 73 20 |Why 28 d|ecimals |
|00000db0| 62 79 20 74 68 65 20 77 | 61 79 3f 20 77 65 6c 6c |by the w|ay? well|
|00000dc0| 2c 20 69 74 20 69 73 20 | 74 68 65 20 64 65 66 61 |, it is |the defa|
|00000dd0| 75 6c 74 20 69 6e 69 74 | 69 61 6c 20 70 72 65 63 |ult init|ial prec|
|00000de0| 69 73 69 6f 6e 2c 20 61 | 73 20 69 6e 64 69 63 61 |ision, a|s indica|
|00000df0| 74 65 64 0a 77 68 65 6e | 20 79 6f 75 20 6c 61 75 |ted.when| you lau|
|00000e00| 6e 63 68 20 47 50 2e 20 | 54 68 69 73 20 68 61 73 |nch GP. |This has|
|00000e10| 20 62 65 65 6e 20 63 68 | 6f 73 65 6e 20 73 6f 20 | been ch|osen so |
|00000e20| 74 68 61 74 20 74 68 65 | 20 63 6f 6d 70 75 74 61 |that the| computa|
|00000e30| 74 69 6f 6e 73 20 61 72 | 65 20 76 65 72 79 20 66 |tions ar|e very f|
|00000e40| 61 73 74 2c 0a 61 6e 64 | 20 67 69 76 65 20 61 6c |ast,.and| give al|
|00000e50| 72 65 61 64 79 20 31 32 | 20 64 65 63 69 6d 61 6c |ready 12| decimal|
|00000e60| 73 20 6d 6f 72 65 20 61 | 63 63 75 72 61 63 79 20 |s more a|ccuracy |
|00000e70| 74 68 61 6e 20 63 6f 6e | 76 65 6e 74 69 6f 6e 61 |than con|ventiona|
|00000e80| 6c 20 64 6f 75 62 6c 65 | 20 70 72 65 63 69 73 69 |l double| precisi|
|00000e90| 6f 6e 0a 66 6c 6f 61 74 | 69 6e 67 20 70 6f 69 6e |on.float|ing poin|
|00000ea0| 74 20 6f 70 65 72 61 74 | 69 6f 6e 73 2e 20 4f 6e |t operat|ions. On|
|00000eb0| 6c 79 20 6c 61 72 67 65 | 20 6d 61 69 6e 66 72 61 |ly large| mainfra|
|00000ec0| 6d 65 73 20 6f 72 20 73 | 75 70 65 72 63 6f 6d 70 |mes or s|upercomp|
|00000ed0| 75 74 65 72 73 20 68 61 | 76 65 20 32 38 20 64 69 |uters ha|ve 28 di|
|00000ee0| 67 69 74 73 0a 6f 66 20 | 70 72 65 63 69 73 69 6f |gits.of |precisio|
|00000ef0| 6e 20 69 6e 20 74 68 65 | 69 72 20 73 74 61 6e 64 |n in the|ir stand|
|00000f00| 61 72 64 20 6c 69 62 72 | 61 72 69 65 73 2c 20 61 |ard libr|aries, a|
|00000f10| 6e 64 20 74 68 61 74 20 | 69 73 20 74 68 65 20 61 |nd that |is the a|
|00000f20| 62 73 6f 6c 75 74 65 20 | 6c 69 6d 69 74 2e 0a 0a |bsolute |limit...|
|00000f30| 4e 6f 74 20 68 65 72 65 | 20 6f 66 20 63 6f 75 72 |Not here| of cour|
|00000f40| 73 65 2e 20 59 6f 75 20 | 63 61 6e 20 65 78 74 65 |se. You |can exte|
|00000f50| 6e 64 20 74 68 65 20 70 | 72 65 63 69 73 69 6f 6e |nd the p|recision|
|00000f60| 20 28 61 6c 6d 6f 73 74 | 29 20 61 73 20 6d 75 63 | (almost|) as muc|
|00000f70| 68 20 61 73 20 79 6f 75 | 20 6c 69 6b 65 20 61 73 |h as you| like as|
|00000f80| 0a 77 65 20 77 69 6c 6c | 20 73 65 65 20 69 6e 20 |.we will| see in |
|00000f90| 61 20 6d 6f 6d 65 6e 74 | 2e 0a 0a 49 27 6d 20 67 |a moment|...I'm g|
|00000fa0| 65 74 74 69 6e 67 20 62 | 6f 72 65 64 2c 20 77 68 |etting b|ored, wh|
|00000fb0| 79 20 64 6f 6e 27 74 20 | 77 65 20 67 65 74 20 6f |y don't |we get o|
|00000fc0| 6e 20 77 69 74 68 20 73 | 6f 6d 65 20 6d 6f 72 65 |n with s|ome more|
|00000fd0| 20 65 78 63 69 74 69 6e | 67 20 73 74 75 66 66 3f | excitin|g stuff?|
|00000fe0| 0a 57 65 6c 6c 2c 20 74 | 72 79 20 7b 5c 74 74 20 |.Well, t|ry {\tt |
|00000ff0| 65 78 70 28 31 29 7d 2e | 20 50 72 65 73 74 6f 2c |exp(1)}.| Presto,|
|00001000| 20 63 6f 6d 65 73 20 6f | 75 74 20 74 68 65 20 76 | comes o|ut the v|
|00001010| 61 6c 75 65 20 6f 66 20 | 24 65 24 20 74 6f 20 32 |alue of |$e$ to 2|
|00001020| 38 20 64 69 67 69 74 73 | 2e 0a 54 72 79 20 7b 5c |8 digits|..Try {\|
|00001030| 74 74 20 6c 6f 67 28 65 | 78 70 28 31 29 29 7d 2e |tt log(e|xp(1))}.|
|00001040| 20 57 65 6c 6c 2c 20 69 | 74 27 73 20 6e 6f 74 20 | Well, i|t's not |
|00001050| 65 78 61 63 74 6c 79 20 | 65 71 75 61 6c 20 74 6f |exactly |equal to|
|00001060| 20 31 2c 20 62 75 74 20 | 70 72 65 74 74 79 20 63 | 1, but |pretty c|
|00001070| 6c 6f 73 65 21 0a 54 68 | 61 74 27 73 20 77 68 61 |lose!.Th|at's wha|
|00001080| 74 20 79 6f 75 20 6c 6f | 73 65 20 62 79 20 77 6f |t you lo|se by wo|
|00001090| 72 6b 69 6e 67 20 6e 75 | 6d 65 72 69 63 61 6c 6c |rking nu|mericall|
|000010a0| 79 2e 0a 0a 4e 6f 77 20 | 74 72 79 20 7b 5c 74 74 |y...Now |try {\tt|
|000010b0| 20 65 78 70 28 70 69 2a | 73 71 72 74 28 31 36 33 | exp(pi*|sqrt(163|
|000010c0| 29 29 7d 2e 20 48 6d 6d | 6d 2c 20 73 69 6e 63 65 |))}. Hmm|m, since|
|000010d0| 20 66 72 6f 6d 20 6f 75 | 72 20 6c 61 73 74 20 65 | from ou|r last e|
|000010e0| 78 61 6d 70 6c 65 20 77 | 65 20 73 75 73 70 65 63 |xample w|e suspec|
|000010f0| 74 0a 74 68 61 74 20 74 | 68 65 20 6c 61 73 74 20 |t.that t|he last |
|00001100| 64 69 67 69 74 20 6d 61 | 79 20 62 65 20 77 72 6f |digit ma|y be wro|
|00001110| 6e 67 2c 20 63 61 6e 20 | 74 68 69 73 20 72 65 61 |ng, can |this rea|
|00001120| 6c 6c 79 20 62 65 20 61 | 6e 20 69 6e 74 65 67 65 |lly be a|n intege|
|00001130| 72 3f 0a 54 68 69 73 20 | 69 73 20 74 68 65 20 74 |r?.This |is the t|
|00001140| 69 6d 65 20 74 6f 20 63 | 68 61 6e 67 65 20 70 72 |ime to c|hange pr|
|00001150| 65 63 69 73 69 6f 6e 2e | 20 54 79 70 65 20 7b 5c |ecision.| Type {\|
|00001160| 74 74 20 5c 62 73 20 70 | 72 65 63 69 73 69 6f 6e |tt \bs p|recision|
|00001170| 3d 35 30 7d 2c 0a 74 68 | 65 6e 20 74 72 79 20 7b |=50},.th|en try {|
|00001180| 5c 74 74 20 65 78 70 28 | 70 69 2a 73 71 72 74 28 |\tt exp(|pi*sqrt(|
|00001190| 31 36 33 29 29 7d 20 61 | 67 61 69 6e 2e 20 57 65 |163))} a|gain. We|
|000011a0| 20 77 65 72 65 20 72 69 | 67 68 74 20 74 6f 20 73 | were ri|ght to s|
|000011b0| 75 73 70 65 63 74 20 74 | 68 61 74 20 74 68 65 20 |uspect t|hat the |
|000011c0| 6c 61 73 74 0a 64 65 63 | 69 6d 61 6c 20 77 61 73 |last.dec|imal was|
|000011d0| 20 69 6e 63 6f 72 72 65 | 63 74 2c 20 73 69 6e 63 | incorre|ct, sinc|
|000011e0| 65 20 77 65 20 67 65 74 | 20 65 76 65 6e 20 6d 6f |e we get| even mo|
|000011f0| 72 65 20 6e 69 6e 65 73 | 20 74 68 61 6e 20 62 65 |re nines| than be|
|00001200| 66 6f 72 65 2c 20 62 75 | 74 20 69 74 20 69 73 20 |fore, bu|t it is |
|00001210| 6e 6f 77 0a 63 6f 6e 76 | 69 6e 63 69 6e 67 6c 79 |now.conv|incingly|
|00001220| 20 63 6c 65 61 72 20 74 | 68 61 74 20 74 68 69 73 | clear t|hat this|
|00001230| 20 69 73 20 6e 6f 74 20 | 61 6e 20 69 6e 74 65 67 | is not |an integ|
|00001240| 65 72 2e 20 4d 61 79 62 | 65 20 69 74 27 73 20 61 |er. Mayb|e it's a|
|00001250| 20 62 75 67 20 69 6e 20 | 50 41 52 49 2c 20 61 6e | bug in |PARI, an|
|00001260| 64 0a 74 68 65 20 72 65 | 73 75 6c 74 20 69 73 20 |d.the re|sult is |
|00001270| 72 65 61 6c 6c 79 20 61 | 6e 20 69 6e 74 65 67 65 |really a|n intege|
|00001280| 72 3f 20 54 79 70 65 20 | 7b 5c 74 74 20 73 71 72 |r? Type |{\tt sqr|
|00001290| 28 6c 6f 67 28 5c 25 29 | 2f 70 69 29 7d 20 69 6d |(log(\%)|/pi)} im|
|000012a0| 6d 65 64 69 61 74 65 6c | 79 20 61 66 74 65 72 0a |mediatel|y after.|
|000012b0| 74 68 65 20 70 72 65 63 | 65 64 69 6e 67 20 63 6f |the prec|eding co|
|000012c0| 6d 70 75 74 61 74 69 6f | 6e 0a 28 7b 5c 74 74 20 |mputatio|n.({\tt |
|000012d0| 5c 25 7d 20 6d 65 61 6e | 73 20 74 68 65 20 72 65 |\%} mean|s the re|
|000012e0| 73 75 6c 74 20 6f 66 20 | 74 68 65 20 6c 61 73 74 |sult of |the last|
|000012f0| 20 63 6f 6d 70 75 74 65 | 64 20 65 78 70 72 65 73 | compute|d expres|
|00001300| 73 69 6f 6e 2e 20 4d 6f | 72 65 20 67 65 6e 65 72 |sion. Mo|re gener|
|00001310| 61 6c 6c 79 2c 20 74 68 | 65 0a 72 65 73 75 6c 74 |ally, th|e.result|
|00001320| 73 20 61 72 65 20 6e 75 | 6d 62 65 72 65 64 20 7b |s are nu|mbered {|
|00001330| 5c 74 74 20 5c 25 31 2c | 20 5c 25 32 2c 20 5c 64 |\tt \%1,| \%2, \d|
|00001340| 6f 74 73 7d 20 7b 5c 62 | 66 20 69 6e 63 6c 75 64 |ots} {\b|f includ|
|00001350| 69 6e 67 7d 20 74 68 65 | 20 72 65 73 75 6c 74 73 |ing} the| results|
|00001360| 20 74 68 61 74 20 79 6f | 75 0a 64 6f 20 6e 6f 74 | that yo|u.do not|
|00001370| 20 77 61 6e 74 20 74 6f | 20 73 65 65 20 70 72 69 | want to| see pri|
|00001380| 6e 74 65 64 20 62 79 20 | 70 75 74 74 69 6e 67 20 |nted by |putting |
|00001390| 61 20 73 65 6d 69 63 6f | 6c 6f 6e 20 61 74 20 74 |a semico|lon at t|
|000013a0| 68 65 20 65 6e 64 20 6f | 66 20 74 68 65 20 6c 69 |he end o|f the li|
|000013b0| 6e 65 2c 20 61 6e 64 0a | 79 6f 75 20 63 61 6e 20 |ne, and.|you can |
|000013c0| 65 76 69 64 65 6e 74 6c | 79 20 75 73 65 20 61 6c |evidentl|y use al|
|000013d0| 6c 20 74 68 65 73 65 20 | 71 75 61 6e 74 69 74 69 |l these |quantiti|
|000013e0| 65 73 20 69 6e 20 61 6e | 79 20 66 75 72 74 68 65 |es in an|y furthe|
|000013f0| 72 20 63 6f 6d 70 75 74 | 61 74 69 6f 6e 73 2e 20 |r comput|ations. |
|00001400| 7b 5c 74 74 20 73 71 72 | 7d 0a 69 73 20 74 68 65 |{\tt sqr|}.is the|
|00001410| 20 73 71 75 61 72 65 20 | 66 75 6e 63 74 69 6f 6e | square |function|
|00001420| 20 28 7b 5c 74 74 20 73 | 71 72 28 78 29 3d 78 2a | ({\tt s|qr(x)=x*|
|00001430| 78 7d 29 2c 20 6e 6f 74 | 20 74 6f 20 62 65 20 63 |x}), not| to be c|
|00001440| 6f 6e 66 75 73 65 64 20 | 77 69 74 68 20 7b 5c 74 |onfused |with {\t|
|00001450| 74 20 73 71 72 74 7d 0a | 77 68 69 63 68 20 69 73 |t sqrt}.|which is|
|00001460| 20 74 68 65 20 73 71 75 | 61 72 65 20 72 6f 6f 74 | the squ|are root|
|00001470| 20 66 75 6e 63 74 69 6f | 6e 29 2e 20 54 68 65 20 | functio|n). The |
|00001480| 72 65 73 75 6c 74 20 73 | 65 65 6d 73 20 74 6f 20 |result s|eems to |
|00001490| 62 65 20 69 6e 64 69 73 | 74 69 6e 67 75 69 73 68 |be indis|tinguish|
|000014a0| 61 62 6c 65 0a 66 72 6f | 6d 20 31 36 33 2c 20 68 |able.fro|m 163, h|
|000014b0| 65 6e 63 65 20 69 74 20 | 64 6f 65 73 20 6e 6f 74 |ence it |does not|
|000014c0| 20 73 65 65 6d 20 74 6f | 20 62 65 20 61 20 62 75 | seem to| be a bu|
|000014d0| 67 2e 0a 0a 49 6e 20 66 | 61 63 74 20 69 74 20 69 |g...In f|act it i|
|000014e0| 73 20 61 20 6b 6e 6f 77 | 6e 20 66 61 63 74 20 74 |s a know|n fact t|
|000014f0| 68 61 74 20 7b 5c 74 74 | 20 65 78 70 28 70 69 2a |hat {\tt| exp(pi*|
|00001500| 73 71 72 74 28 6e 29 29 | 7d 20 6e 6f 74 20 6f 6e |sqrt(n))|} not on|
|00001510| 6c 79 20 69 73 20 6e 6f | 74 20 61 6e 20 69 6e 74 |ly is no|t an int|
|00001520| 65 67 65 72 0a 6f 72 20 | 61 20 72 61 74 69 6f 6e |eger.or |a ration|
|00001530| 61 6c 20 6e 75 6d 62 65 | 72 2c 20 62 75 74 20 69 |al numbe|r, but i|
|00001540| 73 20 65 76 65 6e 20 61 | 20 74 72 61 6e 73 63 65 |s even a| transce|
|00001550| 6e 64 65 6e 74 61 6c 20 | 6e 75 6d 62 65 72 20 77 |ndental |number w|
|00001560| 68 65 6e 20 24 6e 24 20 | 69 73 20 61 20 70 6f 73 |hen $n$ |is a pos|
|00001570| 69 74 69 76 65 0a 72 61 | 74 69 6f 6e 61 6c 20 6e |itive.ra|tional n|
|00001580| 75 6d 62 65 72 2e 0a 0a | 53 6f 20 47 50 20 69 73 |umber...|So GP is|
|00001590| 20 6a 75 73 74 20 61 20 | 66 61 6e 63 79 20 63 61 | just a |fancy ca|
|000015a0| 6c 63 75 6c 61 74 6f 72 | 2c 20 61 62 6c 65 20 74 |lculator|, able t|
|000015b0| 6f 20 67 69 76 65 20 6d | 65 20 6d 6f 72 65 20 64 |o give m|e more d|
|000015c0| 65 63 69 6d 61 6c 73 20 | 74 68 61 6e 20 49 20 77 |ecimals |than I w|
|000015d0| 69 6c 6c 20 65 76 65 72 | 0a 6e 65 65 64 3f 20 4e |ill ever|.need? N|
|000015e0| 6f 74 20 73 6f 2c 20 47 | 50 20 69 73 20 69 6e 63 |ot so, G|P is inc|
|000015f0| 72 65 64 69 62 6c 79 20 | 6d 6f 72 65 20 70 6f 77 |redibly |more pow|
|00001600| 65 72 66 75 6c 20 74 68 | 61 6e 20 61 6e 20 6f 72 |erful th|an an or|
|00001610| 64 69 6e 61 72 79 20 63 | 61 6c 63 75 6c 61 74 6f |dinary c|alculato|
|00001620| 72 2c 20 65 76 65 6e 0a | 69 6e 64 65 70 65 6e 64 |r, even.|independ|
|00001630| 65 6e 74 6c 79 20 6f 66 | 20 69 74 73 20 61 72 62 |ently of| its arb|
|00001640| 69 74 72 61 72 79 20 70 | 72 65 63 69 73 69 6f 6e |itrary p|recision|
|00001650| 20 70 6f 73 73 69 62 69 | 6c 69 74 69 65 73 2e 0a | possibi|lities..|
|00001660| 5c 6d 65 64 73 6b 69 70 | 0a 7b 5c 62 66 20 41 64 |\medskip|.{\bf Ad|
|00001670| 64 69 74 69 6f 6e 61 6c | 20 63 6f 6d 6d 65 6e 74 |ditional| comment|
|00001680| 73 7d 0a 0a 59 6f 75 20 | 61 72 65 20 73 75 70 70 |s}..You |are supp|
|00001690| 6f 73 65 64 20 74 6f 20 | 73 6b 69 70 20 74 68 69 |osed to |skip thi|
|000016a0| 73 20 61 74 20 66 69 72 | 73 74 2c 20 61 6e 64 20 |s at fir|st, and |
|000016b0| 63 6f 6d 65 20 62 61 63 | 6b 20 6c 61 74 65 72 2e |come bac|k later.|
|000016c0| 0a 5c 73 6d 61 6c 6c 73 | 6b 69 70 0a 31 29 20 49 |.\smalls|kip.1) I|
|000016d0| 74 20 73 65 65 6d 73 20 | 74 68 61 74 20 74 68 65 |t seems |that the|
|000016e0| 20 74 65 78 74 20 69 6d | 70 6c 69 63 69 74 6c 79 | text im|plicitly|
|000016f0| 20 73 61 79 73 20 74 68 | 61 74 20 61 73 20 73 6f | says th|at as so|
|00001700| 6f 6e 20 61 73 20 61 6e | 20 69 6d 70 72 65 63 69 |on as an| impreci|
|00001710| 73 65 20 6e 75 6d 62 65 | 72 0a 69 73 20 65 6e 74 |se numbe|r.is ent|
|00001720| 65 72 65 64 2c 20 74 68 | 65 20 72 65 73 75 6c 74 |ered, th|e result|
|00001730| 20 77 69 6c 6c 20 62 65 | 20 69 6d 70 72 65 63 69 | will be| impreci|
|00001740| 73 65 2e 20 49 73 20 74 | 68 69 73 20 61 6c 77 61 |se. Is t|his alwa|
|00001750| 79 73 20 74 72 75 65 3f | 20 54 68 65 72 65 20 69 |ys true?| There i|
|00001760| 73 20 61 20 75 6e 69 71 | 75 65 0a 65 78 63 65 70 |s a uniq|ue.excep|
|00001770| 74 69 6f 6e 3a 20 77 68 | 65 6e 20 79 6f 75 20 6d |tion: wh|en you m|
|00001780| 75 6c 74 69 70 6c 79 20 | 61 6e 20 69 6d 70 72 65 |ultiply |an impre|
|00001790| 63 69 73 65 20 6e 75 6d | 62 65 72 20 62 79 20 74 |cise num|ber by t|
|000017a0| 68 65 20 65 78 61 63 74 | 20 6e 75 6d 62 65 72 20 |he exact| number |
|000017b0| 30 2c 20 79 6f 75 20 77 | 69 6c 6c 0a 67 65 74 20 |0, you w|ill.get |
|000017c0| 74 68 65 20 65 78 61 63 | 74 20 30 2e 20 54 72 79 |the exac|t 0. Try|
|000017d0| 3a 20 24 30 2a 31 2e 34 | 24 2c 20 61 6e 64 20 63 |: $0*1.4|$, and c|
|000017e0| 6f 6d 70 61 72 65 20 77 | 69 74 68 20 24 30 2e 2a |ompare w|ith $0.*|
|000017f0| 31 2e 34 24 2e 0a 5c 73 | 6d 61 6c 6c 73 6b 69 70 |1.4$..\s|mallskip|
|00001800| 0a 32 29 20 4e 6f 74 20 | 6f 6e 6c 79 20 63 61 6e |.2) Not |only can|
|00001810| 20 74 68 65 20 6e 75 6d | 62 65 72 20 6f 66 20 64 | the num|ber of d|
|00001820| 65 63 69 6d 61 6c 20 70 | 6c 61 63 65 73 20 6f 66 |ecimal p|laces of|
|00001830| 20 72 65 61 6c 20 6e 75 | 6d 62 65 72 73 20 62 65 | real nu|mbers be|
|00001840| 20 6c 61 72 67 65 2c 20 | 62 75 74 20 74 68 65 0a | large, |but the.|
|00001850| 6e 75 6d 62 65 72 20 6f | 66 20 64 69 67 69 74 73 |number o|f digits|
|00001860| 20 6f 66 20 69 6e 74 65 | 67 65 72 73 20 61 6c 73 | of inte|gers als|
|00001870| 6f 2e 20 54 72 79 20 24 | 31 30 30 21 24 2e 20 49 |o. Try $|100!$. I|
|00001880| 74 20 69 73 20 6e 65 76 | 65 72 20 6e 65 63 65 73 |t is nev|er neces|
|00001890| 73 61 72 79 20 74 6f 20 | 74 65 6c 6c 0a 69 6e 20 |sary to |tell.in |
|000018a0| 61 64 76 61 6e 63 65 20 | 74 6f 20 47 50 20 74 68 |advance |to GP th|
|000018b0| 65 20 73 69 7a 65 20 6f | 66 20 74 68 65 20 69 6e |e size o|f the in|
|000018c0| 74 65 67 65 72 73 20 74 | 68 61 74 20 69 74 20 77 |tegers t|hat it w|
|000018d0| 69 6c 6c 20 65 6e 63 6f | 75 6e 74 65 72 2c 20 73 |ill enco|unter, s|
|000018e0| 69 6e 63 65 20 74 68 69 | 73 20 69 73 0a 61 64 6a |ince thi|s is.adj|
|000018f0| 75 73 74 65 64 20 61 75 | 74 6f 6d 61 74 69 63 61 |usted au|tomatica|
|00001900| 6c 6c 79 2e 20 4f 6e 20 | 74 68 65 20 6f 74 68 65 |lly. On |the othe|
|00001910| 72 20 68 61 6e 64 2c 20 | 66 6f 72 20 6d 61 6e 79 |r hand, |for many|
|00001920| 20 63 6f 6d 70 75 74 61 | 74 69 6f 6e 73 20 77 69 | computa|tions wi|
|00001930| 74 68 0a 72 65 61 6c 20 | 6e 75 6d 62 65 72 73 2c |th.real |numbers,|
|00001940| 20 69 74 20 69 73 20 6e | 65 63 65 73 73 61 72 79 | it is n|ecessary|
|00001950| 20 74 6f 20 73 70 65 63 | 69 66 79 20 61 20 64 65 | to spec|ify a de|
|00001960| 66 61 75 6c 74 20 70 72 | 65 63 69 73 69 6f 6e 20 |fault pr|ecision |
|00001970| 28 69 6e 69 74 69 61 6c | 6c 79 20 32 38 20 64 69 |(initial|ly 28 di|
|00001980| 67 69 74 73 29 2e 0a 5c | 73 6d 61 6c 6c 73 6b 69 |gits)..\|smallski|
|00001990| 70 0a 33 29 20 43 6f 6d | 65 20 62 61 63 6b 20 74 |p.3) Com|e back t|
|000019a0| 6f 20 32 38 20 64 69 67 | 69 74 73 20 6f 66 20 70 |o 28 dig|its of p|
|000019b0| 72 65 63 69 73 69 6f 6e | 20 28 7b 5c 74 74 20 5c |recision| ({\tt \|
|000019c0| 62 73 20 70 72 65 63 69 | 73 69 6f 6e 3d 32 38 7d |bs preci|sion=28}|
|000019d0| 29 2c 20 61 6e 64 20 74 | 79 70 65 0a 7b 5c 74 74 |), and t|ype.{\tt|
|000019e0| 20 65 78 70 28 32 34 2a | 70 69 29 7d 2e 20 57 68 | exp(24*|pi)}. Wh|
|000019f0| 61 74 20 69 73 20 74 68 | 69 73 20 24 2a 24 20 74 |at is th|is $*$ t|
|00001a00| 68 61 74 20 79 6f 75 20 | 67 65 74 20 61 74 20 74 |hat you |get at t|
|00001a10| 68 65 20 65 6e 64 20 6f | 66 20 74 68 65 20 72 65 |he end o|f the re|
|00001a20| 73 75 6c 74 3f 0a 0a 57 | 65 6c 6c 2c 20 47 50 20 |sult?..W|ell, GP |
|00001a30| 6e 65 76 65 72 20 77 61 | 6e 74 73 20 79 6f 75 20 |never wa|nts you |
|00001a40| 74 6f 20 62 65 6c 69 65 | 76 65 20 74 68 61 74 20 |to belie|ve that |
|00001a50| 61 20 72 65 73 75 6c 74 | 20 69 73 20 63 6f 72 72 |a result| is corr|
|00001a60| 65 63 74 20 77 68 65 6e | 20 69 74 20 69 73 20 6e |ect when| it is n|
|00001a70| 6f 74 2e 0a 57 65 20 61 | 72 65 20 77 6f 72 6b 69 |ot..We a|re worki|
|00001a80| 6e 67 20 77 69 74 68 20 | 32 38 20 64 69 67 69 74 |ng with |28 digit|
|00001a90| 73 20 6f 66 20 70 72 65 | 63 69 73 69 6f 6e 2c 20 |s of pre|cision, |
|00001aa0| 62 75 74 20 74 68 65 20 | 69 6e 74 65 67 65 72 20 |but the |integer |
|00001ab0| 70 61 72 74 20 6f 66 20 | 7b 5c 74 74 20 65 78 70 |part of |{\tt exp|
|00001ac0| 28 32 34 2a 70 69 29 7d | 0a 68 61 73 20 33 33 20 |(24*pi)}|.has 33 |
|00001ad0| 64 65 63 69 6d 61 6c 20 | 64 69 67 69 74 73 2e 20 |decimal |digits. |
|00001ae0| 48 65 6e 63 65 20 47 50 | 20 64 75 74 69 66 75 6c |Hence GP| dutiful|
|00001af0| 6c 79 20 70 72 69 6e 74 | 73 20 6f 75 74 20 33 33 |ly print|s out 33|
|00001b00| 20 64 69 67 69 74 73 2c | 20 62 75 74 20 69 74 20 | digits,| but it |
|00001b10| 70 72 69 6e 74 73 20 61 | 0a 24 2a 24 20 74 6f 20 |prints a|.$*$ to |
|00001b20| 77 61 72 6e 20 79 6f 75 | 20 74 68 61 74 20 74 68 |warn you| that th|
|00001b30| 65 20 6c 61 73 74 20 66 | 65 77 20 64 69 67 69 74 |e last f|ew digit|
|00001b40| 73 20 61 72 65 20 77 72 | 6f 6e 67 20 28 77 69 74 |s are wr|ong (wit|
|00001b50| 68 6f 75 74 20 74 65 6c | 6c 69 6e 67 20 79 6f 75 |hout tel|ling you|
|00001b60| 20 68 6f 77 0a 6d 61 6e | 79 29 2e 20 54 68 65 20 | how.man|y). The |
|00001b70| 24 2a 24 20 63 61 6e 20 | 74 68 75 73 20 62 65 20 |$*$ can |thus be |
|00001b80| 69 6e 74 65 72 70 72 65 | 74 65 64 20 61 73 20 61 |interpre|ted as a|
|00001b90| 20 64 65 63 69 6d 61 6c | 20 70 6f 69 6e 74 20 77 | decimal| point w|
|00001ba0| 69 74 68 20 61 20 77 61 | 72 6e 69 6e 67 20 6d 65 |ith a wa|rning me|
|00001bb0| 73 73 61 67 65 2e 0a 5c | 73 6d 61 6c 6c 73 6b 69 |ssage..\|smallski|
|00001bc0| 70 0a 34 29 20 54 6f 20 | 61 76 6f 69 64 20 74 68 |p.4) To |avoid th|
|00001bd0| 69 73 20 24 2a 24 2c 20 | 74 68 65 72 65 20 61 72 |is $*$, |there ar|
|00001be0| 65 20 74 77 6f 20 77 61 | 79 73 2e 20 4f 6e 65 20 |e two wa|ys. One |
|00001bf0| 69 73 20 6f 66 20 63 6f | 75 72 73 65 20 74 6f 20 |is of co|urse to |
|00001c00| 69 6e 63 72 65 61 73 65 | 20 74 68 65 20 70 72 65 |increase| the pre|
|00001c10| 63 69 73 69 6f 6e 0a 74 | 6f 20 6d 6f 72 65 20 74 |cision.t|o more t|
|00001c20| 68 61 6e 20 33 33 20 64 | 65 63 69 6d 61 6c 73 2e |han 33 d|ecimals.|
|00001c30| 20 4c 65 74 27 73 20 74 | 72 79 20 69 74 2e 20 54 | Let's t|ry it. T|
|00001c40| 6f 20 67 69 76 65 20 69 | 74 20 61 20 77 69 64 65 |o give i|t a wide|
|00001c50| 20 6d 61 72 67 69 6e 2c | 20 77 65 20 73 65 74 20 | margin,| we set |
|00001c60| 74 68 65 0a 70 72 65 63 | 69 73 69 6f 6e 20 74 6f |the.prec|ision to|
|00001c70| 20 34 30 20 64 65 63 69 | 6d 61 6c 73 2e 20 54 68 | 40 deci|mals. Th|
|00001c80| 65 6e 20 77 65 20 72 65 | 63 61 6c 6c 20 6f 75 72 |en we re|call our|
|00001c90| 20 6c 61 73 74 20 72 65 | 73 75 6c 74 20 28 7b 5c | last re|sult ({\|
|00001ca0| 74 74 20 5c 25 7d 20 6f | 72 20 7b 5c 74 74 20 5c |tt \%} o|r {\tt \|
|00001cb0| 25 6e 7d 0a 77 68 65 72 | 65 20 7b 5c 74 74 20 6e |%n}.wher|e {\tt n|
|00001cc0| 7d 20 69 73 20 74 68 65 | 20 6e 75 6d 62 65 72 20 |} is the| number |
|00001cd0| 6f 66 20 74 68 65 20 72 | 65 73 75 6c 74 29 2e 20 |of the r|esult). |
|00001ce0| 57 68 61 74 3f 20 57 65 | 20 73 74 69 6c 6c 20 68 |What? We| still h|
|00001cf0| 61 76 65 20 74 68 65 20 | 24 2a 24 21 20 44 6f 20 |ave the |$*$! Do |
|00001d00| 79 6f 75 0a 75 6e 64 65 | 72 73 74 61 6e 64 20 77 |you.unde|rstand w|
|00001d10| 68 79 3f 0a 0a 41 67 61 | 69 6e 20 6c 65 74 27 73 |hy?..Aga|in let's|
|00001d20| 20 74 72 79 20 74 6f 20 | 73 65 65 20 77 68 61 74 | try to |see what|
|00001d30| 27 73 20 68 61 70 70 65 | 6e 69 6e 67 2e 20 54 68 |'s happe|ning. Th|
|00001d40| 65 20 6e 75 6d 62 65 72 | 20 79 6f 75 20 72 65 63 |e number| you rec|
|00001d50| 61 6c 6c 65 64 20 68 61 | 64 20 62 65 65 6e 20 63 |alled ha|d been c|
|00001d60| 6f 6d 70 75 74 65 64 20 | 6f 6e 6c 79 0a 74 6f 20 |omputed |only.to |
|00001d70| 32 38 20 64 65 63 69 6d | 61 6c 73 2c 20 61 6e 64 |28 decim|als, and|
|00001d80| 20 65 76 65 6e 20 69 66 | 20 79 6f 75 20 73 65 74 | even if| you set|
|00001d90| 20 74 68 65 20 70 72 65 | 63 69 73 69 6f 6e 20 74 | the pre|cision t|
|00001da0| 6f 20 31 30 30 30 20 64 | 65 63 69 6d 61 6c 73 2c |o 1000 d|ecimals,|
|00001db0| 20 47 50 20 6b 6e 6f 77 | 73 20 74 68 61 74 0a 79 | GP know|s that.y|
|00001dc0| 6f 75 72 20 6e 75 6d 62 | 65 72 20 68 61 73 20 6f |our numb|er has o|
|00001dd0| 6e 6c 79 20 32 38 20 64 | 69 67 69 74 73 20 6f 66 |nly 28 d|igits of|
|00001de0| 20 61 63 63 75 72 61 63 | 79 20 62 75 74 20 61 6e | accurac|y but an|
|00001df0| 20 69 6e 74 65 67 72 61 | 6c 20 70 61 72 74 20 77 | integra|l part w|
|00001e00| 69 74 68 20 33 33 20 64 | 69 67 69 74 73 2e 20 53 |ith 33 d|igits. S|
|00001e10| 6f 0a 79 6f 75 20 68 61 | 76 65 6e 27 74 20 69 6d |o.you ha|ven't im|
|00001e20| 70 72 6f 76 65 64 20 74 | 68 69 6e 67 73 20 62 79 |proved t|hings by|
|00001e30| 20 69 6e 63 72 65 61 73 | 69 6e 67 20 74 68 65 20 | increas|ing the |
|00001e40| 70 72 65 63 69 73 69 6f | 6e 2e 20 4f 72 20 68 61 |precisio|n. Or ha|
|00001e50| 76 65 20 79 6f 75 3f 20 | 57 68 61 74 20 69 66 20 |ve you? |What if |
|00001e60| 77 65 0a 72 65 74 79 70 | 65 20 7b 5c 74 74 20 65 |we.retyp|e {\tt e|
|00001e70| 78 70 28 32 34 2a 70 69 | 29 7d 20 6e 6f 77 20 74 |xp(24*pi|)} now t|
|00001e80| 68 61 74 20 77 65 20 68 | 61 76 65 20 34 30 20 64 |hat we h|ave 40 d|
|00001e90| 69 67 69 74 73 3f 20 54 | 72 79 20 69 74 2e 20 4e |igits? T|ry it. N|
|00001ea0| 6f 77 20 77 65 20 64 6f | 20 6e 6f 74 20 68 61 76 |ow we do| not hav|
|00001eb0| 65 0a 61 6e 79 20 77 61 | 72 6e 69 6e 67 2c 20 61 |e.any wa|rning, a|
|00001ec0| 6e 64 20 77 65 20 73 65 | 65 20 74 68 65 20 62 65 |nd we se|e the be|
|00001ed0| 67 69 6e 6e 69 6e 67 20 | 6f 66 20 77 68 61 74 27 |ginning |of what'|
|00001ee0| 73 20 61 66 74 65 72 20 | 74 68 65 20 64 65 63 69 |s after |the deci|
|00001ef0| 6d 61 6c 20 70 6f 69 6e | 74 2e 20 57 65 20 61 6c |mal poin|t. We al|
|00001f00| 73 6f 0a 73 65 65 20 74 | 68 61 74 20 61 74 20 32 |so.see t|hat at 2|
|00001f10| 38 20 64 65 63 69 6d 61 | 6c 73 20 74 68 65 20 6c |8 decima|ls the l|
|00001f20| 61 73 74 20 36 20 64 69 | 67 69 74 73 20 77 65 72 |ast 6 di|gits wer|
|00001f30| 65 20 77 72 6f 6e 67 2e | 0a 5c 73 6d 61 6c 6c 73 |e wrong.|.\smalls|
|00001f40| 6b 69 70 0a 35 29 20 54 | 68 65 72 65 20 69 73 20 |kip.5) T|here is |
|00001f50| 73 74 69 6c 6c 20 61 6e | 6f 74 68 65 72 20 6d 65 |still an|other me|
|00001f60| 74 68 6f 64 20 74 6f 20 | 61 76 6f 69 64 20 74 68 |thod to |avoid th|
|00001f70| 65 20 77 61 72 6e 69 6e | 67 3a 20 70 75 74 20 79 |e warnin|g: put y|
|00001f80| 6f 75 72 73 65 6c 66 20 | 62 61 63 6b 20 69 6e 74 |ourself |back int|
|00001f90| 6f 0a 70 72 65 63 69 73 | 69 6f 6e 20 32 38 2e 20 |o.precis|ion 28. |
|00001fa0| 4e 6f 77 20 74 79 70 65 | 20 7b 5c 74 74 20 5c 62 |Now type| {\tt \b|
|00001fb0| 73 20 66 6f 72 6d 61 74 | 3d 65 30 2e 32 38 7d 2e |s format|=e0.28}.|
|00001fc0| 20 54 68 65 20 24 65 24 | 20 69 6e 73 74 65 61 64 | The $e$| instead|
|00001fd0| 20 6f 66 20 74 68 65 20 | 24 67 24 0a 77 68 69 63 | of the |$g$.whic|
|00001fe0| 68 20 69 73 20 70 72 69 | 6e 74 65 64 20 77 68 65 |h is pri|nted whe|
|00001ff0| 6e 20 47 50 20 67 72 65 | 65 74 73 20 79 6f 75 2c |n GP gre|ets you,|
|00002000| 20 6d 65 61 6e 73 20 74 | 68 61 74 20 72 65 61 6c | means t|hat real|
|00002010| 20 6e 75 6d 62 65 72 73 | 20 28 62 79 20 6f 70 70 | numbers| (by opp|
|00002020| 6f 73 69 74 69 6f 6e 20 | 74 6f 0a 69 6e 74 65 67 |osition |to.integ|
|00002030| 65 72 73 20 6f 72 20 72 | 61 74 69 6f 6e 61 6c 20 |ers or r|ational |
|00002040| 6e 75 6d 62 65 72 73 29 | 20 77 69 6c 6c 20 62 65 |numbers)| will be|
|00002050| 20 70 72 69 6e 74 65 64 | 20 69 6e 20 7b 5c 73 6c | printed| in {\sl|
|00002060| 20 65 78 70 6f 6e 65 6e | 74 69 61 6c 5c 2f 7d 20 | exponen|tial\/} |
|00002070| 66 6f 72 6d 61 74 2c 20 | 69 2e 65 2e 0a 77 69 74 |format, |i.e..wit|
|00002080| 68 20 61 20 45 20 78 78 | 78 20 64 65 6e 6f 74 69 |h a E xx|x denoti|
|00002090| 6e 67 20 70 6f 77 65 72 | 73 20 6f 66 20 31 30 2e |ng power|s of 10.|
|000020a0| 20 54 72 79 20 61 67 61 | 69 6e 20 7b 5c 74 74 20 | Try aga|in {\tt |
|000020b0| 65 78 70 28 32 34 2a 70 | 69 29 7d 20 69 6e 20 70 |exp(24*p|i)} in p|
|000020c0| 72 65 63 69 73 69 6f 6e | 20 32 38 2e 0a 4e 6f 77 |recision| 28..Now|
|000020d0| 20 77 65 20 64 6f 6e 27 | 74 20 68 61 76 65 20 61 | we don'|t have a|
|000020e0| 6e 79 20 77 61 72 6e 69 | 6e 67 2c 20 61 6e 64 20 |ny warni|ng, and |
|000020f0| 74 68 65 20 72 65 61 73 | 6f 6e 20 69 73 20 63 6c |the reas|on is cl|
|00002100| 65 61 72 3a 20 47 50 20 | 68 61 73 20 74 6f 20 70 |ear: GP |has to p|
|00002110| 72 69 6e 74 20 6f 6e 6c | 79 20 61 0a 73 69 6e 67 |rint onl|y a.sing|
|00002120| 6c 65 20 64 69 67 69 74 | 20 66 6f 72 20 74 68 65 |le digit| for the|
|00002130| 20 69 6e 74 65 67 65 72 | 20 70 61 72 74 2c 20 61 | integer| part, a|
|00002140| 6e 64 20 74 68 65 6e 20 | 69 74 20 70 72 69 6e 74 |nd then |it print|
|00002150| 73 20 6f 75 74 20 61 73 | 20 6d 61 6e 79 20 64 65 |s out as| many de|
|00002160| 63 69 6d 61 6c 73 20 61 | 73 0a 77 61 73 20 61 73 |cimals a|s.was as|
|00002170| 6b 65 64 20 62 79 20 74 | 68 65 20 66 6f 72 6d 61 |ked by t|he forma|
|00002180| 74 20 28 68 65 72 65 20 | 32 38 29 2e 0a 5c 73 6d |t (here |28)..\sm|
|00002190| 61 6c 6c 73 6b 69 70 0a | 36 29 20 7b 5c 73 6c 20 |allskip.|6) {\sl |
|000021a0| 57 61 72 6e 69 6e 67 5c | 2f 7d 2e 20 54 72 79 20 |Warning\|/}. Try |
|000021b0| 74 68 65 20 66 6f 6c 6c | 6f 77 69 6e 67 3a 20 73 |the foll|owing: s|
|000021c0| 74 61 72 74 69 6e 67 20 | 69 6e 20 70 72 65 63 69 |tarting |in preci|
|000021d0| 73 69 6f 6e 20 32 38 2c | 20 74 79 70 65 20 0a 73 |sion 28,| type .s|
|000021e0| 75 63 63 65 73 73 69 76 | 65 6c 79 20 7b 5c 74 74 |uccessiv|ely {\tt|
|000021f0| 20 5c 62 73 20 66 6f 72 | 6d 61 74 3d 65 30 2e 35 | \bs for|mat=e0.5|
|00002200| 30 7d 2c 20 74 68 65 6e | 20 7b 5c 74 74 20 65 78 |0}, then| {\tt ex|
|00002210| 70 28 32 34 2a 70 69 29 | 7d 2e 20 44 6f 20 79 6f |p(24*pi)|}. Do yo|
|00002220| 75 0a 75 6e 64 65 72 73 | 74 61 6e 64 20 77 68 79 |u.unders|tand why|
|00002230| 20 74 68 65 20 72 65 73 | 75 6c 74 20 69 73 20 73 | the res|ult is s|
|00002240| 6f 20 62 61 64 2c 20 61 | 6e 64 20 77 68 79 20 74 |o bad, a|nd why t|
|00002250| 68 65 72 65 20 61 72 65 | 20 6c 6f 74 73 20 6f 66 |here are| lots of|
|00002260| 20 7a 65 72 6f 73 20 61 | 74 20 74 68 65 20 65 6e | zeros a|t the en|
|00002270| 64 3f 0a 43 6f 6e 76 69 | 6e 63 65 20 79 6f 75 72 |d?.Convi|nce your|
|00002280| 73 65 6c 66 20 62 79 20 | 74 79 70 69 6e 67 20 7b |self by |typing {|
|00002290| 5c 74 74 20 6c 6f 67 28 | 65 78 70 28 31 29 29 7d |\tt log(|exp(1))}|
|000022a0| 2e 20 54 68 65 20 6d 6f | 72 61 6c 20 69 73 20 74 |. The mo|ral is t|
|000022b0| 68 61 74 20 74 68 65 20 | 7b 5c 74 74 20 66 6f 72 |hat the |{\tt for|
|000022c0| 6d 61 74 7d 0a 63 6f 6d | 6d 61 6e 64 20 63 68 61 |mat}.com|mand cha|
|000022d0| 6e 67 65 73 20 6f 6e 6c | 79 20 74 68 65 20 6f 75 |nges onl|y the ou|
|000022e0| 74 70 75 74 20 66 6f 72 | 6d 61 74 2c 20 62 75 74 |tput for|mat, but|
|000022f0| 20 7b 5c 73 6c 20 6e 6f | 74 5c 2f 7d 20 74 68 65 | {\sl no|t\/} the|
|00002300| 20 64 65 66 61 75 6c 74 | 20 70 72 65 63 69 73 69 | default| precisi|
|00002310| 6f 6e 2e 0a 4f 6e 20 74 | 68 65 20 6f 74 68 65 72 |on..On t|he other|
|00002320| 20 68 61 6e 64 2c 20 74 | 68 65 20 7b 5c 74 74 20 | hand, t|he {\tt |
|00002330| 70 72 65 63 69 73 69 6f | 6e 7d 20 63 6f 6d 6d 61 |precisio|n} comma|
|00002340| 6e 64 20 63 68 61 6e 67 | 65 73 20 62 6f 74 68 20 |nd chang|es both |
|00002350| 74 68 65 20 70 72 65 63 | 69 73 69 6f 6e 20 61 6e |the prec|ision an|
|00002360| 64 0a 74 68 65 20 6f 75 | 74 70 75 74 20 66 6f 72 |d.the ou|tput for|
|00002370| 6d 61 74 2e 0a 0a 5c 73 | 65 63 74 69 6f 6e 7b 57 |mat...\s|ection{W|
|00002380| 61 72 6d 69 6e 67 20 75 | 70 7d 0a 0a 41 6e 6f 74 |arming u|p}..Anot|
|00002390| 68 65 72 20 74 68 69 6e | 67 20 79 6f 75 20 62 65 |her thin|g you be|
|000023a0| 74 74 65 72 20 67 65 74 | 20 75 73 65 64 20 74 6f |tter get| used to|
|000023b0| 20 70 72 65 74 74 79 20 | 66 61 73 74 20 69 73 20 | pretty |fast is |
|000023c0| 65 72 72 6f 72 20 6d 65 | 73 73 61 67 65 73 2e 20 |error me|ssages. |
|000023d0| 54 72 79 20 74 79 70 69 | 6e 67 0a 24 31 2f 30 24 |Try typi|ng.$1/0$|
|000023e0| 2e 20 43 6f 75 6c 64 27 | 6e 74 20 62 65 20 63 6c |. Could'|nt be cl|
|000023f0| 65 61 72 65 72 2e 20 54 | 61 6b 69 6e 67 20 61 67 |earer. T|aking ag|
|00002400| 61 69 6e 20 6f 75 72 20 | 75 6e 69 76 65 72 73 61 |ain our |universa|
|00002410| 6c 20 65 78 61 6d 70 6c | 65 20 69 6e 20 70 72 65 |l exampl|e in pre|
|00002420| 63 69 73 69 6f 6e 20 32 | 38 2c 0a 74 79 70 65 20 |cision 2|8,.type |
|00002430| 7b 5c 74 74 20 66 6c 6f | 6f 72 28 65 78 70 28 32 |{\tt flo|or(exp(2|
|00002440| 34 2a 70 69 29 29 7d 20 | 28 7b 5c 74 74 20 66 6c |4*pi))} |({\tt fl|
|00002450| 6f 6f 72 7d 20 69 73 20 | 74 68 65 20 6d 61 74 68 |oor} is |the math|
|00002460| 65 6d 61 74 69 63 69 61 | 6e 73 27 20 69 6e 74 65 |ematicia|ns' inte|
|00002470| 67 65 72 20 70 61 72 74 | 2c 20 6e 6f 74 0a 74 6f |ger part|, not.to|
|00002480| 20 62 65 20 63 6f 6e 66 | 75 73 65 64 20 77 69 74 | be conf|used wit|
|00002490| 68 20 7b 5c 74 74 20 74 | 72 75 6e 63 7d 2c 20 77 |h {\tt t|runc}, w|
|000024a0| 68 69 63 68 20 69 73 20 | 74 68 65 20 63 6f 6d 70 |hich is |the comp|
|000024b0| 75 74 65 72 20 73 63 69 | 65 6e 74 69 73 74 73 27 |uter sci|entists'|
|000024c0| 3a 20 0a 7b 5c 74 74 20 | 66 6c 6f 6f 72 24 28 2d |: .{\tt |floor$(-|
|000024d0| 33 2e 34 29 24 7d 20 69 | 73 20 65 71 75 61 6c 20 |3.4)$} i|s equal |
|000024e0| 74 6f 20 24 2d 34 24 20 | 77 68 69 6c 65 20 7b 5c |to $-4$ |while {\|
|000024f0| 74 74 20 74 72 75 6e 63 | 24 28 2d 33 2e 34 29 24 |tt trunc|$(-3.4)$|
|00002500| 7d 20 69 73 20 65 71 75 | 61 6c 20 74 6f 20 24 2d |} is equ|al to $-|
|00002510| 33 24 29 2e 0a 59 6f 75 | 20 67 65 74 20 61 20 6d |3$)..You| get a m|
|00002520| 6f 72 65 20 63 72 79 70 | 74 69 63 20 65 72 72 6f |ore cryp|tic erro|
|00002530| 72 20 6d 65 73 73 61 67 | 65 2c 20 77 68 69 63 68 |r messag|e, which|
|00002540| 20 79 6f 75 20 77 6f 75 | 6c 64 20 69 6d 6d 65 64 | you wou|ld immed|
|00002550| 69 61 74 65 6c 79 20 75 | 6e 64 65 72 73 74 61 6e |iately u|nderstan|
|00002560| 64 20 69 66 20 79 6f 75 | 0a 68 61 64 20 72 65 61 |d if you|.had rea|
|00002570| 64 20 74 68 65 20 61 64 | 64 69 74 69 6f 6e 61 6c |d the ad|ditional|
|00002580| 20 63 6f 6d 6d 65 6e 74 | 73 20 6f 66 20 74 68 65 | comment|s of the|
|00002590| 20 70 72 65 63 65 64 69 | 6e 67 20 73 65 63 74 69 | precedi|ng secti|
|000025a0| 6f 6e 2e 20 53 69 6e 63 | 65 20 49 20 74 6f 6c 64 |on. Sinc|e I told|
|000025b0| 20 79 6f 75 20 6e 6f 74 | 0a 74 6f 20 72 65 61 64 | you not|.to read|
|000025c0| 20 74 68 65 6d 2c 20 74 | 68 65 20 65 78 70 6c 61 | them, t|he expla|
|000025d0| 6e 61 6e 61 74 69 6f 6e | 20 69 73 20 73 69 6d 70 |nanation| is simp|
|000025e0| 6c 79 20 74 68 61 74 20 | 47 50 20 69 73 20 75 6e |ly that |GP is un|
|000025f0| 61 62 6c 65 20 74 6f 20 | 63 6f 6d 70 75 74 65 20 |able to |compute |
|00002600| 74 68 65 20 69 6e 74 65 | 67 65 72 0a 70 61 72 74 |the inte|ger.part|
|00002610| 20 6f 66 20 7b 5c 74 74 | 20 65 78 70 28 32 34 2a | of {\tt| exp(24*|
|00002620| 70 69 29 7d 20 67 69 76 | 65 6e 20 6f 6e 6c 79 20 |pi)} giv|en only |
|00002630| 32 38 20 64 65 63 69 6d | 61 6c 73 20 6f 66 20 61 |28 decim|als of a|
|00002640| 63 63 75 72 61 63 79 2c | 20 73 69 6e 63 65 20 69 |ccuracy,| since i|
|00002650| 74 20 68 61 73 20 33 33 | 20 64 69 67 69 74 73 2e |t has 33| digits.|
|00002660| 0a 0a 53 6f 6d 65 20 65 | 72 72 6f 72 20 6d 65 73 |..Some e|rror mes|
|00002670| 73 61 67 65 73 20 61 72 | 65 20 65 76 65 6e 20 6d |sages ar|e even m|
|00002680| 75 63 68 20 6d 6f 72 65 | 20 63 72 79 70 74 69 63 |uch more| cryptic|
|00002690| 20 74 68 61 6e 20 74 68 | 61 74 20 61 6e 64 20 61 | than th|at and a|
|000026a0| 72 65 20 73 6f 6d 65 74 | 69 6d 65 73 20 6e 6f 74 |re somet|imes not|
|000026b0| 20 73 6f 0a 65 61 73 79 | 20 74 6f 20 75 6e 64 65 | so.easy| to unde|
|000026c0| 72 73 74 61 6e 64 20 28 | 77 65 6c 6c 2c 20 69 74 |rstand (|well, it|
|000026d0| 27 73 20 6e 6f 74 68 69 | 6e 67 20 63 6f 6d 70 61 |'s nothi|ng compa|
|000026e0| 72 65 64 20 74 6f 20 5c | 54 65 58 27 73 20 65 72 |red to \|TeX's er|
|000026f0| 72 6f 72 20 6d 65 73 73 | 61 67 65 73 21 20 3a 2d |ror mess|ages! :-|
|00002700| 29 2e 0a 0a 46 6f 72 20 | 69 6e 73 74 61 6e 63 65 |)...For |instance|
|00002710| 2c 20 74 72 79 20 7b 5c | 74 74 20 6c 6f 67 28 78 |, try {\|tt log(x|
|00002720| 29 7d 2e 20 4e 6f 74 20 | 72 65 61 6c 6c 79 20 63 |)}. Not |really c|
|00002730| 6c 65 61 72 2c 20 69 73 | 20 69 74 3f 20 42 75 74 |lear, is| it? But|
|00002740| 20 6e 6f 20 6d 61 74 74 | 65 72 2c 20 69 74 20 73 | no matt|er, it s|
|00002750| 69 6d 70 6c 79 0a 74 65 | 6c 6c 73 20 79 6f 75 20 |imply.te|lls you |
|00002760| 74 68 61 74 20 47 50 20 | 73 69 6d 70 6c 79 20 64 |that GP |simply d|
|00002770| 6f 65 73 20 6e 6f 74 20 | 75 6e 64 65 72 73 74 61 |oes not |understa|
|00002780| 6e 64 20 77 68 61 74 20 | 7b 5c 74 74 20 6c 6f 67 |nd what |{\tt log|
|00002790| 28 78 29 7d 20 69 73 20 | 28 61 6c 74 68 6f 75 67 |(x)} is |(althoug|
|000027a0| 68 20 69 74 0a 64 6f 65 | 73 20 6b 6e 6f 77 20 74 |h it.doe|s know t|
|000027b0| 68 65 20 7b 5c 74 74 20 | 6c 6f 67 7d 20 66 75 6e |he {\tt |log} fun|
|000027c0| 63 74 69 6f 6e 29 2e 0a | 0a 4e 6f 77 20 6c 65 74 |ction)..|.Now let|
|000027d0| 27 73 20 74 72 79 20 7b | 5c 74 74 20 73 71 72 74 |'s try {|\tt sqrt|
|000027e0| 28 2d 31 29 7d 20 74 6f | 20 73 65 65 20 77 68 61 |(-1)} to| see wha|
|000027f0| 74 20 65 72 72 6f 72 20 | 6d 65 73 73 61 67 65 20 |t error |message |
|00002800| 77 65 20 67 65 74 20 6e | 6f 77 2e 20 48 61 68 61 |we get n|ow. Haha|
|00002810| 21 20 47 50 20 65 76 65 | 6e 0a 6b 6e 6f 77 73 20 |! GP eve|n.knows |
|00002820| 61 62 6f 75 74 20 63 6f | 6d 70 6c 65 78 20 6e 75 |about co|mplex nu|
|00002830| 6d 62 65 72 73 2c 20 73 | 6f 20 69 6d 70 6f 73 73 |mbers, s|o imposs|
|00002840| 69 62 6c 65 20 74 6f 20 | 74 72 69 63 6b 20 69 74 |ible to |trick it|
|00002850| 20 74 68 61 74 20 77 61 | 79 2e 20 53 69 6d 69 6c | that wa|y. Simil|
|00002860| 61 72 6c 79 2c 20 74 72 | 79 0a 74 79 70 69 6e 67 |arly, tr|y.typing|
|00002870| 20 7b 5c 74 74 20 6c 6f | 67 28 2d 32 29 7d 2c 20 | {\tt lo|g(-2)}, |
|00002880| 7b 5c 74 74 20 65 78 70 | 28 69 2a 70 69 29 7d 2c |{\tt exp|(i*pi)},|
|00002890| 20 7b 5c 74 74 20 69 5c | 5e 7b 7d 69 7d 2c 5c 64 | {\tt i\|^{}i},\d|
|000028a0| 6f 74 73 2e 20 53 6f 20 | 77 65 20 68 61 76 65 20 |ots. So |we have |
|000028b0| 61 20 6c 6f 74 20 6f 66 | 20 72 65 61 6c 20 61 6e |a lot of| real an|
|000028c0| 64 20 63 6f 6d 70 6c 65 | 78 0a 61 6e 61 6c 79 73 |d comple|x.analys|
|000028d0| 69 73 20 61 74 20 6f 75 | 72 20 64 69 73 70 6f 73 |is at ou|r dispos|
|000028e0| 61 6c 20 28 6e 6f 74 65 | 20 74 68 61 74 20 74 68 |al (note| that th|
|000028f0| 65 72 65 20 69 73 20 61 | 6c 77 61 79 73 20 61 20 |ere is a|lways a |
|00002900| 73 70 65 63 69 66 69 63 | 20 62 72 61 6e 63 68 20 |specific| branch |
|00002910| 6f 66 0a 6d 75 6c 74 69 | 76 61 6c 75 65 64 20 63 |of.multi|valued c|
|00002920| 6f 6d 70 6c 65 78 20 74 | 72 61 6e 73 63 65 6e 64 |omplex t|ranscend|
|00002930| 65 6e 74 61 6c 20 66 75 | 6e 63 74 69 6f 6e 73 20 |ental fu|nctions |
|00002940| 77 68 69 63 68 20 69 73 | 20 74 61 6b 65 6e 2c 20 |which is| taken, |
|00002950| 73 70 65 63 69 66 69 65 | 64 20 69 6e 20 74 68 65 |specifie|d in the|
|00002960| 20 6d 61 6e 75 61 6c 29 | 2e 0a 0a 4a 75 73 74 20 | manual)|...Just |
|00002970| 66 6f 72 20 66 75 6e 2c | 20 6c 65 74 27 73 20 74 |for fun,| let's t|
|00002980| 72 79 20 7b 5c 74 74 20 | 36 2a 7a 65 74 61 28 32 |ry {\tt |6*zeta(2|
|00002990| 29 2f 70 69 5c 5e 7b 7d | 32 7d 2e 20 50 72 65 74 |)/pi\^{}|2}. Pret|
|000029a0| 74 79 20 67 6f 6f 64 3f | 20 28 49 66 20 79 6f 75 |ty good?| (If you|
|000029b0| 20 64 6f 6e 27 74 20 6b | 6e 6f 77 20 77 68 61 74 | don't k|now what|
|000029c0| 20 74 68 65 20 52 69 65 | 6d 61 6e 6e 0a 7a 65 74 | the Rie|mann.zet|
|000029d0| 61 20 66 75 6e 63 74 69 | 6f 6e 20 69 73 20 64 6f |a functi|on is do|
|000029e0| 6e 27 74 20 77 6f 72 72 | 79 2c 20 77 65 20 77 6f |n't worr|y, we wo|
|000029f0| 6e 27 74 20 75 73 65 20 | 69 74 29 2e 0a 5c 6d 65 |n't use |it)..\me|
|00002a00| 64 73 6b 69 70 0a 4e 6f | 77 20 47 50 20 64 69 64 |dskip.No|w GP did|
|00002a10| 6e 27 74 20 73 65 65 6d | 20 74 6f 20 6b 6e 6f 77 |n't seem| to know|
|00002a20| 20 77 68 61 74 20 7b 5c | 74 74 20 6c 6f 67 28 78 | what {\|tt log(x|
|00002a30| 29 7d 20 77 61 73 2c 20 | 61 6c 74 68 6f 75 67 68 |)} was, |although|
|00002a40| 20 69 74 20 64 69 64 20 | 6b 6e 6f 77 20 68 6f 77 | it did |know how|
|00002a50| 20 74 6f 20 63 6f 6d 70 | 75 74 65 0a 6e 75 6d 65 | to comp|ute.nume|
|00002a60| 72 69 63 61 6c 20 76 61 | 6c 75 65 73 20 6f 66 20 |rical va|lues of |
|00002a70| 7b 5c 74 74 20 6c 6f 67 | 7d 2e 20 54 68 69 73 20 |{\tt log|}. This |
|00002a80| 69 73 20 61 6e 6e 6f 79 | 69 6e 67 2e 20 4d 61 79 |is annoy|ing. May|
|00002a90| 62 65 20 69 74 20 6b 6e | 6f 77 73 20 74 68 65 20 |be it kn|ows the |
|00002aa0| 65 78 70 6f 6e 65 6e 74 | 69 61 6c 0a 66 75 6e 63 |exponent|ial.func|
|00002ab0| 74 69 6f 6e 3f 20 4c 65 | 74 27 73 20 67 69 76 65 |tion? Le|t's give|
|00002ac0| 20 69 74 20 61 20 74 72 | 79 2e 20 54 79 70 65 20 | it a tr|y. Type |
|00002ad0| 7b 5c 74 74 20 65 78 70 | 28 78 29 7d 2e 20 57 68 |{\tt exp|(x)}. Wh|
|00002ae0| 61 74 27 73 20 74 68 69 | 73 3f 20 49 66 20 79 6f |at's thi|s? If yo|
|00002af0| 75 20 68 61 64 20 68 61 | 64 20 61 6e 79 20 65 78 |u had ha|d any ex|
|00002b00| 70 65 72 69 65 6e 63 65 | 0a 77 69 74 68 20 6f 74 |perience|.with ot|
|00002b10| 68 65 72 20 73 79 73 74 | 65 6d 73 2c 20 74 68 65 |her syst|ems, the|
|00002b20| 20 61 6e 73 77 65 72 20 | 73 68 6f 75 6c 64 20 68 | answer |should h|
|00002b30| 61 76 65 20 73 69 6d 70 | 6c 79 20 62 65 65 6e 20 |ave simp|ly been |
|00002b40| 7b 5c 74 74 20 65 78 70 | 28 78 29 7d 20 61 67 61 |{\tt exp|(x)} aga|
|00002b50| 69 6e 2e 20 42 75 74 20 | 68 65 72 65 20 74 68 65 |in. But |here the|
|00002b60| 0a 61 6e 73 77 65 72 20 | 69 73 20 74 68 65 20 54 |.answer |is the T|
|00002b70| 61 79 6c 6f 72 20 65 78 | 70 61 6e 73 69 6f 6e 20 |aylor ex|pansion |
|00002b80| 6f 66 20 74 68 65 20 66 | 75 6e 63 74 69 6f 6e 20 |of the f|unction |
|00002b90| 61 72 6f 75 6e 64 20 7b | 5c 74 74 20 78 3d 30 7d |around {|\tt x=0}|
|00002ba0| 2c 20 74 6f 20 31 36 20 | 74 65 72 6d 73 20 28 31 |, to 16 |terms (1|
|00002bb0| 36 20 69 73 20 74 68 65 | 0a 64 65 66 61 75 6c 74 |6 is the|.default|
|00002bc0| 20 7b 5c 74 74 20 73 65 | 72 69 65 73 6c 65 6e 67 | {\tt se|riesleng|
|00002bd0| 74 68 7d 2c 20 77 68 69 | 63 68 20 63 61 6e 20 62 |th}, whi|ch can b|
|00002be0| 65 20 63 68 61 6e 67 65 | 64 20 62 79 20 74 79 70 |e change|d by typ|
|00002bf0| 69 6e 67 20 7b 5c 74 74 | 20 5c 62 73 20 73 65 72 |ing {\tt| \bs ser|
|00002c00| 69 65 73 6c 65 6e 67 74 | 68 3d 6e 7d 2c 0a 77 68 |ieslengt|h=n},.wh|
|00002c10| 65 72 65 20 7b 5c 74 74 | 20 6e 7d 20 69 73 20 74 |ere {\tt| n} is t|
|00002c20| 68 65 20 6e 75 6d 62 65 | 72 20 6f 66 20 74 65 72 |he numbe|r of ter|
|00002c30| 6d 73 20 74 68 61 74 20 | 79 6f 75 20 77 61 6e 74 |ms that |you want|
|00002c40| 20 69 6e 20 79 6f 75 72 | 20 70 6f 77 65 72 20 73 | in your| power s|
|00002c50| 65 72 69 65 73 20 28 6e | 6f 74 65 20 74 68 65 20 |eries (n|ote the |
|00002c60| 7b 5c 74 74 20 4f 28 78 | 5c 5e 7b 7d 31 36 29 7d |{\tt O(x|\^{}16)}|
|00002c70| 0a 77 68 69 63 68 20 65 | 6e 64 73 20 74 68 65 20 |.which e|nds the |
|00002c80| 73 65 72 69 65 73 2c 20 | 61 6e 64 20 77 68 69 63 |series, |and whic|
|00002c90| 68 20 69 73 20 74 72 61 | 64 65 6d 61 72 6b 20 6f |h is tra|demark o|
|00002ca0| 66 20 74 68 69 73 20 74 | 79 70 65 20 6f 66 20 6f |f this t|ype of o|
|00002cb0| 62 6a 65 63 74 20 69 6e | 20 47 50 2e 20 49 74 20 |bject in| GP. It |
|00002cc0| 69 73 20 74 68 65 20 66 | 61 6d 69 6c 69 61 72 0a |is the f|amiliar.|
|00002cd0| 60 60 62 69 67 6f 68 27 | 27 20 6e 6f 74 61 74 69 |``bigoh'|' notati|
|00002ce0| 6f 6e 20 6f 66 20 61 6e | 61 6c 79 73 69 73 29 2e |on of an|alysis).|
|00002cf0| 0a 0a 59 6f 75 20 77 69 | 6c 6c 20 74 68 75 73 20 |..You wi|ll thus |
|00002d00| 61 75 74 6f 6d 61 74 69 | 63 61 6c 6c 79 20 67 65 |automati|cally ge|
|00002d10| 74 20 74 68 65 20 54 61 | 79 6c 6f 72 20 65 78 70 |t the Ta|ylor exp|
|00002d20| 61 6e 73 69 6f 6e 20 6f | 66 20 61 6e 79 20 66 75 |ansion o|f any fu|
|00002d30| 6e 63 74 69 6f 6e 20 74 | 68 61 74 20 63 61 6e 20 |nction t|hat can |
|00002d40| 62 65 20 65 78 70 61 6e | 64 65 64 0a 61 72 6f 75 |be expan|ded.arou|
|00002d50| 6e 64 20 7b 5c 74 74 20 | 78 3d 30 7d 2c 20 61 6e |nd {\tt |x=0}, an|
|00002d60| 64 20 69 6e 63 69 64 65 | 6e 74 61 6c 6c 79 20 74 |d incide|ntally t|
|00002d70| 68 69 73 20 65 78 70 6c | 61 69 6e 73 0a 77 68 79 |his expl|ains.why|
|00002d80| 20 77 65 20 77 65 72 65 | 6e 27 74 20 61 62 6c 65 | we were|n't able|
|00002d90| 20 74 6f 20 64 6f 20 61 | 6e 79 74 68 69 6e 67 20 | to do a|nything |
|00002da0| 77 69 74 68 20 7b 5c 74 | 74 20 6c 6f 67 28 78 29 |with {\t|t log(x)|
|00002db0| 7d 20 77 68 69 63 68 20 | 69 73 20 6e 6f 74 20 64 |} which |is not d|
|00002dc0| 65 66 69 6e 65 64 20 61 | 74 20 30 2e 20 42 79 20 |efined a|t 0. By |
|00002dd0| 69 66 20 77 65 20 74 72 | 79 0a 7b 5c 74 74 20 6c |if we tr|y.{\tt l|
|00002de0| 6f 67 28 31 2b 78 29 7d | 2c 20 74 68 65 6e 20 69 |og(1+x)}|, then i|
|00002df0| 74 20 77 6f 72 6b 73 2e | 20 42 75 74 20 77 68 61 |t works.| But wha|
|00002e00| 74 20 69 66 20 77 65 20 | 77 61 6e 74 65 64 20 74 |t if we |wanted t|
|00002e10| 68 65 20 65 78 70 61 6e | 73 69 6f 6e 20 61 72 6f |he expan|sion aro|
|00002e20| 75 6e 64 20 61 20 70 6f | 69 6e 74 20 64 69 66 66 |und a po|int diff|
|00002e30| 65 72 65 6e 74 0a 66 72 | 6f 6d 20 30 3f 20 57 65 |erent.fr|om 0? We|
|00002e40| 6c 6c 2c 20 79 6f 75 27 | 72 65 20 61 62 6c 65 20 |ll, you'|re able |
|00002e50| 74 6f 20 63 68 61 6e 67 | 65 20 7b 5c 74 74 20 78 |to chang|e {\tt x|
|00002e60| 7d 20 69 6e 74 6f 20 7b | 5c 74 74 20 78 2d 61 7d |} into {|\tt x-a}|
|00002e70| 2c 20 61 72 65 6e 27 74 | 20 79 6f 75 3f 20 53 6f |, aren't| you? So|
|00002e80| 20 66 6f 72 20 69 6e 73 | 74 61 6e 63 65 0a 79 6f | for ins|tance.yo|
|00002e90| 75 20 63 61 6e 20 74 79 | 70 65 20 7b 5c 74 74 20 |u can ty|pe {\tt |
|00002ea0| 6c 6f 67 28 78 2b 32 29 | 7d 20 74 6f 20 68 61 76 |log(x+2)|} to hav|
|00002eb0| 65 20 74 68 65 20 65 78 | 70 61 6e 73 69 6f 6e 20 |e the ex|pansion |
|00002ec0| 6f 66 20 7b 5c 74 74 20 | 6c 6f 67 7d 20 61 72 6f |of {\tt |log} aro|
|00002ed0| 75 6e 64 20 7b 5c 74 74 | 20 78 3d 32 7d 2e 20 0a |und {\tt| x=2}. .|
|00002ee0| 0a 41 73 20 65 78 65 72 | 63 69 73 65 73 2c 20 74 |.As exer|cises, t|
|00002ef0| 72 79 20 7b 5c 74 74 20 | 63 6f 73 28 78 29 7d 2c |ry {\tt |cos(x)},|
|00002f00| 20 7b 5c 74 74 20 63 6f | 73 28 78 29 5c 5e 7b 7d | {\tt co|s(x)\^{}|
|00002f10| 32 2b 73 69 6e 28 78 29 | 5c 5e 7b 7d 32 7d 2c 20 |2+sin(x)|\^{}2}, |
|00002f20| 7b 5c 74 74 20 65 78 70 | 28 63 6f 73 28 78 29 29 |{\tt exp|(cos(x))|
|00002f30| 7d 2c 0a 7b 5c 74 74 20 | 65 78 70 28 65 78 70 28 |},.{\tt |exp(exp(|
|00002f40| 78 29 2d 31 29 7d 2c 20 | 7b 5c 74 74 20 67 61 6d |x)-1)}, |{\tt gam|
|00002f50| 6d 61 28 31 2b 78 29 7d | 2c 20 77 69 74 68 20 64 |ma(1+x)}|, with d|
|00002f60| 69 66 66 65 72 65 6e 74 | 20 76 61 6c 75 65 73 20 |ifferent| values |
|00002f70| 6f 66 20 7b 5c 74 74 20 | 73 65 72 69 65 73 6c 65 |of {\tt |seriesle|
|00002f80| 6e 67 74 68 7d 20 69 66 | 20 79 6f 75 20 6c 69 6b |ngth} if| you lik|
|00002f90| 65 2e 0a 0a 4c 65 74 27 | 73 20 74 72 79 20 73 6f |e...Let'|s try so|
|00002fa0| 6d 65 74 68 69 6e 67 20 | 65 6c 73 65 3a 20 74 79 |mething |else: ty|
|00002fb0| 70 65 20 7b 5c 74 74 20 | 28 31 2b 78 29 5c 5e 7b |pe {\tt |(1+x)\^{|
|00002fc0| 7d 33 7d 2e 20 4e 6f 20 | 62 69 67 6f 68 20 68 65 |}3}. No |bigoh he|
|00002fd0| 72 65 2c 20 73 69 6e 63 | 65 20 74 68 65 20 72 65 |re, sinc|e the re|
|00002fe0| 73 75 6c 74 20 69 73 20 | 61 20 70 6f 6c 79 6e 6f |sult is |a polyno|
|00002ff0| 6d 69 61 6c 2e 0a 48 61 | 68 61 2c 20 62 75 74 20 |mial..Ha|ha, but |
|00003000| 49 20 68 61 76 65 20 6c | 65 61 72 6e 74 20 74 68 |I have l|earnt th|
|00003010| 61 74 20 69 66 20 79 6f | 75 20 64 6f 20 6e 6f 74 |at if yo|u do not|
|00003020| 20 74 61 6b 65 20 65 78 | 70 6f 6e 65 6e 74 73 20 | take ex|ponents |
|00003030| 77 68 69 63 68 20 61 72 | 65 20 69 6e 74 65 67 65 |which ar|e intege|
|00003040| 72 73 20 67 72 65 61 74 | 65 72 20 6f 72 20 65 71 |rs great|er or eq|
|00003050| 75 61 6c 0a 74 6f 20 30 | 2c 20 79 6f 75 20 6f 62 |ual.to 0|, you ob|
|00003060| 74 61 69 6e 20 61 20 70 | 6f 77 65 72 20 73 65 72 |tain a p|ower ser|
|00003070| 69 65 73 20 77 69 74 68 | 20 61 6e 20 69 6e 66 69 |ies with| an infi|
|00003080| 6e 69 74 65 20 6e 75 6d | 62 65 72 20 6f 66 20 6e |nite num|ber of n|
|00003090| 6f 6e 7a 65 72 6f 20 74 | 65 72 6d 73 2e 20 4c 65 |onzero t|erms. Le|
|000030a0| 74 27 73 20 74 72 79 2e | 0a 54 79 70 65 20 7b 5c |t's try.|.Type {\|
|000030b0| 74 74 20 28 31 2b 78 29 | 5c 5e 7b 7d 28 24 2d 33 |tt (1+x)|\^{}($-3|
|000030c0| 24 29 7d 20 28 74 68 65 | 20 70 61 72 65 6e 74 68 |$)} (the| parenth|
|000030d0| 65 73 65 73 20 61 72 6f | 75 6e 64 20 24 2d 33 24 |eses aro|und $-3$|
|000030e0| 20 61 72 65 20 6e 6f 74 | 20 6e 65 63 65 73 73 61 | are not| necessa|
|000030f0| 72 79 20 62 75 74 20 6d | 61 6b 65 20 74 68 69 6e |ry but m|ake thin|
|00003100| 67 73 20 0a 65 61 73 69 | 65 72 20 74 6f 20 72 65 |gs .easi|er to re|
|00003110| 61 64 29 2e 20 53 75 72 | 70 72 69 73 65 21 20 43 |ad). Sur|prise! C|
|00003120| 6f 6e 74 72 61 72 79 20 | 74 6f 20 77 68 61 74 20 |ontrary |to what |
|00003130| 77 65 20 65 78 70 65 63 | 74 65 64 2c 20 77 65 20 |we expec|ted, we |
|00003140| 64 6f 6e 27 74 20 67 65 | 74 20 61 20 70 6f 77 65 |don't ge|t a powe|
|00003150| 72 20 73 65 72 69 65 73 | 20 62 75 74 20 61 0a 72 |r series| but a.r|
|00003160| 61 74 69 6f 6e 61 6c 20 | 66 75 6e 63 74 69 6f 6e |ational |function|
|00003170| 2e 20 41 67 61 69 6e 20 | 74 68 69 73 20 69 73 20 |. Again |this is |
|00003180| 66 6f 72 20 74 68 65 20 | 73 61 6d 65 20 72 65 61 |for the |same rea|
|00003190| 73 6f 6e 20 74 68 61 74 | 20 24 31 2f 37 24 20 6a |son that| $1/7$ j|
|000031a0| 75 73 74 20 67 61 76 65 | 20 79 6f 75 20 24 31 2f |ust gave| you $1/|
|000031b0| 37 24 3a 20 74 68 65 20 | 72 65 73 75 6c 74 0a 62 |7$: the |result.b|
|000031c0| 65 69 6e 67 20 65 78 61 | 63 74 2c 20 50 41 52 49 |eing exa|ct, PARI|
|000031d0| 20 64 6f 65 73 6e 27 74 | 20 73 65 65 20 61 6e 79 | doesn't| see any|
|000031e0| 20 72 65 61 73 6f 6e 20 | 74 6f 20 6d 61 6b 65 20 | reason |to make |
|000031f0| 69 74 20 6e 6f 6e 65 78 | 61 63 74 2e 0a 0a 42 75 |it nonex|act...Bu|
|00003200| 74 20 49 20 73 74 69 6c | 6c 20 77 61 6e 74 20 74 |t I stil|l want t|
|00003210| 68 61 74 20 70 6f 77 65 | 72 20 73 65 72 69 65 73 |hat powe|r series|
|00003220| 2e 20 54 6f 20 6f 62 74 | 61 69 6e 20 69 74 2c 20 |. To obt|ain it, |
|00003230| 6a 75 73 74 20 64 6f 20 | 61 73 20 69 6e 20 74 68 |just do |as in th|
|00003240| 65 20 24 31 2f 37 24 20 | 65 78 61 6d 70 6c 65 3a |e $1/7$ |example:|
|00003250| 0a 74 79 70 65 20 7b 5c | 74 74 20 28 31 2b 78 29 |.type {\|tt (1+x)|
|00003260| 5c 5e 7b 7d 28 2d 33 29 | 2b 4f 28 78 5c 5e 7b 7d |\^{}(-3)|+O(x\^{}|
|00003270| 7b 31 36 7d 29 7d 2c 20 | 7b 5c 74 74 20 28 31 2b |{16})}, |{\tt (1+|
|00003280| 4f 28 78 5c 5e 7b 7d 7b | 31 36 7d 29 29 2a 28 31 |O(x\^{}{|16}))*(1|
|00003290| 2b 78 29 5c 5e 7b 7d 28 | 2d 33 29 7d 2c 0a 7b 5c |+x)\^{}(|-3)},.{\|
|000032a0| 74 74 20 28 31 2b 78 2b | 4f 28 78 5c 5e 7b 7d 7b |tt (1+x+|O(x\^{}{|
|000032b0| 31 36 7d 29 29 5c 5e 7b | 7d 28 2d 33 29 7d 2c 65 |16}))\^{|}(-3)},e|
|000032c0| 74 63 5c 64 6f 74 73 0a | 0a 4e 6f 77 20 74 72 79 |tc\dots.|.Now try|
|000032d0| 20 7b 5c 74 74 20 28 31 | 2b 78 29 5c 5e 7b 7d 28 | {\tt (1|+x)\^{}(|
|000032e0| 31 2f 32 29 7d 2e 20 4e | 6f 77 20 77 65 20 6f 62 |1/2)}. N|ow we ob|
|000032f0| 74 61 69 6e 20 61 20 70 | 6f 77 65 72 20 73 65 72 |tain a p|ower ser|
|00003300| 69 65 73 2c 20 73 69 6e | 63 65 20 74 68 65 20 72 |ies, sin|ce the r|
|00003310| 65 73 75 6c 74 20 69 73 | 20 61 6e 20 6f 62 6a 65 |esult is| an obje|
|00003320| 63 74 0a 77 68 69 63 68 | 20 50 41 52 49 20 64 6f |ct.which| PARI do|
|00003330| 65 73 20 6e 6f 74 20 6b | 6e 6f 77 20 68 6f 77 20 |es not k|now how |
|00003340| 74 6f 20 72 65 70 72 65 | 73 65 6e 74 20 65 78 61 |to repre|sent exa|
|00003350| 63 74 6c 79 20 28 77 65 | 20 63 6f 75 6c 64 20 74 |ctly (we| could t|
|00003360| 65 61 63 68 20 50 41 52 | 49 20 61 62 6f 75 74 20 |each PAR|I about |
|00003370| 61 6c 67 65 62 72 61 69 | 63 20 66 75 6e 63 74 69 |algebrai|c functi|
|00003380| 6f 6e 73 2c 0a 62 75 74 | 20 74 68 65 6e 20 74 61 |ons,.but| then ta|
|00003390| 6b 65 20 7b 5c 74 74 20 | 28 31 2b 78 29 5c 5e 7b |ke {\tt |(1+x)\^{|
|000033a0| 7d 70 69 7d 20 61 73 20 | 61 6e 6f 74 68 65 72 20 |}pi} as |another |
|000033b0| 65 78 61 6d 70 6c 65 29 | 2e 20 54 68 69 73 20 67 |example)|. This g|
|000033c0| 69 76 65 73 20 75 73 20 | 73 74 69 6c 6c 20 61 6e |ives us |still an|
|000033d0| 6f 74 68 65 72 20 73 6f | 6c 75 74 69 6f 6e 20 74 |other so|lution t|
|000033e0| 6f 0a 6f 75 72 20 70 72 | 65 63 65 64 69 6e 67 20 |o.our pr|eceding |
|000033f0| 65 78 65 72 63 69 73 65 | 3a 20 77 65 20 63 61 6e |exercise|: we can|
|00003400| 20 74 79 70 65 20 7b 5c | 74 74 20 28 31 2b 78 29 | type {\|tt (1+x)|
|00003410| 5c 5e 7b 7d 28 24 2d 33 | 2e 24 29 7d 2e 20 53 69 |\^{}($-3|.$)}. Si|
|00003420| 6e 63 65 20 24 2d 33 2e | 24 20 69 73 20 6e 6f 74 |nce $-3.|$ is not|
|00003430| 20 61 6e 20 65 78 61 63 | 74 0a 71 75 61 6e 74 69 | an exac|t.quanti|
|00003440| 74 79 2c 20 50 41 52 49 | 20 68 61 73 20 6e 6f 20 |ty, PARI| has no |
|00003450| 6d 65 61 6e 73 20 74 6f | 20 6b 6e 6f 77 20 74 68 |means to| know th|
|00003460| 61 74 20 77 65 20 61 72 | 65 20 64 65 61 6c 69 6e |at we ar|e dealin|
|00003470| 67 20 77 69 74 68 20 61 | 20 72 61 74 69 6f 6e 61 |g with a| rationa|
|00003480| 6c 20 66 75 6e 63 74 69 | 6f 6e 2c 20 61 6e 64 0a |l functi|on, and.|
|00003490| 77 69 6c 6c 20 69 6e 73 | 74 65 61 64 20 67 69 76 |will ins|tead giv|
|000034a0| 65 20 79 6f 75 20 74 68 | 65 20 70 6f 77 65 72 20 |e you th|e power |
|000034b0| 73 65 72 69 65 73 2e 0a | 0a 46 69 6e 61 6c 6c 79 |series..|.Finally|
|000034c0| 2c 20 69 66 20 79 6f 75 | 20 77 61 6e 74 20 74 6f |, if you| want to|
|000034d0| 20 62 65 20 72 65 61 6c | 6c 79 20 66 61 6e 63 79 | be real|ly fancy|
|000034e0| 2c 20 79 6f 75 20 63 61 | 6e 20 74 79 70 65 20 7b |, you ca|n type {|
|000034f0| 5c 74 74 20 74 61 79 6c | 6f 72 28 28 31 2b 78 29 |\tt tayl|or((1+x)|
|00003500| 5c 5e 7b 7d 28 24 2d 33 | 24 29 2c 78 29 7d 0a 28 |\^{}($-3|$),x)}.(|
|00003510| 6c 6f 6f 6b 20 61 74 20 | 74 68 65 20 65 6e 74 72 |look at |the entr|
|00003520| 79 20 66 6f 72 20 7b 5c | 74 74 20 74 61 79 6c 6f |y for {\|tt taylo|
|00003530| 72 7d 20 66 6f 72 20 74 | 68 65 20 64 65 73 63 72 |r} for t|he descr|
|00003540| 69 70 74 69 6f 6e 20 6f | 66 20 74 68 65 20 73 79 |iption o|f the sy|
|00003550| 6e 74 61 78 29 2c 20 62 | 75 74 20 74 68 69 73 20 |ntax), b|ut this |
|00003560| 69 73 20 69 6e 20 66 61 | 63 74 0a 61 6c 6d 6f 73 |is in fa|ct.almos|
|00003570| 74 20 6e 65 76 65 72 20 | 75 73 65 64 2e 0a 5c 73 |t never |used..\s|
|00003580| 6d 61 6c 6c 73 6b 69 70 | 0a 54 6f 20 73 75 6d 6d |mallskip|.To summ|
|00003590| 61 72 69 7a 65 2c 20 69 | 6e 20 74 68 69 73 20 73 |arize, i|n this s|
|000035a0| 65 63 74 69 6f 6e 20 77 | 65 20 68 61 76 65 20 73 |ection w|e have s|
|000035b0| 65 65 6e 20 74 68 61 74 | 20 69 6e 20 61 64 64 69 |een that| in addi|
|000035c0| 74 69 6f 6e 20 74 6f 20 | 69 6e 74 65 67 65 72 73 |tion to |integers|
|000035d0| 2c 0a 72 65 61 6c 20 6e | 75 6d 62 65 72 73 20 61 |,.real n|umbers a|
|000035e0| 6e 64 20 72 61 74 69 6f | 6e 61 6c 20 6e 75 6d 62 |nd ratio|nal numb|
|000035f0| 65 72 73 2c 20 50 41 52 | 49 20 63 61 6e 20 68 61 |ers, PAR|I can ha|
|00003600| 6e 64 6c 65 20 63 6f 6d | 70 6c 65 78 20 6e 75 6d |ndle com|plex num|
|00003610| 62 65 72 73 2c 0a 70 6f | 6c 79 6e 6f 6d 69 61 6c |bers,.po|lynomial|
|00003620| 73 2c 20 70 6f 77 65 72 | 20 73 65 72 69 65 73 2c |s, power| series,|
|00003630| 20 72 61 74 69 6f 6e 61 | 6c 20 66 75 6e 63 74 69 | rationa|l functi|
|00003640| 6f 6e 73 2e 20 41 20 6c | 61 72 67 65 20 6e 75 6d |ons. A l|arge num|
|00003650| 62 65 72 20 6f 66 20 66 | 75 6e 63 74 69 6f 6e 73 |ber of f|unctions|
|00003660| 20 0a 65 78 69 73 74 20 | 77 68 69 63 68 20 68 61 | .exist |which ha|
|00003670| 6e 64 6c 65 20 74 68 65 | 73 65 20 74 79 70 65 73 |ndle the|se types|
|00003680| 2c 20 62 75 74 20 69 6e | 20 74 68 69 73 20 74 75 |, but in| this tu|
|00003690| 74 6f 72 69 61 6c 20 77 | 65 20 77 69 6c 6c 20 6f |torial w|e will o|
|000036a0| 6e 6c 79 20 6c 6f 6f 6b | 20 61 74 0a 61 20 66 65 |nly look| at.a fe|
|000036b0| 77 2e 20 5c 6d 65 64 73 | 6b 69 70 0a 7b 5c 62 66 |w. \meds|kip.{\bf|
|000036c0| 20 41 64 64 69 74 69 6f | 6e 61 6c 20 63 6f 6d 6d | Additio|nal comm|
|000036d0| 65 6e 74 73 7d 0a 0a 41 | 73 20 62 65 66 6f 72 65 |ents}..A|s before|
|000036e0| 2c 20 79 6f 75 20 61 72 | 65 20 73 75 70 70 6f 73 |, you ar|e suppos|
|000036f0| 65 64 20 74 6f 20 73 6b | 69 70 20 74 68 69 73 20 |ed to sk|ip this |
|00003700| 61 74 20 66 69 72 73 74 | 2c 20 61 6e 64 20 63 6f |at first|, and co|
|00003710| 6d 65 20 62 61 63 6b 20 | 6c 61 74 65 72 2e 0a 5c |me back |later..\|
|00003720| 73 6d 61 6c 6c 73 6b 69 | 70 0a 31 29 20 41 20 63 |smallski|p.1) A c|
|00003730| 6f 6d 70 6c 65 78 20 6e | 75 6d 62 65 72 20 68 61 |omplex n|umber ha|
|00003740| 73 20 61 20 72 65 61 6c | 20 70 61 72 74 20 61 6e |s a real| part an|
|00003750| 64 20 61 6e 20 69 6d 61 | 67 69 6e 61 72 79 20 70 |d an ima|ginary p|
|00003760| 61 72 74 20 28 77 68 6f | 20 77 6f 75 6c 64 20 68 |art (who| would h|
|00003770| 61 76 65 20 67 75 65 73 | 73 65 64 3f 29 2e 0a 48 |ave gues|sed?)..H|
|00003780| 6f 77 65 76 65 72 2c 20 | 62 65 77 61 72 65 20 74 |owever, |beware t|
|00003790| 68 61 74 20 77 68 65 6e | 20 74 68 65 20 69 6d 61 |hat when| the ima|
|000037a0| 67 69 6e 61 72 79 20 70 | 61 72 74 20 69 73 20 74 |ginary p|art is t|
|000037b0| 68 65 20 65 78 61 63 74 | 20 69 6e 74 65 67 65 72 |he exact| integer|
|000037c0| 20 7a 65 72 6f 2c 20 69 | 74 20 69 73 20 6e 6f 74 | zero, i|t is not|
|000037d0| 20 70 72 69 6e 74 65 64 | 2c 0a 62 75 74 20 74 68 | printed|,.but th|
|000037e0| 65 20 63 6f 6d 70 6c 65 | 78 20 6e 75 6d 62 65 72 |e comple|x number|
|000037f0| 20 69 73 20 6e 6f 74 20 | 63 6f 6e 76 65 72 74 65 | is not |converte|
|00003800| 64 20 74 6f 20 61 20 72 | 65 61 6c 20 6e 75 6d 62 |d to a r|eal numb|
|00003810| 65 72 2e 20 48 65 6e 63 | 65 20 69 74 20 6d 61 79 |er. Henc|e it may|
|00003820| 20 7b 5c 73 6c 20 6c 6f | 6f 6b 5c 2f 7d 20 6c 69 | {\sl lo|ok\/} li|
|00003830| 6b 65 0a 61 20 72 65 61 | 6c 20 6e 75 6d 62 65 72 |ke.a rea|l number|
|00003840| 20 77 69 74 68 6f 75 74 | 20 62 65 69 6e 67 20 6f | without| being o|
|00003850| 6e 65 2c 20 61 6e 64 20 | 74 68 69 73 20 6d 61 79 |ne, and |this may|
|00003860| 20 63 61 75 73 65 20 73 | 6f 6d 65 20 63 6f 6e 66 | cause s|ome conf|
|00003870| 75 73 69 6f 6e 20 69 6e | 20 70 72 6f 67 72 61 6d |usion in| program|
|00003880| 73 20 77 68 69 63 68 20 | 65 78 70 65 63 74 0a 72 |s which |expect.r|
|00003890| 65 61 6c 20 6e 75 6d 62 | 65 72 73 2e 20 46 6f 72 |eal numb|ers. For|
|000038a0| 20 65 78 61 6d 70 6c 65 | 2c 20 74 79 70 65 20 7b | example|, type {|
|000038b0| 5c 74 74 20 33 2b 69 2d | 69 7d 2e 20 54 68 65 20 |\tt 3+i-|i}. The |
|000038c0| 61 6e 73 77 65 72 20 69 | 73 2c 20 61 73 20 65 78 |answer i|s, as ex|
|000038d0| 70 65 63 74 65 64 20 33 | 2e 20 42 75 74 20 69 74 |pected 3|. But it|
|000038e0| 20 69 73 20 73 74 69 6c | 6c 0a 61 20 63 6f 6d 70 | is stil|l.a comp|
|000038f0| 6c 65 78 20 6e 75 6d 62 | 65 72 2e 20 48 65 6e 63 |lex numb|er. Henc|
|00003900| 65 20 69 66 20 79 6f 75 | 20 74 68 65 6e 20 74 79 |e if you| then ty|
|00003910| 70 65 20 7b 5c 74 74 20 | 28 31 2b 78 29 5c 5e 7b |pe {\tt |(1+x)\^{|
|00003920| 7d 5c 25 7d 2c 20 69 6e | 73 74 65 61 64 20 6f 66 |}\%}, in|stead of|
|00003930| 20 67 65 74 74 69 6e 67 | 20 74 68 65 20 70 6f 6c | getting| the pol|
|00003940| 79 6e 6f 6d 69 61 6c 0a | 7b 5c 74 74 20 31 2b 33 |ynomial.|{\tt 1+3|
|00003950| 2a 78 2b 33 2a 78 5c 5e | 7b 7d 32 2b 78 5c 5e 7b |*x+3*x\^|{}2+x\^{|
|00003960| 7d 33 7d 20 61 73 20 65 | 78 70 65 63 74 65 64 2c |}3} as e|xpected,|
|00003970| 20 79 6f 75 20 6f 62 74 | 61 69 6e 20 61 20 70 6f | you obt|ain a po|
|00003980| 77 65 72 20 73 65 72 69 | 65 73 2e 20 57 6f 72 73 |wer seri|es. Wors|
|00003990| 65 2c 20 77 68 65 6e 20 | 79 6f 75 20 74 72 79 20 |e, when |you try |
|000039a0| 74 6f 0a 61 70 70 6c 79 | 20 61 6e 20 61 72 69 74 |to.apply| an arit|
|000039b0| 68 6d 65 74 69 63 20 66 | 75 6e 63 74 69 6f 6e 2c |hmetic f|unction,|
|000039c0| 20 73 61 79 20 74 68 65 | 20 45 75 6c 65 72 20 7b | say the| Euler {|
|000039d0| 5c 74 74 20 70 68 69 7d | 20 66 75 6e 63 74 69 6f |\tt phi}| functio|
|000039e0| 6e 2c 20 79 6f 75 20 67 | 65 74 20 74 68 65 20 65 |n, you g|et the e|
|000039f0| 72 72 6f 72 20 6d 65 73 | 73 61 67 65 0a 77 68 69 |rror mes|sage.whi|
|00003a00| 63 68 20 73 61 79 73 20 | 74 68 61 74 20 60 60 61 |ch says |that ``a|
|00003a10| 72 69 74 68 6d 65 74 69 | 63 20 66 75 6e 63 74 69 |rithmeti|c functi|
|00003a20| 6f 6e 73 20 77 61 6e 74 | 20 69 6e 74 65 67 65 72 |ons want| integer|
|00003a30| 20 61 72 67 75 6d 65 6e | 74 73 27 27 2c 20 77 68 | argumen|ts'', wh|
|00003a40| 69 63 68 20 79 6f 75 20 | 77 6f 75 6c 64 20 68 61 |ich you |would ha|
|00003a50| 76 65 0a 67 75 65 73 73 | 65 64 20 79 6f 75 72 73 |ve.guess|ed yours|
|00003a60| 65 6c 66 2c 20 62 75 74 | 20 74 68 65 20 6d 65 73 |elf, but| the mes|
|00003a70| 73 61 67 65 20 69 73 20 | 64 69 66 66 69 63 75 6c |sage is |difficul|
|00003a80| 74 20 74 6f 20 75 6e 64 | 65 72 73 74 61 6e 64 20 |t to und|erstand |
|00003a90| 73 69 6e 63 65 20 33 20 | 6c 6f 6f 6b 73 20 6c 69 |since 3 |looks li|
|00003aa0| 6b 65 20 61 20 67 65 6e | 75 69 6e 65 0a 69 6e 74 |ke a gen|uine.int|
|00003ab0| 65 67 65 72 21 21 21 20 | 28 50 6c 65 61 73 65 20 |eger!!! |(Please |
|00003ac0| 72 65 61 64 20 61 67 61 | 69 6e 20 69 66 20 74 68 |read aga|in if th|
|00003ad0| 69 73 20 69 73 20 6e 6f | 74 20 63 6c 65 61 72 2e |is is no|t clear.|
|00003ae0| 20 49 74 20 69 73 20 61 | 20 63 6f 6d 6d 6f 6e 20 | It is a| common |
|00003af0| 73 6f 75 72 63 65 20 6f | 66 20 69 6e 63 6f 6d 70 |source o|f incomp|
|00003b00| 72 65 68 65 6e 73 69 6f | 6e 29 2e 0a 0a 53 69 6d |rehensio|n)...Sim|
|00003b10| 69 6c 61 72 6c 79 2c 20 | 7b 5c 74 74 20 33 2b 78 |ilarly, |{\tt 3+x|
|00003b20| 2d 78 7d 20 69 73 20 6e | 6f 74 20 74 68 65 20 69 |-x} is n|ot the i|
|00003b30| 6e 74 65 67 65 72 20 33 | 20 62 75 74 20 74 68 65 |nteger 3| but the|
|00003b40| 20 63 6f 6e 73 74 61 6e | 74 20 70 6f 6c 79 6e 6f | constan|t polyno|
|00003b50| 6d 69 61 6c 20 65 71 75 | 61 6c 0a 74 6f 20 33 2e |mial equ|al.to 3.|
|00003b60| 0a 0a 49 66 20 79 6f 75 | 20 77 61 6e 74 20 74 68 |..If you| want th|
|00003b70| 65 20 66 69 6e 61 6c 20 | 65 78 70 72 65 73 73 69 |e final |expressi|
|00003b80| 6f 6e 20 74 6f 20 62 65 | 20 69 6e 20 74 68 65 20 |on to be| in the |
|00003b90| 73 69 6d 70 6c 65 73 74 | 20 66 6f 72 6d 20 70 6f |simplest| form po|
|00003ba0| 73 73 69 62 6c 65 20 28 | 66 6f 72 0a 65 78 61 6d |ssible (|for.exam|
|00003bb0| 70 6c 65 20 62 65 66 6f | 72 65 20 61 70 70 6c 79 |ple befo|re apply|
|00003bc0| 69 6e 67 20 61 6e 20 61 | 72 69 74 68 6d 65 74 69 |ing an a|rithmeti|
|00003bd0| 63 20 66 75 6e 63 74 69 | 6f 6e 2c 20 6f 72 20 73 |c functi|on, or s|
|00003be0| 69 6d 70 6c 79 20 62 65 | 63 61 75 73 65 20 74 68 |imply be|cause th|
|00003bf0| 69 6e 67 73 0a 77 69 6c | 6c 20 67 6f 20 66 61 73 |ings.wil|l go fas|
|00003c00| 74 65 72 20 61 66 74 65 | 72 77 61 72 64 73 29 2c |ter afte|rwards),|
|00003c10| 20 61 70 70 6c 79 20 74 | 68 65 20 66 75 6e 63 74 | apply t|he funct|
|00003c20| 69 6f 6e 20 7b 5c 74 74 | 20 73 69 6d 70 6c 69 66 |ion {\tt| simplif|
|00003c30| 79 7d 20 74 6f 20 74 68 | 65 20 0a 72 65 73 75 6c |y} to th|e .resul|
|00003c40| 74 2e 0a 0a 32 29 20 41 | 73 20 61 6c 72 65 61 64 |t...2) A|s alread|
|00003c50| 79 20 73 74 61 74 65 64 | 2c 20 70 6f 77 65 72 20 |y stated|, power |
|00003c60| 73 65 72 69 65 73 20 65 | 78 70 61 6e 73 69 6f 6e |series e|xpansion|
|00003c70| 73 20 61 72 65 20 61 6c | 77 61 79 73 20 69 6d 70 |s are al|ways imp|
|00003c80| 6c 69 63 69 74 6c 79 20 | 61 72 6f 75 6e 64 20 7b |licitly |around {|
|00003c90| 5c 74 74 20 78 3d 30 7d | 2e 20 49 66 20 79 6f 75 |\tt x=0}|. If you|
|00003ca0| 0a 77 61 6e 74 20 74 68 | 65 6d 20 61 72 6f 75 6e |.want th|em aroun|
|00003cb0| 64 20 7b 5c 74 74 20 78 | 3d 61 7d 2c 20 72 65 70 |d {\tt x|=a}, rep|
|00003cc0| 6c 61 63 65 20 7b 5c 74 | 74 20 78 7d 20 62 79 20 |lace {\t|t x} by |
|00003cd0| 7b 5c 74 74 20 7a 2b 61 | 7d 20 69 6e 20 74 68 65 |{\tt z+a|} in the|
|00003ce0| 20 66 75 6e 63 74 69 6f | 6e 20 74 68 61 74 20 79 | functio|n that y|
|00003cf0| 6f 75 20 77 61 6e 74 20 | 74 6f 0a 65 78 70 61 6e |ou want |to.expan|
|00003d00| 64 2e 20 46 6f 72 20 65 | 78 61 6d 70 6c 65 2c 20 |d. For e|xample, |
|00003d10| 74 6f 20 68 61 76 65 20 | 74 68 65 20 65 78 70 61 |to have |the expa|
|00003d20| 6e 73 69 6f 6e 20 6f 66 | 20 7b 5c 74 74 20 65 78 |nsion of| {\tt ex|
|00003d30| 70 28 78 29 7d 20 61 72 | 6f 75 6e 64 20 7b 5c 74 |p(x)} ar|ound {\t|
|00003d40| 74 20 78 3d 31 7d 2c 20 | 77 65 20 73 69 6d 70 6c |t x=1}, |we simpl|
|00003d50| 79 20 74 79 70 65 0a 7b | 5c 74 74 20 65 78 70 28 |y type.{|\tt exp(|
|00003d60| 7a 2b 31 29 7d 2c 20 77 | 68 65 72 65 20 7b 5c 74 |z+1)}, w|here {\t|
|00003d70| 74 20 7a 7d 20 73 74 61 | 6e 64 73 20 66 6f 72 20 |t z} sta|nds for |
|00003d80| 7b 5c 74 74 20 78 2d 61 | 7d 2e 20 46 6f 72 20 63 |{\tt x-a|}. For c|
|00003d90| 6f 6d 70 6c 69 63 61 74 | 65 64 20 66 75 6e 63 74 |omplicat|ed funct|
|00003da0| 69 6f 6e 73 2c 20 69 74 | 20 6d 61 79 20 62 65 0a |ions, it| may be.|
|00003db0| 73 69 6d 70 6c 65 72 20 | 74 6f 20 75 73 65 20 74 |simpler |to use t|
|00003dc0| 68 65 20 73 75 62 73 74 | 69 74 75 74 69 6f 6e 20 |he subst|itution |
|00003dd0| 66 75 6e 63 74 69 6f 6e | 20 7b 5c 74 74 20 73 75 |function| {\tt su|
|00003de0| 62 73 74 7d 2e 20 46 6f | 72 20 65 78 61 6d 70 6c |bst}. Fo|r exampl|
|00003df0| 65 2c 20 69 66 20 0a 7b | 5c 74 74 20 70 3d 31 2f |e, if .{|\tt p=1/|
|00003e00| 28 78 5c 5e 7b 7d 34 2b | 33 2a 78 5c 5e 7b 7d 33 |(x\^{}4+|3*x\^{}3|
|00003e10| 2b 35 2a 78 5c 5e 7b 7d | 32 2d 36 2a 78 2b 37 29 |+5*x\^{}|2-6*x+7)|
|00003e20| 7d 2c 20 79 6f 75 20 6d | 61 79 20 6e 6f 74 20 77 |}, you m|ay not w|
|00003e30| 61 6e 74 20 74 6f 20 72 | 65 74 79 70 65 20 74 68 |ant to r|etype th|
|00003e40| 69 73 2c 20 72 65 70 6c | 61 63 69 6e 67 20 7b 5c |is, repl|acing {\|
|00003e50| 74 74 20 78 7d 20 62 79 | 20 7b 5c 74 74 20 7a 2b |tt x} by| {\tt z+|
|00003e60| 61 7d 2c 0a 73 6f 20 79 | 6f 75 20 63 61 6e 20 77 |a},.so y|ou can w|
|00003e70| 72 69 74 65 20 7b 5c 74 | 74 20 73 75 62 73 74 28 |rite {\t|t subst(|
|00003e80| 70 2c 78 2c 7a 2b 61 29 | 7d 20 28 6c 6f 6f 6b 20 |p,x,z+a)|} (look |
|00003e90| 75 70 20 74 68 65 20 65 | 78 61 63 74 20 64 65 73 |up the e|xact des|
|00003ea0| 63 72 69 70 74 69 6f 6e | 20 6f 66 20 74 68 65 20 |cription| of the |
|00003eb0| 7b 5c 74 74 20 73 75 62 | 73 74 7d 20 66 75 6e 63 |{\tt sub|st} func|
|00003ec0| 74 69 6f 6e 29 2e 0a 0a | 4e 6f 77 20 74 72 79 20 |tion)...|Now try |
|00003ed0| 74 79 70 69 6e 67 20 7b | 5c 74 74 20 70 3d 31 2b |typing {|\tt p=1+|
|00003ee0| 78 2b 78 5c 5e 7b 7d 32 | 2b 4f 28 78 5c 5e 7b 7d |x+x\^{}2|+O(x\^{}|
|00003ef0| 31 30 29 7d 2c 20 74 68 | 65 6e 20 7b 5c 74 74 20 |10)}, th|en {\tt |
|00003f00| 73 75 62 73 74 28 70 2c | 78 2c 7a 2b 31 29 7d 2e |subst(p,|x,z+1)}.|
|00003f10| 20 44 6f 20 79 6f 75 20 | 0a 75 6e 64 65 72 73 74 | Do you |.underst|
|00003f20| 61 6e 64 20 77 68 79 20 | 79 6f 75 20 67 65 74 20 |and why |you get |
|00003f30| 61 6e 20 65 72 72 6f 72 | 20 6d 65 73 73 61 67 65 |an error| message|
|00003f40| 3f 0a 0a 5c 73 65 63 74 | 69 6f 6e 7b 54 68 65 20 |?..\sect|ion{The |
|00003f50| 72 65 73 74 20 6f 66 20 | 74 68 65 20 50 41 52 49 |rest of |the PARI|
|00003f60| 20 74 79 70 65 73 7d 0a | 0a 4c 65 74 27 73 20 68 | types}.|.Let's h|
|00003f70| 61 6e 64 6c 65 20 66 69 | 72 73 74 20 73 6f 6d 65 |andle fi|rst some|
|00003f80| 20 6d 6f 72 65 20 74 68 | 65 20 62 61 73 69 63 20 | more th|e basic |
|00003f90| 50 41 52 49 20 74 79 70 | 65 73 2e 0a 0a 54 79 70 |PARI typ|es...Typ|
|00003fa0| 65 20 7b 5c 74 74 20 70 | 3d 78 2a 65 78 70 28 2d |e {\tt p|=x*exp(-|
|00003fb0| 78 29 7d 2e 20 41 73 20 | 65 78 70 65 63 74 65 64 |x)}. As |expected|
|00003fc0| 2c 20 79 6f 75 20 67 65 | 74 20 74 68 65 20 70 6f |, you ge|t the po|
|00003fd0| 77 65 72 20 73 65 72 69 | 65 73 20 65 78 70 61 6e |wer seri|es expan|
|00003fe0| 73 69 6f 6e 0a 74 6f 20 | 31 36 20 74 65 72 6d 73 |sion.to |16 terms|
|00003ff0| 20 28 69 66 20 79 6f 75 | 20 68 61 76 65 20 6e 6f | (if you| have no|
|00004000| 74 20 63 68 61 6e 67 65 | 64 20 74 68 65 20 64 65 |t change|d the de|
|00004010| 66 61 75 6c 74 29 2e 20 | 4e 6f 77 20 74 79 70 65 |fault). |Now type|
|00004020| 0a 7b 5c 74 74 20 70 72 | 3d 72 65 76 65 72 73 65 |.{\tt pr|=reverse|
|00004030| 28 70 29 7d 2e 20 59 6f | 75 20 61 72 65 20 61 73 |(p)}. Yo|u are as|
|00004040| 6b 69 6e 67 20 68 65 72 | 65 20 66 6f 72 20 74 68 |king her|e for th|
|00004050| 65 20 7b 5c 73 6c 20 72 | 65 76 65 72 73 69 6f 6e |e {\sl r|eversion|
|00004060| 5c 2f 7d 20 6f 66 20 74 | 68 65 0a 70 6f 77 65 72 |\/} of t|he.power|
|00004070| 20 73 65 72 69 65 73 20 | 24 70 24 2c 20 69 6e 20 | series |$p$, in |
|00004080| 6f 74 68 65 72 20 77 6f | 72 64 73 20 74 68 65 20 |other wo|rds the |
|00004090| 69 6e 76 65 72 73 65 20 | 66 75 6e 63 74 69 6f 6e |inverse |function|
|000040a0| 2e 20 54 68 69 73 20 69 | 73 20 70 6f 73 73 69 62 |. This i|s possib|
|000040b0| 6c 65 20 6f 6e 6c 79 0a | 66 6f 72 20 70 6f 77 65 |le only.|for powe|
|000040c0| 72 20 73 65 72 69 65 73 | 20 77 68 6f 73 65 20 66 |r series| whose f|
|000040d0| 69 72 73 74 20 6e 6f 6e | 2d 7a 65 72 6f 20 63 6f |irst non|-zero co|
|000040e0| 65 66 66 69 63 69 65 6e | 74 20 69 73 20 74 68 61 |efficien|t is tha|
|000040f0| 74 20 6f 66 20 24 78 5e | 31 24 2e 0a 54 6f 20 63 |t of $x^|1$..To c|
|00004100| 68 65 63 6b 20 74 68 65 | 20 63 6f 72 72 65 63 74 |heck the| correct|
|00004110| 6e 65 73 73 20 6f 66 20 | 74 68 65 20 72 65 73 75 |ness of |the resu|
|00004120| 6c 74 2c 20 79 6f 75 20 | 63 61 6e 20 74 79 70 65 |lt, you |can type|
|00004130| 20 7b 5c 74 74 20 73 75 | 62 73 74 28 70 2c 78 2c | {\tt su|bst(p,x,|
|00004140| 70 72 29 7d 0a 6f 72 20 | 7b 5c 74 74 20 73 75 62 |pr)}.or |{\tt sub|
|00004150| 73 74 28 70 72 2c 78 2c | 70 29 7d 20 61 6e 64 20 |st(pr,x,|p)} and |
|00004160| 79 6f 75 20 73 68 6f 75 | 6c 64 20 67 65 74 20 62 |you shou|ld get b|
|00004170| 61 63 6b 20 7b 5c 74 74 | 20 78 2b 4f 28 78 5c 5e |ack {\tt| x+O(x\^|
|00004180| 7b 7d 31 37 29 7d 2e 0a | 0a 4e 6f 77 20 74 68 65 |{}17)}..|.Now the|
|00004190| 20 63 6f 65 66 66 69 63 | 69 65 6e 74 73 20 6f 66 | coeffic|ients of|
|000041a0| 20 7b 5c 74 74 20 70 72 | 7d 20 6f 62 65 79 20 61 | {\tt pr|} obey a|
|000041b0| 20 76 65 72 79 20 73 69 | 6d 70 6c 65 20 66 6f 72 | very si|mple for|
|000041c0| 6d 75 6c 61 2e 20 46 69 | 72 73 74 2c 20 77 65 20 |mula. Fi|rst, we |
|000041d0| 77 6f 75 6c 64 0a 6c 69 | 6b 65 20 74 6f 20 6d 75 |would.li|ke to mu|
|000041e0| 6c 74 69 70 6c 79 20 74 | 68 65 20 63 6f 65 66 66 |ltiply t|he coeff|
|000041f0| 69 63 69 65 6e 74 20 6f | 66 20 7b 5c 74 74 20 78 |icient o|f {\tt x|
|00004200| 5c 5e 7b 7d 6e 7d 20 62 | 79 20 7b 5c 74 74 20 6e |\^{}n} b|y {\tt n|
|00004210| 21 7d 20 28 69 6e 20 74 | 68 65 20 63 61 73 65 20 |!} (in t|he case |
|00004220| 6f 66 20 74 68 65 0a 65 | 78 70 6f 6e 65 6e 74 69 |of the.e|xponenti|
|00004230| 61 6c 20 66 75 6e 63 74 | 69 6f 6e 2c 20 74 68 69 |al funct|ion, thi|
|00004240| 73 20 77 6f 75 6c 64 20 | 73 69 6d 70 6c 69 66 79 |s would |simplify|
|00004250| 20 74 68 69 6e 67 73 20 | 63 6f 6e 73 69 64 65 72 | things |consider|
|00004260| 61 62 6c 79 21 29 2e 20 | 54 68 65 20 50 41 52 49 |ably!). |The PARI|
|00004270| 0a 66 75 6e 63 74 69 6f | 6e 20 7b 5c 74 74 20 6c |.functio|n {\tt l|
|00004280| 61 70 6c 61 63 65 7d 20 | 64 6f 65 73 20 6a 75 73 |aplace} |does jus|
|00004290| 74 20 74 68 61 74 2e 20 | 53 6f 20 74 79 70 65 20 |t that. |So type |
|000042a0| 7b 5c 74 74 20 70 73 3d | 6c 61 70 6c 61 63 65 28 |{\tt ps=|laplace(|
|000042b0| 70 72 29 7d 2e 20 54 68 | 65 0a 63 6f 65 66 66 69 |pr)}. Th|e.coeffi|
|000042c0| 63 69 65 6e 74 73 20 6e | 6f 77 20 62 65 63 6f 6d |cients n|ow becom|
|000042d0| 65 20 69 6e 74 65 67 65 | 72 73 2c 20 77 68 69 63 |e intege|rs, whic|
|000042e0| 68 20 63 61 6e 20 62 65 | 20 69 6d 6d 65 64 69 61 |h can be| immedia|
|000042f0| 74 65 6c 79 20 72 65 63 | 6f 67 6e 69 7a 65 64 20 |tely rec|ognized |
|00004300| 62 79 0a 69 6e 73 70 65 | 63 74 69 6f 6e 2e 20 54 |by.inspe|ction. T|
|00004310| 68 65 20 63 6f 65 66 66 | 69 63 69 65 6e 74 20 6f |he coeff|icient o|
|00004320| 66 20 7b 5c 74 74 20 78 | 5c 5e 7b 7d 6e 7d 20 69 |f {\tt x|\^{}n} i|
|00004330| 73 20 6e 6f 77 20 65 71 | 75 61 6c 20 74 6f 20 24 |s now eq|ual to $|
|00004340| 5c 74 65 78 74 7b 6e 7d | 5e 7b 5c 74 65 78 74 7b |\text{n}|^{\text{|
|00004350| 6e 2d 31 7d 7d 24 2e 20 | 49 6e 20 6f 74 68 65 72 |n-1}}$. |In other|
|00004360| 20 77 6f 72 64 73 2c 20 | 77 65 20 68 61 76 65 20 | words, |we have |
|00004370| 0a 5c 64 65 66 5c 6e 7b | 7b 5c 72 6d 20 6e 7d 7d |.\def\n{|{\rm n}}|
|00004380| 0a 24 24 5c 74 65 78 74 | 7b 70 72 7d 3d 5c 73 75 |.$$\text|{pr}=\su|
|00004390| 6d 5f 7b 5c 6e 5c 67 65 | 31 7d 5c 64 66 72 61 63 |m_{\n\ge|1}\dfrac|
|000043a0| 7b 5c 6e 5e 7b 5c 6e 2d | 31 7d 7d 7b 5c 6e 21 7d |{\n^{\n-|1}}{\n!}|
|000043b0| 58 5e 7b 5c 6e 7d 2e 24 | 24 44 6f 20 79 6f 75 20 |X^{\n}.$|$Do you |
|000043c0| 6b 6e 6f 77 20 68 6f 77 | 20 74 6f 0a 70 72 6f 76 |know how| to.prov|
|000043d0| 65 20 74 68 69 73 3f 20 | 28 49 66 20 79 6f 75 20 |e this? |(If you |
|000043e0| 68 61 76 65 20 6e 65 76 | 65 72 20 73 65 65 6e 20 |have nev|er seen |
|000043f0| 74 68 69 73 2c 20 74 68 | 65 20 70 72 6f 6f 66 20 |this, th|e proof |
|00004400| 69 73 20 64 69 66 66 69 | 63 75 6c 74 2e 29 0a 5c |is diffi|cult.).\|
|00004410| 73 6d 61 6c 6c 73 6b 69 | 70 0a 4f 66 20 63 6f 75 |smallski|p.Of cou|
|00004420| 72 73 65 20 50 41 52 49 | 20 6b 6e 6f 77 73 20 61 |rse PARI| knows a|
|00004430| 62 6f 75 74 20 76 65 63 | 74 6f 72 73 20 28 72 6f |bout vec|tors (ro|
|00004440| 77 73 20 61 6e 64 20 63 | 6f 6c 75 6d 6e 73 20 61 |ws and c|olumns a|
|00004450| 72 65 20 64 69 73 74 69 | 6e 67 75 69 73 68 65 64 |re disti|nguished|
|00004460| 2c 20 65 76 65 6e 0a 74 | 68 6f 75 67 68 20 6d 61 |, even.t|hough ma|
|00004470| 74 68 65 6d 61 74 69 63 | 61 6c 6c 79 20 74 68 65 |thematic|ally the|
|00004480| 72 65 20 69 73 20 6e 6f | 20 64 69 66 66 65 72 65 |re is no| differe|
|00004490| 6e 63 65 29 20 61 6e 64 | 20 6d 61 74 72 69 63 65 |nce) and| matrice|
|000044a0| 73 2e 20 54 79 70 65 20 | 66 6f 72 20 65 78 61 6d |s. Type |for exam|
|000044b0| 70 6c 65 0a 7b 5c 74 74 | 20 5b 31 2c 32 2c 33 2c |ple.{\tt| [1,2,3,|
|000044c0| 34 5d 7d 2e 20 54 68 69 | 73 20 67 69 76 65 73 20 |4]}. Thi|s gives |
|000044d0| 74 68 65 20 72 6f 77 20 | 76 65 63 74 6f 72 20 77 |the row |vector w|
|000044e0| 68 6f 73 65 20 63 6f 6f | 72 64 69 6e 61 74 65 73 |hose coo|rdinates|
|000044f0| 20 61 72 65 20 31 2c 20 | 32 2c 20 33 20 61 6e 64 | are 1, |2, 3 and|
|00004500| 20 34 2e 0a 49 66 20 79 | 6f 75 20 77 61 6e 74 20 | 4..If y|ou want |
|00004510| 61 20 63 6f 6c 75 6d 6e | 20 76 65 63 74 6f 72 2c |a column| vector,|
|00004520| 20 74 79 70 65 20 7b 5c | 74 74 20 5b 31 2c 32 2c | type {\|tt [1,2,|
|00004530| 33 2c 34 5d 5c 7e 7b 7d | 7d 2c 20 74 68 65 20 74 |3,4]\~{}|}, the t|
|00004540| 69 6c 64 65 20 6d 65 61 | 6e 69 6e 67 20 6f 66 0a |ilde mea|ning of.|
|00004550| 63 6f 75 72 73 65 20 74 | 72 61 6e 73 70 6f 73 65 |course t|ranspose|
|00004560| 2e 20 59 6f 75 20 64 6f | 6e 27 74 20 73 65 65 20 |. You do|n't see |
|00004570| 6d 75 63 68 20 64 69 66 | 66 65 72 65 6e 63 65 20 |much dif|ference |
|00004580| 69 6e 20 74 68 65 20 6f | 75 74 70 75 74 2c 20 65 |in the o|utput, e|
|00004590| 78 63 65 70 74 20 66 6f | 72 20 74 68 65 0a 74 69 |xcept fo|r the.ti|
|000045a0| 6c 64 65 20 61 74 20 74 | 68 65 20 65 6e 64 2e 20 |lde at t|he end. |
|000045b0| 48 6f 77 65 76 65 72 2c | 20 6e 6f 77 20 74 79 70 |However,| now typ|
|000045c0| 65 20 7b 5c 74 74 20 5c | 62 73 20 62 7d 3a 20 6c |e {\tt \|bs b}: l|
|000045d0| 6f 20 61 6e 64 20 62 65 | 68 6f 6c 64 2c 20 74 68 |o and be|hold, th|
|000045e0| 65 20 76 65 63 74 6f 72 | 0a 64 6f 65 73 20 62 65 |e vector|.does be|
|000045f0| 63 6f 6d 65 20 61 20 63 | 6f 6c 75 6d 6e 2e 20 54 |come a c|olumn. T|
|00004600| 68 69 73 20 63 6f 6d 6d | 61 6e 64 20 69 73 20 75 |his comm|and is u|
|00004610| 73 65 64 20 6d 61 69 6e | 6c 79 20 66 6f 72 20 74 |sed main|ly for t|
|00004620| 68 69 73 20 70 75 72 70 | 6f 73 65 2e 0a 0a 54 79 |his purp|ose...Ty|
|00004630| 70 65 20 7b 5c 74 74 20 | 6d 3d 5b 61 2c 62 2c 63 |pe {\tt |m=[a,b,c|
|00004640| 3b 64 2c 65 2c 66 5d 7d | 2e 20 59 6f 75 20 68 61 |;d,e,f]}|. You ha|
|00004650| 76 65 20 6a 75 73 74 20 | 65 6e 74 65 72 65 64 20 |ve just |entered |
|00004660| 61 20 6d 61 74 72 69 78 | 20 77 69 74 68 20 32 20 |a matrix| with 2 |
|00004670| 72 6f 77 73 20 61 6e 64 | 20 33 0a 63 6f 6c 75 6d |rows and| 3.colum|
|00004680| 6e 73 2e 20 4e 6f 74 65 | 20 74 68 61 74 20 74 68 |ns. Note| that th|
|00004690| 65 20 6d 61 74 72 69 78 | 20 69 73 20 65 6e 74 65 |e matrix| is ente|
|000046a0| 72 65 64 20 62 79 20 7b | 5c 73 6c 20 72 6f 77 73 |red by {|\sl rows|
|000046b0| 5c 2f 7d 20 61 6e 64 20 | 74 68 65 20 72 6f 77 73 |\/} and |the rows|
|000046c0| 20 61 72 65 0a 73 65 70 | 61 72 61 74 65 64 20 62 | are.sep|arated b|
|000046d0| 79 20 73 65 6d 69 63 6f | 6c 6f 6e 73 20 60 60 3b |y semico|lons ``;|
|000046e0| 27 27 2e 20 54 68 65 20 | 6d 61 74 72 69 78 20 69 |''. The |matrix i|
|000046f0| 73 20 70 72 69 6e 74 65 | 64 20 6e 61 74 75 72 61 |s printe|d natura|
|00004700| 6c 6c 79 20 69 6e 20 61 | 20 72 65 63 74 61 6e 67 |lly in a| rectang|
|00004710| 6c 65 0a 73 68 61 70 65 | 2e 20 49 66 20 79 6f 75 |le.shape|. If you|
|00004720| 20 77 61 6e 74 20 69 74 | 20 70 72 69 6e 74 65 64 | want it| printed|
|00004730| 20 68 6f 72 69 7a 6f 6e | 74 61 6c 6c 79 20 6a 75 | horizon|tally ju|
|00004740| 73 74 20 61 73 20 79 6f | 75 20 74 79 70 65 64 20 |st as yo|u typed |
|00004750| 69 74 2c 20 74 79 70 65 | 0a 7b 5c 74 74 20 5c 62 |it, type|.{\tt \b|
|00004760| 73 20 72 7d 2c 20 6f 72 | 20 69 66 20 79 6f 75 20 |s r}, or| if you |
|00004770| 77 61 6e 74 20 74 68 69 | 73 20 74 79 70 65 20 6f |want thi|s type o|
|00004780| 66 20 70 72 69 6e 74 69 | 6e 67 20 74 6f 20 62 65 |f printi|ng to be|
|00004790| 20 74 68 65 20 70 65 72 | 6d 61 6e 65 6e 74 20 64 | the per|manent d|
|000047a0| 65 66 61 75 6c 74 0a 74 | 79 70 65 20 7b 5c 74 74 |efault.t|ype {\tt|
|000047b0| 20 5c 62 73 20 70 7d 20 | 74 77 69 63 65 20 28 74 | \bs p} |twice (t|
|000047c0| 68 65 20 66 69 72 73 74 | 20 74 69 6d 65 20 70 75 |he first| time pu|
|000047d0| 74 73 20 47 50 20 69 6e | 20 61 20 6d 6f 64 65 20 |ts GP in| a mode |
|000047e0| 77 68 69 63 68 20 69 6e | 20 74 68 65 20 70 72 65 |which in| the pre|
|000047f0| 73 65 6e 74 0a 76 65 72 | 73 69 6f 6e 20 79 6f 75 |sent.ver|sion you|
|00004800| 20 64 6f 20 6e 6f 74 20 | 77 61 6e 74 20 74 6f 20 | do not |want to |
|00004810| 75 73 65 29 2e 20 54 79 | 70 65 20 7b 5c 74 74 20 |use). Ty|pe {\tt |
|00004820| 5c 62 73 20 70 7d 20 61 | 20 74 68 69 72 64 20 74 |\bs p} a| third t|
|00004830| 69 6d 65 20 69 66 20 79 | 6f 75 20 77 61 6e 74 0a |ime if y|ou want.|
|00004840| 74 6f 20 63 6f 6d 65 20 | 62 61 63 6b 20 74 6f 20 |to come |back to |
|00004850| 74 68 65 20 6f 72 69 67 | 69 6e 61 6c 20 64 65 66 |the orig|inal def|
|00004860| 61 75 6c 74 2e 0a 0a 4e | 6f 77 20 74 79 70 65 20 |ault...N|ow type |
|00004870| 7b 5c 74 74 20 6d 5b 31 | 2c 32 5d 7d 2c 20 7b 5c |{\tt m[1|,2]}, {\|
|00004880| 74 74 20 6d 5b 31 2c 5d | 7d 2c 20 7b 5c 74 74 20 |tt m[1,]|}, {\tt |
|00004890| 6d 5b 2c 32 5d 7d 2e 20 | 41 72 65 20 65 78 70 6c |m[,2]}. |Are expl|
|000048a0| 61 6e 61 74 69 6f 6e 73 | 20 6e 65 63 65 73 73 61 |anations| necessa|
|000048b0| 72 79 3f 0a 28 49 6e 20 | 61 6e 20 65 78 70 72 65 |ry?.(In |an expre|
|000048c0| 73 73 69 6f 6e 20 73 75 | 63 68 20 61 73 20 7b 5c |ssion su|ch as {\|
|000048d0| 74 74 20 6d 5b 6a 2c 6b | 5d 7d 2c 20 74 68 65 20 |tt m[j,k|]}, the |
|000048e0| 7b 5c 74 74 20 6a 7d 20 | 61 6c 77 61 79 73 20 72 |{\tt j} |always r|
|000048f0| 65 66 65 72 73 20 74 6f | 20 74 68 65 0a 72 6f 77 |efers to| the.row|
|00004900| 20 6e 75 6d 62 65 72 2c | 20 61 6e 64 20 74 68 65 | number,| and the|
|00004910| 20 7b 5c 74 74 20 6b 7d | 20 74 6f 20 74 68 65 20 | {\tt k}| to the |
|00004920| 63 6f 6c 75 6d 6e 20 6e | 75 6d 62 65 72 2c 20 61 |column n|umber, a|
|00004930| 6e 64 20 74 68 65 20 66 | 69 72 73 74 20 69 6e 64 |nd the f|irst ind|
|00004940| 65 78 20 69 73 0a 61 6c | 77 61 79 73 20 31 2c 20 |ex is.al|ways 1, |
|00004950| 6e 65 76 65 72 20 30 2e | 20 54 68 69 73 20 64 65 |never 0.| This de|
|00004960| 66 61 75 6c 74 20 63 61 | 6e 6e 6f 74 20 62 65 20 |fault ca|nnot be |
|00004970| 63 68 61 6e 67 65 64 2e | 29 0a 0a 45 76 65 6e 20 |changed.|)..Even |
|00004980| 62 65 74 74 65 72 2c 20 | 74 79 70 65 20 7b 5c 74 |better, |type {\t|
|00004990| 74 20 6d 5b 31 2c 32 5d | 3d 35 3b 6d 7d 20 28 74 |t m[1,2]|=5;m} (t|
|000049a0| 68 65 20 73 65 6d 69 63 | 6f 6c 6f 6e 20 61 6c 6c |he semic|olon all|
|000049b0| 6f 77 73 20 75 73 20 74 | 6f 20 70 75 74 20 73 65 |ows us t|o put se|
|000049c0| 76 65 72 61 6c 0a 69 6e | 73 74 72 75 63 74 69 6f |veral.in|structio|
|000049d0| 6e 73 20 6f 6e 20 74 68 | 65 20 73 61 6d 65 20 6c |ns on th|e same l|
|000049e0| 69 6e 65 2e 20 49 74 20 | 69 73 20 61 6e 20 61 62 |ine. It |is an ab|
|000049f0| 73 6f 6c 75 74 65 20 6e | 65 63 65 73 73 69 74 79 |solute n|ecessity|
|00004a00| 20 77 68 65 6e 20 77 65 | 20 70 72 6f 67 72 61 6d | when we| program|
|00004a10| 0a 69 6e 20 47 50 29 2e | 20 4e 6f 77 20 74 79 70 |.in GP).| Now typ|
|00004a20| 65 20 7b 5c 74 74 20 6d | 5b 31 2c 5d 3d 5b 31 35 |e {\tt m|[1,]=[15|
|00004a30| 2c 2d 31 37 5d 7d 2e 20 | 4e 6f 20 70 72 6f 62 6c |,-17]}. |No probl|
|00004a40| 65 6d 2e 20 46 69 6e 61 | 6c 6c 79 20 74 79 70 65 |em. Fina|lly type|
|00004a50| 0a 7b 5c 74 74 20 6d 5b | 2c 32 5d 3d 5b 6a 2c 6b |.{\tt m[|,2]=[j,k|
|00004a60| 5d 7d 2e 20 59 6f 75 20 | 68 61 76 65 20 61 6e 20 |]}. You |have an |
|00004a70| 65 72 72 6f 72 20 6d 65 | 73 73 61 67 65 20 73 69 |error me|ssage si|
|00004a80| 6e 63 65 20 79 6f 75 20 | 68 61 76 65 20 74 79 70 |nce you |have typ|
|00004a90| 65 64 20 61 20 72 6f 77 | 0a 76 65 63 74 6f 72 2c |ed a row|.vector,|
|00004aa0| 20 77 68 69 6c 65 20 7b | 5c 74 74 20 6d 5b 2c 32 | while {|\tt m[,2|
|00004ab0| 5d 7d 20 69 73 20 61 20 | 63 6f 6c 75 6d 6e 20 76 |]} is a |column v|
|00004ac0| 65 63 74 6f 72 2e 20 49 | 66 20 79 6f 75 20 74 79 |ector. I|f you ty|
|00004ad0| 70 65 20 69 6e 73 74 65 | 61 64 0a 7b 5c 74 74 20 |pe inste|ad.{\tt |
|00004ae0| 6d 5b 2c 32 5d 3d 5b 6a | 2c 6b 5d 5c 7e 7b 7d 7d |m[,2]=[j|,k]\~{}}|
|00004af0| 20 69 74 20 77 6f 72 6b | 73 2e 0a 5c 73 6d 61 6c | it work|s..\smal|
|00004b00| 6c 73 6b 69 70 0a 54 79 | 70 65 20 6e 6f 77 20 7b |lskip.Ty|pe now {|
|00004b10| 5c 74 74 20 68 3d 68 69 | 6c 62 65 72 74 28 32 30 |\tt h=hi|lbert(20|
|00004b20| 29 7d 2e 20 59 6f 75 20 | 67 65 74 20 74 68 65 20 |)}. You |get the |
|00004b30| 73 6f 2d 63 61 6c 6c 65 | 64 20 60 60 48 69 6c 62 |so-calle|d ``Hilb|
|00004b40| 65 72 74 20 6d 61 74 72 | 69 78 27 27 20 77 68 6f |ert matr|ix'' who|
|00004b50| 73 65 20 0a 63 6f 65 66 | 66 69 63 69 65 6e 74 20 |se .coef|ficient |
|00004b60| 6f 66 20 72 6f 77 20 7b | 5c 74 74 20 69 7d 20 61 |of row {|\tt i} a|
|00004b70| 6e 64 20 63 6f 6c 75 6d | 6e 20 7b 5c 74 74 20 6a |nd colum|n {\tt j|
|00004b80| 7d 20 69 73 20 65 71 75 | 61 6c 20 74 6f 0a 7b 5c |} is equ|al to.{\|
|00004b90| 74 74 20 31 24 2f 24 28 | 69 24 2b 24 6a 24 2d 24 |tt 1$/$(|i$+$j$-$|
|00004ba0| 31 29 7d 2e 20 49 6e 63 | 69 64 65 6e 74 61 6c 6c |1)}. Inc|identall|
|00004bb0| 79 2c 20 74 68 65 20 6d | 61 74 72 69 78 20 7b 5c |y, the m|atrix {\|
|00004bc0| 74 74 20 68 7d 20 74 61 | 6b 65 73 20 74 6f 6f 0a |tt h} ta|kes too.|
|00004bd0| 6d 75 63 68 20 72 6f 6f | 6d 2e 20 49 66 20 79 6f |much roo|m. If yo|
|00004be0| 75 20 64 6f 6e 27 74 20 | 77 61 6e 74 20 74 6f 20 |u don't |want to |
|00004bf0| 73 65 65 20 69 74 2c 20 | 73 69 6d 70 6c 79 20 74 |see it, |simply t|
|00004c00| 79 70 65 20 61 20 73 65 | 6d 69 2d 63 6f 6c 6f 6e |ype a se|mi-colon|
|00004c10| 20 60 60 3b 27 27 20 61 | 74 20 74 68 65 0a 65 6e | ``;'' a|t the.en|
|00004c20| 64 20 6f 66 20 74 68 65 | 20 6c 69 6e 65 20 28 7b |d of the| line ({|
|00004c30| 5c 74 74 20 68 3d 68 69 | 6c 62 65 72 74 28 32 30 |\tt h=hi|lbert(20|
|00004c40| 29 3b 7d 29 2e 20 54 68 | 69 73 20 69 73 20 61 6e |);}). Th|is is an|
|00004c50| 20 65 78 61 6d 70 6c 65 | 20 6f 66 20 61 20 60 60 | example| of a ``|
|00004c60| 70 72 65 63 6f 6d 70 75 | 74 65 64 27 27 0a 6d 61 |precompu|ted''.ma|
|00004c70| 74 72 69 78 2c 20 62 75 | 69 6c 74 2d 69 6e 20 50 |trix, bu|ilt-in P|
|00004c80| 41 52 49 2e 20 54 68 65 | 72 65 20 61 72 65 20 6f |ARI. The|re are o|
|00004c90| 6e 6c 79 20 61 20 66 65 | 77 2e 20 57 65 20 77 69 |nly a fe|w. We wi|
|00004ca0| 6c 6c 20 73 65 65 20 6c | 61 74 65 72 20 61 6e 20 |ll see l|ater an |
|00004cb0| 65 78 61 6d 70 6c 65 0a | 6f 66 20 61 20 6d 75 63 |example.|of a muc|
|00004cc0| 68 20 6d 6f 72 65 20 67 | 65 6e 65 72 61 6c 20 63 |h more g|eneral c|
|00004cd0| 6f 6e 73 74 72 75 63 74 | 69 6f 6e 2e 0a 0a 57 68 |onstruct|ion...Wh|
|00004ce0| 61 74 20 69 73 20 69 6e | 74 65 72 65 73 74 69 6e |at is in|terestin|
|00004cf0| 67 20 61 62 6f 75 74 20 | 48 69 6c 62 65 72 74 20 |g about |Hilbert |
|00004d00| 6d 61 74 72 69 63 65 73 | 20 69 73 20 74 68 61 74 |matrices| is that|
|00004d10| 20 66 69 72 73 74 20 74 | 68 65 69 72 20 69 6e 76 | first t|heir inv|
|00004d20| 65 72 73 65 73 20 61 6e | 64 0a 64 65 74 65 72 6d |erses an|d.determ|
|00004d30| 69 6e 61 6e 74 73 20 63 | 61 6e 20 62 65 20 63 6f |inants c|an be co|
|00004d40| 6d 70 75 74 65 64 20 65 | 78 70 6c 69 63 69 74 6c |mputed e|xplicitl|
|00004d50| 79 20 28 61 6e 64 20 74 | 68 65 20 69 6e 76 65 72 |y (and t|he inver|
|00004d60| 73 65 20 68 61 73 20 69 | 6e 74 65 67 65 72 0a 63 |se has i|nteger.c|
|00004d70| 6f 65 66 66 69 63 69 65 | 6e 74 73 29 2c 20 61 6e |oefficie|nts), an|
|00004d80| 64 20 73 65 63 6f 6e 64 | 20 74 68 65 79 20 61 72 |d second| they ar|
|00004d90| 65 20 6e 75 6d 65 72 69 | 63 61 6c 6c 79 20 76 65 |e numeri|cally ve|
|00004da0| 72 79 20 75 6e 73 74 61 | 62 6c 65 2c 20 77 68 69 |ry unsta|ble, whi|
|00004db0| 63 68 20 6d 61 6b 65 0a | 74 68 65 6d 20 61 20 73 |ch make.|them a s|
|00004dc0| 65 76 65 72 65 20 74 65 | 73 74 20 66 6f 72 20 6c |evere te|st for l|
|00004dd0| 69 6e 65 61 72 20 61 6c | 67 65 62 72 61 20 70 61 |inear al|gebra pa|
|00004de0| 63 6b 61 67 65 73 20 69 | 6e 20 6e 75 6d 65 72 69 |ckages i|n numeri|
|00004df0| 63 61 6c 20 61 6e 61 6c | 79 73 69 73 2e 0a 4f 66 |cal anal|ysis..Of|
|00004e00| 20 63 6f 75 72 73 65 20 | 77 69 74 68 20 50 41 52 | course |with PAR|
|00004e10| 49 2c 20 6e 6f 20 73 75 | 63 68 20 70 72 6f 62 6c |I, no su|ch probl|
|00004e20| 65 6d 20 63 61 6e 20 6f | 63 63 75 72 3a 20 73 69 |em can o|ccur: si|
|00004e30| 6e 63 65 20 74 68 65 20 | 63 6f 65 66 66 69 63 69 |nce the |coeffici|
|00004e40| 65 6e 74 73 20 61 72 65 | 0a 67 69 76 65 6e 20 61 |ents are|.given a|
|00004e50| 73 20 72 61 74 69 6f 6e | 61 6c 20 6e 75 6d 62 65 |s ration|al numbe|
|00004e60| 72 73 2c 20 74 68 65 20 | 63 6f 6d 70 75 74 61 74 |rs, the |computat|
|00004e70| 69 6f 6e 20 77 69 6c 6c | 20 62 65 20 64 6f 6e 65 |ion will| be done|
|00004e80| 20 65 78 61 63 74 6c 79 | 2c 20 73 6f 20 74 68 65 | exactly|, so the|
|00004e90| 72 65 0a 63 61 6e 6e 6f | 74 20 62 65 20 61 6e 79 |re.canno|t be any|
|00004ea0| 20 6e 75 6d 65 72 69 63 | 61 6c 20 65 72 72 6f 72 | numeric|al error|
|00004eb0| 2e 20 54 72 79 20 69 74 | 2e 20 54 79 70 65 20 7b |. Try it|. Type {|
|00004ec0| 5c 74 74 20 64 3d 64 65 | 74 28 68 29 7d 20 28 79 |\tt d=de|t(h)} (y|
|00004ed0| 6f 75 20 68 61 76 65 20 | 74 6f 20 62 65 0a 61 20 |ou have |to be.a |
|00004ee0| 6c 69 74 74 6c 65 20 70 | 61 74 69 65 6e 74 2c 20 |little p|atient, |
|00004ef0| 74 68 69 73 20 69 73 20 | 71 75 69 74 65 20 61 20 |this is |quite a |
|00004f00| 63 6f 6d 70 6c 69 63 61 | 74 65 64 20 63 6f 6d 70 |complica|ted comp|
|00004f10| 75 74 61 74 69 6f 6e 29 | 2e 20 54 68 65 20 72 65 |utation)|. The re|
|00004f20| 73 75 6c 74 20 69 73 0a | 61 20 72 61 74 69 6f 6e |sult is.|a ration|
|00004f30| 61 6c 20 6e 75 6d 62 65 | 72 20 28 6f 66 20 63 6f |al numbe|r (of co|
|00004f40| 75 72 73 65 29 20 6f 66 | 20 6e 75 6d 65 72 61 74 |urse) of| numerat|
|00004f50| 6f 72 20 65 71 75 61 6c | 20 74 6f 20 31 20 61 6e |or equal| to 1 an|
|00004f60| 64 20 64 65 6e 6f 6d 69 | 6e 61 74 6f 72 20 68 61 |d denomi|nator ha|
|00004f70| 76 69 6e 67 0a 32 32 36 | 20 64 65 63 69 6d 61 6c |ving.226| decimal|
|00004f80| 20 64 69 67 69 74 73 2e | 20 48 6f 77 20 64 6f 20 | digits.| How do |
|00004f90| 49 20 6b 6e 6f 77 2c 20 | 62 79 20 74 68 65 20 77 |I know, |by the w|
|00004fa0| 61 79 3f 20 49 20 64 69 | 64 20 6e 6f 74 20 63 6f |ay? I di|d not co|
|00004fb0| 75 6e 74 21 20 49 6e 73 | 74 65 61 64 2c 0a 73 69 |unt! Ins|tead,.si|
|00004fc0| 6d 70 6c 79 20 74 79 70 | 65 20 7b 5c 74 74 20 31 |mply typ|e {\tt 1|
|00004fd0| 2e 2a 64 7d 2e 20 54 68 | 65 20 72 65 73 75 6c 74 |.*d}. Th|e result|
|00004fe0| 20 69 73 20 6e 6f 77 20 | 69 6e 20 65 78 70 6f 6e | is now |in expon|
|00004ff0| 65 6e 74 69 61 6c 20 66 | 6f 72 6d 61 74 2c 20 61 |ential f|ormat, a|
|00005000| 6e 64 20 74 68 65 0a 65 | 78 70 6f 6e 65 6e 74 20 |nd the.e|xponent |
|00005010| 67 69 76 65 73 20 75 73 | 20 74 68 65 20 61 6e 73 |gives us| the ans|
|00005020| 77 65 72 2e 0a 0a 4e 6f | 77 20 74 79 70 65 20 7b |wer...No|w type {|
|00005030| 5c 74 74 20 68 72 3d 31 | 2e 2a 68 3b 7d 20 28 64 |\tt hr=1|.*h;} (d|
|00005040| 6f 20 6e 6f 74 20 66 6f | 72 67 65 74 20 74 68 65 |o not fo|rget the|
|00005050| 20 73 65 6d 69 63 6f 6c | 6f 6e 2c 20 77 65 20 64 | semicol|on, we d|
|00005060| 6f 6e 27 74 20 77 61 6e | 74 20 74 6f 20 73 65 65 |on't wan|t to see|
|00005070| 0a 61 6c 6c 20 74 68 65 | 20 6a 75 6e 6b 21 29 2c |.all the| junk!),|
|00005080| 20 74 68 65 6e 20 7b 5c | 74 74 20 64 72 3d 64 65 | then {\|tt dr=de|
|00005090| 74 28 68 72 29 7d 2e 20 | 59 6f 75 20 6e 6f 74 69 |t(hr)}. |You noti|
|000050a0| 63 65 20 74 77 6f 20 74 | 68 69 6e 67 73 2e 20 46 |ce two t|hings. F|
|000050b0| 69 72 73 74 20 74 68 65 | 0a 63 6f 6d 70 75 74 61 |irst the|.computa|
|000050c0| 74 69 6f 6e 2c 20 61 6c | 74 68 6f 75 67 68 20 6e |tion, al|though n|
|000050d0| 6f 74 20 69 6e 73 74 61 | 6e 74 61 6e 65 6f 75 73 |ot insta|ntaneous|
|000050e0| 2c 20 69 73 20 6d 75 63 | 68 20 66 61 73 74 65 72 |, is muc|h faster|
|000050f0| 20 74 68 61 6e 20 69 6e | 20 74 68 65 20 72 61 74 | than in| the rat|
|00005100| 69 6f 6e 61 6c 0a 63 61 | 73 65 2e 20 54 68 65 20 |ional.ca|se. The |
|00005110| 72 65 61 73 6f 6e 20 66 | 6f 72 20 74 68 69 73 20 |reason f|or this |
|00005120| 69 73 20 74 68 61 74 20 | 50 41 52 49 20 69 73 20 |is that |PARI is |
|00005130| 68 61 6e 64 6c 69 6e 67 | 20 72 65 61 6c 20 6e 75 |handling| real nu|
|00005140| 6d 62 65 72 73 20 77 69 | 74 68 20 32 38 20 64 69 |mbers wi|th 28 di|
|00005150| 67 69 74 73 0a 6f 66 20 | 61 63 63 75 72 61 63 79 |gits.of |accuracy|
|00005160| 2c 20 77 68 69 6c 65 20 | 69 6e 20 74 68 65 20 72 |, while |in the r|
|00005170| 61 74 69 6f 6e 61 6c 20 | 63 61 73 65 20 69 74 20 |ational |case it |
|00005180| 69 73 20 68 61 6e 64 6c | 69 6e 67 20 69 6e 74 65 |is handl|ing inte|
|00005190| 67 65 72 73 20 68 61 76 | 69 6e 67 20 75 70 20 74 |gers hav|ing up t|
|000051a0| 6f 0a 32 32 36 20 64 65 | 63 69 6d 61 6c 20 64 69 |o.226 de|cimal di|
|000051b0| 67 69 74 73 2e 0a 0a 54 | 68 65 20 73 65 63 6f 6e |gits...T|he secon|
|000051c0| 64 20 6d 6f 72 65 20 69 | 6d 70 6f 72 74 61 6e 74 |d more i|mportant|
|000051d0| 20 66 61 63 74 20 69 73 | 20 74 68 61 74 20 74 68 | fact is| that th|
|000051e0| 65 20 72 65 73 75 6c 74 | 20 69 73 20 74 65 72 72 |e result| is terr|
|000051f0| 69 62 6c 79 20 77 72 6f | 6e 67 2e 20 49 66 20 79 |ibly wro|ng. If y|
|00005200| 6f 75 0a 63 6f 6d 70 61 | 72 65 20 77 69 74 68 20 |ou.compa|re with |
|00005210| 7b 5c 74 74 20 31 2e 2a | 64 7d 20 63 6f 6d 70 75 |{\tt 1.*|d} compu|
|00005220| 74 65 64 20 65 61 72 6c | 69 65 72 2c 20 77 68 69 |ted earl|ier, whi|
|00005230| 63 68 20 69 73 20 63 6f | 72 72 65 63 74 2c 20 79 |ch is co|rrect, y|
|00005240| 6f 75 20 77 69 6c 6c 20 | 73 65 65 20 74 68 61 74 |ou will |see that|
|00005250| 0a 6f 6e 6c 79 20 32 20 | 64 65 63 69 6d 61 6c 73 |.only 2 |decimals|
|00005260| 20 61 67 72 65 65 21 20 | 54 68 69 73 20 63 61 74 | agree! |This cat|
|00005270| 61 73 74 72 6f 70 68 69 | 63 20 75 6e 73 74 61 62 |astrophi|c unstab|
|00005280| 69 6c 69 74 79 20 69 73 | 20 61 73 20 61 6c 72 65 |ility is| as alre|
|00005290| 61 64 79 20 0a 6d 65 6e | 74 69 6f 6e 65 64 20 6f |ady .men|tioned o|
|000052a0| 6e 65 20 6f 66 20 74 68 | 65 20 63 68 61 72 61 63 |ne of th|e charac|
|000052b0| 74 65 72 69 73 74 69 63 | 73 20 6f 66 20 48 69 6c |teristic|s of Hil|
|000052c0| 62 65 72 74 20 6d 61 74 | 72 69 63 65 73 2e 20 49 |bert mat|rices. I|
|000052d0| 6e 20 66 61 63 74 2c 20 | 74 68 65 20 0a 73 69 74 |n fact, |the .sit|
|000052e0| 75 61 74 69 6f 6e 20 69 | 73 20 6d 75 63 68 20 77 |uation i|s much w|
|000052f0| 6f 72 73 65 20 74 68 61 | 6e 20 74 68 61 74 2e 20 |orse tha|n that. |
|00005300| 54 79 70 65 20 7b 5c 74 | 74 20 6e 6f 72 6d 6c 32 |Type {\t|t norml2|
|00005310| 28 31 2f 68 2d 31 2f 28 | 68 2a 31 2e 29 29 7d 0a |(1/h-1/(|h*1.))}.|
|00005320| 28 74 68 65 20 66 75 6e | 63 74 69 6f 6e 20 7b 5c |(the fun|ction {\|
|00005330| 74 74 20 6e 6f 72 6d 6c | 32 7d 20 67 69 76 65 73 |tt norml|2} gives|
|00005340| 20 74 68 65 20 73 71 75 | 61 72 65 20 6f 66 20 74 | the squ|are of t|
|00005350| 68 65 20 24 4c 5e 32 24 | 20 6e 6f 72 6d 2c 20 69 |he $L^2$| norm, i|
|00005360| 2e 65 2e 20 74 68 65 20 | 73 75 6d 20 6f 66 0a 74 |.e. the |sum of.t|
|00005370| 68 65 20 73 71 75 61 72 | 65 73 20 6f 66 20 74 68 |he squar|es of th|
|00005380| 65 20 63 6f 65 66 66 69 | 63 69 65 6e 74 73 29 2e |e coeffi|cients).|
|00005390| 20 41 67 61 69 6e 20 62 | 65 20 70 61 74 69 65 6e | Again b|e patien|
|000053a0| 74 20 73 69 6e 63 65 20 | 63 6f 6d 70 75 74 69 6e |t since |computin|
|000053b0| 67 20 7b 5c 74 74 20 31 | 2f 68 7d 0a 77 69 6c 6c |g {\tt 1|/h}.will|
|000053c0| 20 74 61 6b 65 20 65 76 | 65 6e 20 6d 6f 72 65 20 | take ev|en more |
|000053d0| 74 69 6d 65 20 28 6e 6f | 74 20 6d 75 63 68 29 20 |time (no|t much) |
|000053e0| 74 68 61 6e 20 63 6f 6d | 70 75 74 69 6e 67 20 7b |than com|puting {|
|000053f0| 5c 74 74 20 64 65 74 28 | 68 29 7d 2e 20 54 68 65 |\tt det(|h)}. The|
|00005400| 20 72 65 73 75 6c 74 0a | 69 73 20 6c 61 72 67 65 | result.|is large|
|00005410| 72 20 74 68 61 6e 20 24 | 31 30 5e 7b 35 30 7d 24 |r than $|10^{50}$|
|00005420| 2c 20 73 68 6f 77 69 6e | 67 20 74 68 61 74 20 73 |, showin|g that s|
|00005430| 6f 6d 65 20 63 6f 65 66 | 66 69 63 69 65 6e 74 73 |ome coef|ficients|
|00005440| 20 6f 66 20 7b 5c 74 74 | 20 31 2f 28 68 2a 31 2e | of {\tt| 1/(h*1.|
|00005450| 29 7d 0a 61 72 65 20 77 | 72 6f 6e 67 20 62 79 20 |)}.are w|rong by |
|00005460| 61 73 20 6d 75 63 68 20 | 61 73 20 24 31 30 5e 7b |as much |as $10^{|
|00005470| 32 34 7d 24 20 28 74 68 | 65 20 6c 61 72 67 65 73 |24}$ (th|e larges|
|00005480| 74 20 65 72 72 6f 72 20 | 69 73 20 69 6e 20 66 61 |t error |is in fa|
|00005490| 63 74 20 65 71 75 61 6c | 0a 74 6f 20 24 37 2e 36 |ct equal|.to $7.6|
|000054a0| 34 34 20 31 30 5e 7b 32 | 34 7d 24 20 66 6f 72 20 |44 10^{2|4}$ for |
|000054b0| 74 68 65 20 63 6f 65 66 | 66 69 63 69 65 6e 74 20 |the coef|ficient |
|000054c0| 6f 66 20 72 6f 77 20 31 | 35 20 61 6e 64 20 63 6f |of row 1|5 and co|
|000054d0| 6c 75 6d 6e 20 31 34 2c | 20 77 68 69 63 68 20 69 |lumn 14,| which i|
|000054e0| 73 20 61 0a 32 38 20 64 | 69 67 69 74 20 69 6e 74 |s a.28 d|igit int|
|000054f0| 65 67 65 72 29 2e 0a 0a | 54 6f 20 6f 62 74 61 69 |eger)...|To obtai|
|00005500| 6e 20 74 68 65 20 63 6f | 72 72 65 63 74 20 72 65 |n the co|rrect re|
|00005510| 73 75 6c 74 20 61 66 74 | 65 72 20 72 6f 75 6e 64 |sult aft|er round|
|00005520| 69 6e 67 20 66 6f 72 20 | 74 68 65 20 69 6e 76 65 |ing for |the inve|
|00005530| 72 73 65 2c 20 77 65 20 | 68 61 76 65 20 74 6f 20 |rse, we |have to |
|00005540| 75 73 65 0a 61 20 64 65 | 66 61 75 6c 74 20 70 72 |use.a de|fault pr|
|00005550| 65 63 69 73 69 6f 6e 20 | 6f 66 20 35 36 20 64 69 |ecision |of 56 di|
|00005560| 67 69 74 73 20 28 74 72 | 79 20 69 74 29 2e 0a 5c |gits (tr|y it)..\|
|00005570| 73 6d 61 6c 6c 73 6b 69 | 70 0a 41 6c 74 68 6f 75 |smallski|p.Althou|
|00005580| 67 68 20 76 65 63 74 6f | 72 73 20 61 6e 64 20 6d |gh vecto|rs and m|
|00005590| 61 74 72 69 63 65 73 20 | 63 61 6e 20 62 65 20 65 |atrices |can be e|
|000055a0| 6e 74 65 72 65 64 20 6d | 61 6e 75 61 6c 6c 79 2c |ntered m|anually,|
|000055b0| 20 62 79 20 74 79 70 69 | 6e 67 20 65 78 70 6c 69 | by typi|ng expli|
|000055c0| 63 69 74 6c 79 0a 74 68 | 65 69 72 20 65 6c 65 6d |citly.th|eir elem|
|000055d0| 65 6e 74 73 2c 20 76 65 | 72 79 20 6f 66 74 65 6e |ents, ve|ry often|
|000055e0| 20 74 68 65 20 65 6c 65 | 6d 65 6e 74 73 20 73 61 | the ele|ments sa|
|000055f0| 74 69 73 66 79 20 61 20 | 73 69 6d 70 6c 65 20 6c |tisfy a |simple l|
|00005600| 61 77 20 61 6e 64 20 6f | 6e 65 20 75 73 65 73 20 |aw and o|ne uses |
|00005610| 61 0a 64 69 66 66 65 72 | 65 6e 74 20 73 79 6e 74 |a.differ|ent synt|
|00005620| 61 78 2e 20 46 6f 72 20 | 65 78 61 6d 70 6c 65 2c |ax. For |example,|
|00005630| 20 61 73 73 75 6d 65 20 | 74 68 61 74 20 79 6f 75 | assume |that you|
|00005640| 20 77 61 6e 74 20 61 20 | 76 65 63 74 6f 72 20 77 | want a |vector w|
|00005650| 68 6f 73 65 20 7b 5c 74 | 74 20 6b 7d 2d 74 68 0a |hose {\t|t k}-th.|
|00005660| 63 6f 6f 72 64 69 6e 61 | 74 65 20 69 73 20 65 71 |coordina|te is eq|
|00005670| 75 61 6c 20 74 6f 20 7b | 5c 74 74 20 6b 5c 5e 7b |ual to {|\tt k\^{|
|00005680| 7d 32 7d 2e 20 4e 6f 20 | 70 72 6f 62 6c 65 6d 2c |}2}. No |problem,|
|00005690| 20 74 79 70 65 20 66 6f | 72 20 65 78 61 6d 70 6c | type fo|r exampl|
|000056a0| 65 0a 7b 5c 74 74 20 76 | 65 63 74 6f 72 28 31 30 |e.{\tt v|ector(10|
|000056b0| 2c 6b 2c 6b 5c 5e 7b 7d | 32 29 7d 20 69 66 20 79 |,k,k\^{}|2)} if y|
|000056c0| 6f 75 20 77 61 6e 74 20 | 61 20 76 65 63 74 6f 72 |ou want |a vector|
|000056d0| 20 6f 66 20 6c 65 6e 67 | 74 68 20 31 30 2e 20 53 | of leng|th 10. S|
|000056e0| 69 6d 69 6c 61 72 6c 79 | 2c 20 69 66 0a 79 6f 75 |imilarly|, if.you|
|000056f0| 20 74 79 70 65 20 0a 0a | 5c 63 65 6e 74 65 72 6c | type ..|\centerl|
|00005700| 69 6e 65 7b 7b 5c 74 74 | 20 6d 61 74 72 69 78 28 |ine{{\tt| matrix(|
|00005710| 35 2c 35 2c 6a 2c 6b 2c | 31 24 2f 24 28 6a 24 2b |5,5,j,k,|1$/$(j$+|
|00005720| 24 6b 24 2d 24 31 29 29 | 7d 7d 0a 0a 5c 6e 6f 69 |$k$-$1))|}}..\noi|
|00005730| 6e 64 65 6e 74 20 79 6f | 75 20 77 69 6c 6c 20 67 |ndent yo|u will g|
|00005740| 65 74 20 74 68 65 20 48 | 69 6c 62 65 72 74 0a 6d |et the H|ilbert.m|
|00005750| 61 74 72 69 78 20 6f 66 | 20 6f 72 64 65 72 20 35 |atrix of| order 5|
|00005760| 20 28 68 65 6e 63 65 20 | 74 68 65 20 7b 5c 74 74 | (hence |the {\tt|
|00005770| 20 68 69 6c 62 65 72 74 | 7d 20 66 75 6e 63 74 69 | hilbert|} functi|
|00005780| 6f 6e 20 69 73 20 75 6e | 6e 65 63 65 73 73 61 72 |on is un|necessar|
|00005790| 79 29 2e 0a 54 68 65 20 | 7b 5c 74 74 20 6a 7d 20 |y)..The |{\tt j} |
|000057a0| 61 6e 64 20 7b 5c 74 74 | 20 6b 7d 20 72 65 70 72 |and {\tt| k} repr|
|000057b0| 65 73 65 6e 74 20 64 75 | 6d 6d 79 20 76 61 72 69 |esent du|mmy vari|
|000057c0| 61 62 6c 65 73 20 77 68 | 69 63 68 20 61 72 65 20 |ables wh|ich are |
|000057d0| 75 73 65 64 20 74 6f 20 | 6e 75 6d 62 65 72 0a 74 |used to |number.t|
|000057e0| 68 65 20 72 6f 77 73 20 | 61 6e 64 20 63 6f 6c 75 |he rows |and colu|
|000057f0| 6d 6e 73 20 72 65 73 70 | 65 63 74 69 76 65 6c 79 |mns resp|ectively|
|00005800| 20 28 69 6e 20 74 68 65 | 20 63 61 73 65 20 6f 66 | (in the| case of|
|00005810| 20 61 20 76 65 63 74 6f | 72 20 6f 6e 6c 79 20 6f | a vecto|r only o|
|00005820| 6e 65 20 69 73 20 70 72 | 65 73 65 6e 74 0a 6f 66 |ne is pr|esent.of|
|00005830| 20 63 6f 75 72 73 65 29 | 2e 20 59 6f 75 20 6d 75 | course)|. You mu|
|00005840| 73 74 20 6e 6f 74 20 66 | 6f 72 67 65 74 2c 20 69 |st not f|orget, i|
|00005850| 6e 20 61 64 64 69 74 69 | 6f 6e 20 74 6f 20 74 68 |n additi|on to th|
|00005860| 65 20 64 69 6d 65 6e 73 | 69 6f 6e 73 20 6f 66 20 |e dimens|ions of |
|00005870| 74 68 65 20 76 65 63 74 | 6f 72 0a 6f 72 20 6d 61 |the vect|or.or ma|
|00005880| 74 72 69 78 2c 20 74 6f | 20 69 6e 64 69 63 61 74 |trix, to| indicat|
|00005890| 65 20 65 78 70 6c 69 63 | 69 74 6c 79 20 74 68 65 |e explic|itly the|
|000058a0| 20 6e 61 6d 65 73 20 6f | 66 20 74 68 65 73 65 20 | names o|f these |
|000058b0| 76 61 72 69 61 62 6c 65 | 73 2e 0a 0a 7b 5c 62 66 |variable|s...{\bf|
|000058c0| 20 49 6d 70 6f 72 74 61 | 6e 74 20 77 61 72 6e 69 | Importa|nt warni|
|000058d0| 6e 67 2e 7d 20 54 68 65 | 20 6c 65 74 74 65 72 20 |ng.} The| letter |
|000058e0| 7b 5c 74 74 20 69 7d 20 | 69 73 20 72 65 73 65 72 |{\tt i} |is reser|
|000058f0| 76 65 64 20 66 6f 72 20 | 74 68 65 20 63 6f 6d 70 |ved for |the comp|
|00005900| 6c 65 78 20 6e 75 6d 62 | 65 72 0a 65 71 75 61 6c |lex numb|er.equal|
|00005910| 20 74 6f 20 74 68 65 20 | 73 71 75 61 72 65 20 72 | to the |square r|
|00005920| 6f 6f 74 20 6f 66 20 24 | 2d 31 24 2e 20 48 65 6e |oot of $|-1$. Hen|
|00005930| 63 65 20 69 74 20 69 73 | 20 61 62 73 6f 6c 75 74 |ce it is| absolut|
|00005940| 65 6c 79 20 66 6f 72 62 | 69 64 64 65 6e 20 74 6f |ely forb|idden to|
|00005950| 20 75 73 65 20 69 74 0a | 61 73 20 61 20 76 61 72 | use it.|as a var|
|00005960| 69 61 62 6c 65 2e 20 54 | 72 79 20 74 79 70 69 6e |iable. T|ry typin|
|00005970| 67 20 7b 5c 74 74 20 76 | 65 63 74 6f 72 28 31 30 |g {\tt v|ector(10|
|00005980| 2c 69 2c 69 5c 5e 7b 7d | 32 29 7d 2c 20 74 68 65 |,i,i\^{}|2)}, the|
|00005990| 20 65 72 72 6f 72 20 6d | 65 73 73 61 67 65 20 74 | error m|essage t|
|000059a0| 68 61 74 20 79 6f 75 0a | 67 65 74 20 63 6c 65 61 |hat you.|get clea|
|000059b0| 72 6c 79 20 69 6e 64 69 | 63 61 74 65 73 20 74 68 |rly indi|cates th|
|000059c0| 61 74 20 47 50 20 64 6f | 65 73 20 6e 6f 74 20 63 |at GP do|es not c|
|000059d0| 6f 6e 73 69 64 65 72 20 | 7b 5c 74 74 20 69 7d 20 |onsider |{\tt i} |
|000059e0| 61 73 20 61 20 76 61 72 | 69 61 62 6c 65 2e 0a 25 |as a var|iable..%|
|000059f0| 58 58 58 20 4d 6f 72 65 | 20 65 78 61 6d 70 6c 65 |XXX More| example|
|00005a00| 73 0a 5c 6d 65 64 73 6b | 69 70 0a 54 68 65 20 6c |s.\medsk|ip.The l|
|00005a10| 61 73 74 20 50 41 52 49 | 20 74 79 70 65 73 20 77 |ast PARI| types w|
|00005a20| 68 69 63 68 20 77 65 20 | 68 61 76 65 20 6e 6f 74 |hich we |have not|
|00005a30| 20 79 65 74 20 70 6c 61 | 79 65 64 20 77 69 74 68 | yet pla|yed with|
|00005a40| 20 61 72 65 20 74 79 70 | 65 73 20 77 68 69 63 68 | are typ|es which|
|00005a50| 20 61 72 65 0a 63 6c 6f | 73 65 6c 79 20 6c 69 6e | are.clo|sely lin|
|00005a60| 6b 65 64 20 74 6f 20 6e | 75 6d 62 65 72 20 74 68 |ked to n|umber th|
|00005a70| 65 6f 72 79 20 28 68 65 | 6e 63 65 20 70 65 6f 70 |eory (he|nce peop|
|00005a80| 6c 65 20 6e 6f 74 20 69 | 6e 74 65 72 65 73 74 65 |le not i|ntereste|
|00005a90| 64 20 69 6e 20 6e 75 6d | 62 65 72 20 74 68 65 6f |d in num|ber theo|
|00005aa0| 72 79 0a 63 61 6e 20 73 | 6b 69 70 29 2e 0a 0a 54 |ry.can s|kip)...T|
|00005ab0| 68 65 20 66 69 72 73 74 | 20 69 73 20 74 68 65 20 |he first| is the |
|00005ac0| 74 79 70 65 20 60 60 69 | 6e 74 65 67 65 72 6d 6f |type ``i|ntegermo|
|00005ad0| 64 27 27 2e 20 4c 65 74 | 20 75 73 20 73 65 65 20 |d''. Let| us see |
|00005ae0| 61 6e 20 65 78 61 6d 70 | 6c 65 2e 20 54 79 70 65 |an examp|le. Type|
|00005af0| 0a 7b 5c 74 74 20 6e 3d | 31 30 5c 5e 7b 7d 31 35 |.{\tt n=|10\^{}15|
|00005b00| 2b 33 7d 2e 20 57 65 20 | 77 61 6e 74 20 74 6f 20 |+3}. We |want to |
|00005b10| 6b 6e 6f 77 20 77 68 65 | 74 68 65 72 20 7b 5c 74 |know whe|ther {\t|
|00005b20| 74 20 6e 7d 20 69 73 20 | 70 72 69 6d 65 20 6f 72 |t n} is |prime or|
|00005b30| 20 6e 6f 74 2e 20 4f 66 | 20 63 6f 75 72 73 65 0a | not. Of| course.|
|00005b40| 77 65 20 63 6f 75 6c 64 | 20 6d 61 6b 65 20 75 73 |we could| make us|
|00005b50| 65 20 6f 66 20 74 68 65 | 20 62 75 69 6c 74 69 6e |e of the| builtin|
|00005b60| 20 66 61 63 69 6c 69 74 | 69 65 73 20 6f 66 20 50 | facilit|ies of P|
|00005b70| 41 52 49 2c 20 62 75 74 | 20 6c 65 74 20 75 73 20 |ARI, but| let us |
|00005b80| 64 6f 20 6f 74 68 65 72 | 77 69 73 65 2e 0a 57 65 |do other|wise..We|
|00005b90| 20 66 69 72 73 74 20 74 | 72 69 61 6c 20 64 69 76 | first t|rial div|
|00005ba0| 69 64 65 20 62 79 20 74 | 68 65 20 62 75 69 6c 74 |ide by t|he built|
|00005bb0| 69 6e 20 74 61 62 6c 65 | 20 6f 66 20 70 72 69 6d |in table| of prim|
|00005bc0| 65 73 2c 20 62 79 20 64 | 65 66 61 75 6c 74 20 75 |es, by d|efault u|
|00005bd0| 70 20 74 6f 0a 35 30 30 | 30 30 30 2e 20 57 65 20 |p to.500|000. We |
|00005be0| 73 6c 69 67 68 74 6c 79 | 20 63 68 65 61 74 20 68 |slightly| cheat h|
|00005bf0| 65 72 65 20 61 6e 64 20 | 75 73 65 20 74 68 65 20 |ere and |use the |
|00005c00| 66 75 6e 63 74 69 6f 6e | 20 7b 5c 74 74 20 73 6d |function| {\tt sm|
|00005c10| 61 6c 6c 66 61 63 74 7d | 20 77 68 69 63 68 0a 64 |allfact}| which.d|
|00005c20| 6f 65 73 20 65 78 61 63 | 74 6c 79 20 74 68 69 73 |oes exac|tly this|
|00005c30| 2e 20 53 6f 20 74 79 70 | 65 20 7b 5c 74 74 20 73 |. So typ|e {\tt s|
|00005c40| 6d 61 6c 6c 66 61 63 74 | 28 6e 29 7d 2e 20 54 68 |mallfact|(n)}. Th|
|00005c50| 65 20 72 65 73 75 6c 74 | 20 69 73 20 61 20 32 20 |e result| is a 2 |
|00005c60| 63 6f 6c 75 6d 6e 0a 6d | 61 74 72 69 78 20 28 61 |column.m|atrix (a|
|00005c70| 73 20 61 6c 6c 20 66 61 | 63 74 6f 72 69 6e 67 20 |s all fa|ctoring |
|00005c80| 70 72 6f 67 72 61 6d 73 | 29 2c 20 74 68 65 20 66 |programs|), the f|
|00005c90| 69 72 73 74 20 63 6f 6c | 75 6d 6e 20 67 69 76 69 |irst col|umn givi|
|00005ca0| 6e 67 20 74 68 65 20 70 | 72 69 6d 65 73 20 61 6e |ng the p|rimes an|
|00005cb0| 64 0a 74 68 65 20 73 65 | 63 6f 6e 64 20 74 68 65 |d.the se|cond the|
|00005cc0| 69 72 20 65 78 70 6f 6e | 65 6e 74 73 2e 20 48 65 |ir expon|ents. He|
|00005cd0| 72 65 20 77 65 20 67 65 | 74 20 61 20 73 69 6e 67 |re we ge|t a sing|
|00005ce0| 6c 65 20 72 6f 77 2c 20 | 74 65 6c 6c 69 6e 67 20 |le row, |telling |
|00005cf0| 75 73 20 74 68 61 74 20 | 7b 5c 74 74 20 6e 7d 0a |us that |{\tt n}.|
|00005d00| 69 73 20 6e 6f 74 20 64 | 69 76 69 73 69 62 6c 65 |is not d|ivisible|
|00005d10| 20 62 79 20 61 6e 79 20 | 70 72 69 6d 65 20 75 70 | by any |prime up|
|00005d20| 20 74 6f 20 74 68 65 20 | 64 65 66 61 75 6c 74 20 | to the |default |
|00005d30| 28 35 30 30 30 30 30 29 | 2e 20 57 65 20 63 6f 75 |(500000)|. We cou|
|00005d40| 6c 64 20 6e 6f 77 0a 74 | 72 69 61 6c 20 64 69 76 |ld now.t|rial div|
|00005d50| 69 64 65 20 66 75 72 74 | 68 65 72 2c 20 6f 72 20 |ide furt|her, or |
|00005d60| 65 76 65 6e 20 63 68 65 | 61 74 20 63 6f 6d 70 6c |even che|at compl|
|00005d70| 65 74 65 6c 79 20 61 6e | 64 20 63 61 6c 6c 20 74 |etely an|d call t|
|00005d80| 68 65 20 50 41 52 49 20 | 66 75 6e 63 74 69 6f 6e |he PARI |function|
|00005d90| 0a 7b 5c 74 74 20 66 61 | 63 74 6f 72 7d 2c 20 62 |.{\tt fa|ctor}, b|
|00005da0| 75 74 20 62 65 66 6f 72 | 65 20 77 65 20 64 6f 20 |ut befor|e we do |
|00005db0| 74 68 69 73 20 6c 65 74 | 20 75 73 20 73 65 65 20 |this let| us see |
|00005dc0| 68 6f 77 20 74 6f 20 67 | 65 74 20 61 6e 20 61 6e |how to g|et an an|
|00005dd0| 73 77 65 72 20 6f 75 72 | 73 65 6c 76 65 73 2e 0a |swer our|selves..|
|00005de0| 0a 42 79 20 46 65 72 6d | 61 74 27 73 20 6c 69 74 |.By Ferm|at's lit|
|00005df0| 74 6c 65 20 74 68 65 6f | 72 65 6d 2c 20 69 66 20 |tle theo|rem, if |
|00005e00| 7b 5c 74 74 20 6e 7d 20 | 69 73 20 70 72 69 6d 65 |{\tt n} |is prime|
|00005e10| 20 77 65 20 6d 75 73 74 | 20 68 61 76 65 20 0a 24 | we must| have .$|
|00005e20| 5c 74 65 78 74 7b 61 7d | 5e 7b 5c 74 65 78 74 7b |\text{a}|^{\text{|
|00005e30| 6e 2d 31 7d 7d 5c 65 71 | 75 69 76 31 5c 70 6d 6f |n-1}}\eq|uiv1\pmo|
|00005e40| 64 7b 5c 74 65 78 74 7b | 6e 7d 7d 24 20 66 6f 72 |d{\text{|n}}$ for|
|00005e50| 20 61 6c 6c 20 7b 5c 74 | 74 20 61 7d 20 6e 6f 74 | all {\t|t a} not|
|00005e60| 20 64 69 76 69 73 69 62 | 6c 65 20 62 79 0a 7b 5c | divisib|le by.{\|
|00005e70| 74 74 20 6e 7d 2e 20 48 | 65 6e 63 65 20 77 65 20 |tt n}. H|ence we |
|00005e80| 63 6f 75 6c 64 20 74 72 | 79 20 74 68 69 73 20 77 |could tr|y this w|
|00005e90| 69 74 68 20 7b 5c 74 74 | 20 61 3d 32 7d 20 66 6f |ith {\tt| a=2} fo|
|00005ea0| 72 20 65 78 61 6d 70 6c | 65 2e 20 42 75 74 20 0a |r exampl|e. But .|
|00005eb0| 24 32 5e 7b 5c 74 65 78 | 74 7b 6e 2d 31 7d 7d 24 |$2^{\tex|t{n-1}}$|
|00005ec0| 20 69 73 20 61 20 6e 75 | 6d 62 65 72 20 77 69 74 | is a nu|mber wit|
|00005ed0| 68 20 61 70 70 72 6f 78 | 69 6d 61 74 65 6c 79 20 |h approx|imately |
|00005ee0| 24 33 5c 63 64 6f 74 31 | 30 5e 7b 31 34 7d 24 20 |$3\cdot1|0^{14}$ |
|00005ef0| 64 69 67 69 74 73 2c 20 | 68 65 6e 63 65 0a 69 6d |digits, |hence.im|
|00005f00| 70 6f 73 73 69 62 6c 65 | 20 74 6f 20 77 72 69 74 |possible| to writ|
|00005f10| 65 20 64 6f 77 6e 2c 20 | 65 76 65 6e 20 6c 65 73 |e down, |even les|
|00005f20| 73 20 74 6f 20 63 6f 6d | 70 75 74 65 2e 20 42 75 |s to com|pute. Bu|
|00005f30| 74 20 69 6e 73 74 65 61 | 64 20 74 79 70 65 0a 7b |t instea|d type.{|
|00005f40| 5c 74 74 20 61 3d 6d 6f | 64 28 32 2c 6e 29 7d 2e |\tt a=mo|d(2,n)}.|
|00005f50| 20 54 68 69 73 20 63 72 | 65 61 74 65 73 20 74 68 | This cr|eates th|
|00005f60| 65 20 6e 75 6d 62 65 72 | 20 32 20 63 6f 6e 73 69 |e number| 2 consi|
|00005f70| 64 65 72 65 64 20 6e 6f | 77 20 61 73 20 61 6e 20 |dered no|w as an |
|00005f80| 65 6c 65 6d 65 6e 74 20 | 6f 66 0a 74 68 65 20 72 |element |of.the r|
|00005f90| 69 6e 67 20 24 52 3d 5c | 5a 2f 5c 74 65 78 74 7b |ing $R=\|Z/\text{|
|00005fa0| 6e 7d 5c 5a 24 2e 20 54 | 68 65 20 65 6c 65 6d 65 |n}\Z$. T|he eleme|
|00005fb0| 6e 74 73 20 6f 66 20 24 | 52 24 2c 20 63 61 6c 6c |nts of $|R$, call|
|00005fc0| 65 64 20 69 6e 74 65 67 | 65 72 6d 6f 64 73 2c 20 |ed integ|ermods, |
|00005fd0| 63 61 6e 0a 61 6c 77 61 | 79 73 20 62 65 20 72 65 |can.alwa|ys be re|
|00005fe0| 70 72 65 73 65 6e 74 65 | 64 20 62 79 20 6e 75 6d |presente|d by num|
|00005ff0| 62 65 72 73 20 73 6d 61 | 6c 6c 65 72 20 74 68 61 |bers sma|ller tha|
|00006000| 6e 20 7b 5c 74 74 20 6e | 7d 2c 20 68 65 6e 63 65 |n {\tt n|}, hence|
|00006010| 20 76 65 72 79 20 73 6d | 61 6c 6c 2e 0a 46 65 72 | very sm|all..Fer|
|00006020| 6d 61 74 27 73 20 74 68 | 65 6f 72 65 6d 20 63 61 |mat's th|eorem ca|
|00006030| 6e 20 62 65 20 72 65 77 | 72 69 74 74 65 6e 20 7b |n be rew|ritten {|
|00006040| 5c 74 74 20 24 5c 74 65 | 78 74 7b 61 7d 5e 7b 5c |\tt $\te|xt{a}^{\|
|00006050| 74 65 78 74 7b 6e 2d 31 | 7d 7d 3d 24 6d 6f 64 28 |text{n-1|}}=$mod(|
|00006060| 31 2c 6e 29 7d 20 69 6e | 0a 74 68 65 20 72 69 6e |1,n)} in|.the rin|
|00006070| 67 20 24 52 24 2c 20 61 | 6e 64 20 74 68 69 73 20 |g $R$, a|nd this |
|00006080| 63 61 6e 20 62 65 20 63 | 6f 6d 70 75 74 65 64 20 |can be c|omputed |
|00006090| 76 65 72 79 20 65 66 66 | 69 63 69 65 6e 74 6c 79 |very eff|iciently|
|000060a0| 2e 20 54 79 70 65 0a 7b | 5c 74 74 20 61 5c 5e 7b |. Type.{|\tt a\^{|
|000060b0| 7d 28 6e 2d 31 29 7d 2e | 20 54 68 65 20 72 65 73 |}(n-1)}.| The res|
|000060c0| 75 6c 74 20 69 73 20 64 | 65 66 69 6e 69 74 65 6c |ult is d|efinitel|
|000060d0| 79 20 7b 5c 73 6c 20 6e | 6f 74 5c 2f 7d 20 65 71 |y {\sl n|ot\/} eq|
|000060e0| 75 61 6c 20 74 6f 20 7b | 5c 74 74 20 6d 6f 64 28 |ual to {|\tt mod(|
|000060f0| 31 2c 6e 29 7d 2c 0a 74 | 68 75 73 20 7b 5c 73 6c |1,n)},.t|hus {\sl|
|00006100| 20 70 72 6f 76 69 6e 67 | 5c 2f 7d 20 74 68 61 74 | proving|\/} that|
|00006110| 20 7b 5c 74 74 20 6e 7d | 20 69 73 20 6e 6f 74 20 | {\tt n}| is not |
|00006120| 61 20 70 72 69 6d 65 20 | 28 69 66 20 77 65 20 68 |a prime |(if we h|
|00006130| 61 64 20 6f 62 74 61 69 | 6e 65 64 20 0a 7b 5c 74 |ad obtai|ned .{\t|
|00006140| 74 20 6d 6f 64 28 31 2c | 6e 29 7d 20 6f 6e 20 74 |t mod(1,|n)} on t|
|00006150| 68 65 20 6f 74 68 65 72 | 20 68 61 6e 64 2c 20 69 |he other| hand, i|
|00006160| 74 20 77 6f 75 6c 64 20 | 68 61 76 65 20 67 69 76 |t would |have giv|
|00006170| 65 6e 20 75 73 20 61 20 | 68 69 6e 74 20 74 68 61 |en us a |hint tha|
|00006180| 74 20 7b 5c 74 74 20 6e | 7d 0a 69 73 20 6d 61 79 |t {\tt n|}.is may|
|00006190| 62 65 20 70 72 69 6d 65 | 2c 20 62 75 74 20 6e 65 |be prime|, but ne|
|000061a0| 76 65 72 20 61 20 70 72 | 6f 6f 66 29 2e 0a 0a 54 |ver a pr|oof)...T|
|000061b0| 6f 20 66 69 6e 64 20 74 | 68 65 20 66 61 63 74 6f |o find t|he facto|
|000061c0| 72 73 20 69 73 20 61 6e | 6f 74 68 65 72 20 73 74 |rs is an|other st|
|000061d0| 6f 72 79 2e 20 4f 6e 65 | 20 6d 75 73 74 20 75 73 |ory. One| must us|
|000061e0| 65 20 6c 65 73 73 20 6e | 61 69 76 65 20 74 65 63 |e less n|aive tec|
|000061f0| 68 6e 69 71 75 65 73 20 | 74 68 61 6e 0a 74 72 69 |hniques |than.tri|
|00006200| 61 6c 20 64 69 76 69 73 | 69 6f 6e 20 28 6f 72 20 |al divis|ion (or |
|00006210| 62 65 20 76 65 72 79 20 | 70 61 74 69 65 6e 74 29 |be very |patient)|
|00006220| 2e 20 54 6f 20 66 69 6e | 69 73 68 20 74 68 69 73 |. To fin|ish this|
|00006230| 20 65 78 61 6d 70 6c 65 | 2c 20 74 79 70 65 20 0a | example|, type .|
|00006240| 7b 5c 74 74 20 66 61 63 | 74 6f 72 28 6e 29 7d 20 |{\tt fac|tor(n)} |
|00006250| 74 6f 20 73 65 65 20 74 | 68 65 20 66 61 63 74 6f |to see t|he facto|
|00006260| 72 73 2e 20 53 69 6e 63 | 65 20 74 68 65 20 73 6d |rs. Sinc|e the sm|
|00006270| 61 6c 6c 65 73 74 20 66 | 61 63 74 6f 72 20 69 73 |allest f|actor is|
|00006280| 20 31 34 39 30 32 33 35 | 37 2c 0a 79 6f 75 20 77 | 1490235|7,.you w|
|00006290| 6f 75 6c 64 20 68 61 76 | 65 20 68 61 64 20 74 6f |ould hav|e had to|
|000062a0| 20 62 65 20 76 65 72 79 | 20 70 61 74 69 65 6e 74 | be very| patient|
|000062b0| 20 77 69 74 68 20 74 72 | 69 61 6c 20 64 69 76 69 | with tr|ial divi|
|000062c0| 73 69 6f 6e 21 0a 5c 73 | 6d 61 6c 6c 73 6b 69 70 |sion!.\s|mallskip|
|000062d0| 0a 54 68 65 20 73 65 63 | 6f 6e 64 20 73 70 65 63 |.The sec|ond spec|
|000062e0| 69 66 69 63 61 6c 6c 79 | 20 6e 75 6d 62 65 72 2d |ifically| number-|
|000062f0| 74 68 65 6f 72 65 74 69 | 63 20 74 79 70 65 20 69 |theoreti|c type i|
|00006300| 73 20 74 68 65 20 70 2d | 61 64 69 63 20 6e 75 6d |s the p-|adic num|
|00006310| 62 65 72 73 2e 20 49 20 | 68 61 76 65 0a 6e 6f 20 |bers. I |have.no |
|00006320| 72 6f 6f 6d 20 66 6f 72 | 20 64 65 66 69 6e 69 74 |room for| definit|
|00006330| 69 6f 6e 73 2c 20 73 6f | 20 70 6c 65 61 73 65 20 |ions, so| please |
|00006340| 73 6b 69 70 20 69 66 20 | 79 6f 75 20 68 61 76 65 |skip if |you have|
|00006350| 20 6e 6f 20 75 73 65 20 | 66 6f 72 20 73 75 63 68 | no use |for such|
|00006360| 20 62 65 61 73 74 73 2e | 0a 41 20 70 2d 61 64 69 | beasts.|.A p-adi|
|00006370| 63 20 6e 75 6d 62 65 72 | 20 69 73 20 65 6e 74 65 |c number| is ente|
|00006380| 72 65 64 20 61 73 20 61 | 20 72 61 74 69 6f 6e 61 |red as a| rationa|
|00006390| 6c 20 6f 72 20 69 6e 74 | 65 67 65 72 20 76 61 6c |l or int|eger val|
|000063a0| 75 65 64 20 65 78 70 72 | 65 73 73 69 6f 6e 20 74 |ued expr|ession t|
|000063b0| 6f 20 77 68 69 63 68 0a | 69 73 20 61 64 64 65 64 |o which.|is added|
|000063c0| 20 7b 5c 74 74 20 4f 28 | 70 5c 5e 7b 7d 6e 29 7d | {\tt O(|p\^{}n)}|
|000063d0| 20 28 6f 72 20 73 69 6d | 70 6c 79 20 7b 5c 74 74 | (or sim|ply {\tt|
|000063e0| 20 4f 28 70 29 7d 20 69 | 66 20 7b 5c 74 74 20 6e | O(p)} i|f {\tt n|
|000063f0| 3d 31 7d 29 20 77 68 65 | 72 65 20 7b 5c 74 74 20 |=1}) whe|re {\tt |
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.