home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / progs / pari / pari_137 / tex / usersch4.tex < prev    next >
LaTeX Document  |  1992-05-20  |  55.2 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: usersch4.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 50 72 6f 67 72 61 6d |\chapter|{Program|
|00000010| 6d 69 6e 67 20 50 41 52 | 49 20 69 6e 20 4c 69 62 |ming PAR|I in Lib|
|00000020| 72 61 72 79 20 4d 6f 64 | 65 7d 0a 0a 5c 73 65 63 |rary Mod|e}..\sec|
|00000030| 74 69 6f 6e 7b 49 6e 74 | 72 6f 64 75 63 74 69 6f |tion{Int|roductio|
|00000040| 6e 3a 20 69 6e 69 74 69 | 61 6c 69 7a 61 74 69 6f |n: initi|alizatio|
|00000050| 6e 73 2c 20 75 6e 69 76 | 65 72 73 61 6c 20 6f 62 |ns, univ|ersal ob|
|00000060| 6a 65 63 74 73 2c 20 69 | 6e 70 75 74 20 61 6e 64 |jects, i|nput and|
|00000070| 20 6f 75 74 70 75 74 2e | 7d 0a 0a 54 6f 20 62 65 | output.|}..To be|
|00000080| 20 61 62 6c 65 20 74 6f | 20 75 73 65 20 50 41 52 | able to| use PAR|
|00000090| 49 20 69 6e 20 5c 72 65 | 66 7b 6c 69 62 72 61 72 |I in \re|f{librar|
|000000a0| 79 20 6d 6f 64 65 7d 2c | 20 79 6f 75 20 6d 75 73 |y mode},| you mus|
|000000b0| 74 20 77 72 69 74 65 20 | 61 20 43 20 70 72 6f 67 |t write |a C prog|
|000000c0| 72 61 6d 20 61 6e 64 20 | 6c 69 6e 6b 20 69 74 0a |ram and |link it.|
|000000d0| 74 6f 20 74 68 65 20 50 | 41 52 49 20 6c 69 62 72 |to the P|ARI libr|
|000000e0| 61 72 79 20 61 6e 64 20 | 74 68 65 20 50 41 52 49 |ary and |the PARI|
|000000f0| 20 69 6e 63 6c 75 64 65 | 20 66 69 6c 65 73 2e 20 | include| files. |
|00000100| 53 65 65 20 74 68 65 20 | 69 6e 73 74 61 6c 6c 61 |See the |installa|
|00000110| 74 69 6f 6e 20 67 75 69 | 64 65 20 0a 28 67 69 76 |tion gui|de .(giv|
|00000120| 65 6e 20 69 6e 20 41 70 | 70 65 6e 64 69 78 20 41 |en in Ap|pendix A|
|00000130| 29 20 6f 6e 20 68 6f 77 | 20 74 6f 20 63 72 65 61 |) on how| to crea|
|00000140| 74 65 20 61 6e 64 20 69 | 6e 73 74 61 6c 6c 20 74 |te and i|nstall t|
|00000150| 68 65 20 50 41 52 49 0a | 6c 69 62 72 61 72 79 20 |he PARI.|library |
|00000160| 61 6e 64 20 69 6e 63 6c | 75 64 65 20 66 69 6c 65 |and incl|ude file|
|00000170| 73 2e 20 41 20 73 61 6d | 70 6c 65 20 4d 61 6b 65 |s. A sam|ple Make|
|00000180| 66 69 6c 65 20 69 73 20 | 61 6c 73 6f 20 67 69 76 |file is |also giv|
|00000190| 65 6e 20 69 6e 20 41 70 | 70 65 6e 64 69 78 20 42 |en in Ap|pendix B|
|000001a0| 2e 0a 0a 50 72 6f 62 61 | 62 6c 79 20 74 68 65 20 |...Proba|bly the |
|000001b0| 62 65 73 74 20 77 61 79 | 20 74 6f 20 75 6e 64 65 |best way| to unde|
|000001c0| 72 73 74 61 6e 64 20 68 | 6f 77 20 70 72 6f 67 72 |rstand h|ow progr|
|000001d0| 61 6d 6d 69 6e 67 20 69 | 73 20 64 6f 6e 65 20 69 |amming i|s done i|
|000001e0| 73 20 74 6f 20 77 6f 72 | 6b 0a 74 68 72 6f 75 67 |s to wor|k.throug|
|000001f0| 68 20 61 20 63 6f 6d 70 | 6c 65 74 65 20 65 78 61 |h a comp|lete exa|
|00000200| 6d 70 6c 65 2e 20 57 65 | 20 77 69 6c 6c 20 77 72 |mple. We| will wr|
|00000210| 69 74 65 20 73 75 63 68 | 20 61 20 70 72 6f 67 72 |ite such| a progr|
|00000220| 61 6d 20 69 6e 20 73 65 | 63 74 69 6f 6e 20 34 2e |am in se|ction 4.|
|00000230| 33 2e 0a 42 65 66 6f 72 | 65 20 64 6f 69 6e 67 20 |3..Befor|e doing |
|00000240| 74 68 69 73 2c 20 61 20 | 66 65 77 20 65 78 70 6c |this, a |few expl|
|00000250| 61 6e 61 74 69 6f 6e 73 | 20 61 72 65 20 69 6e 20 |anations| are in |
|00000260| 6f 72 64 65 72 2e 0a 0a | 5c 73 75 62 73 65 63 7b |order...|\subsec{|
|00000270| 49 6e 69 74 69 61 6c 69 | 7a 61 74 69 6f 6e 73 20 |Initiali|zations |
|00000280| 61 6e 64 20 75 6e 69 76 | 65 72 73 61 6c 20 6f 62 |and univ|ersal ob|
|00000290| 6a 65 63 74 73 2e 7d 0a | 0a 46 69 72 73 74 2c 20 |jects.}.|.First, |
|000002a0| 6f 6e 65 20 6d 75 73 74 | 20 65 78 70 6c 61 69 6e |one must| explain|
|000002b0| 20 74 6f 20 74 68 65 20 | 6f 75 74 73 69 64 65 20 | to the |outside |
|000002c0| 77 6f 72 6c 64 20 77 68 | 61 74 20 6b 69 6e 64 20 |world wh|at kind |
|000002d0| 6f 66 20 6f 62 6a 65 63 | 74 73 20 61 6e 64 0a 70 |of objec|ts and.p|
|000002e0| 72 6f 67 72 61 6d 73 20 | 77 65 20 61 72 65 20 67 |rograms |we are g|
|000002f0| 6f 69 6e 67 20 74 6f 20 | 75 73 65 2e 20 54 68 69 |oing to |use. Thi|
|00000300| 73 20 69 73 20 64 6f 6e | 65 20 73 69 6d 70 6c 79 |s is don|e simply|
|00000310| 20 77 69 74 68 20 74 68 | 65 20 73 74 61 74 65 6d | with th|e statem|
|00000320| 65 6e 74 0a 0a 7b 5c 74 | 74 20 5c 23 69 6e 63 6c |ent..{\t|t \#incl|
|00000330| 75 64 65 20 3c 67 65 6e | 70 61 72 69 2e 68 3e 7d |ude <gen|pari.h>}|
|00000340| 0a 0a 4e 6f 74 65 20 74 | 68 61 74 20 74 68 69 73 |..Note t|hat this|
|00000350| 20 69 73 20 75 73 75 61 | 6c 6c 79 20 61 20 6c 69 | is usua|lly a li|
|00000360| 6e 6b 2c 20 63 72 65 61 | 74 65 64 20 77 68 65 6e |nk, crea|ted when|
|00000370| 20 79 6f 75 20 6d 61 6b | 65 20 74 68 65 20 6c 69 | you mak|e the li|
|00000380| 62 72 61 72 79 2c 20 74 | 6f 0a 61 20 66 69 6c 65 |brary, t|o.a file|
|00000390| 20 63 61 6c 6c 65 64 20 | 65 69 74 68 65 72 20 7b | called |either {|
|000003a0| 5c 74 74 20 67 65 6e 70 | 61 72 69 36 38 6b 2e 68 |\tt genp|ari68k.h|
|000003b0| 7d 20 28 66 6f 72 20 36 | 38 30 78 30 2d 62 61 73 |} (for 6|80x0-bas|
|000003c0| 65 64 20 6d 61 63 68 69 | 6e 65 73 20 77 69 74 68 |ed machi|nes with|
|000003d0| 20 78 20 61 74 0a 6c 65 | 61 73 74 20 32 29 20 6f | x at.le|ast 2) o|
|000003e0| 72 20 7b 5c 74 74 20 67 | 65 6e 70 61 72 69 6f 74 |r {\tt g|enpariot|
|000003f0| 68 65 72 2e 68 7d 20 28 | 66 6f 72 20 61 6c 6c 20 |her.h} (|for all |
|00000400| 6f 74 68 65 72 20 6d 61 | 63 68 69 6e 65 73 29 2e |other ma|chines).|
|00000410| 0a 0a 54 68 69 73 20 66 | 69 6c 65 20 7b 5c 74 74 |..This f|ile {\tt|
|00000420| 20 5c 72 65 66 7b 67 65 | 6e 70 61 72 69 2e 68 7d | \ref{ge|npari.h}|
|00000430| 7d 2c 20 66 69 72 73 74 | 20 65 78 70 6f 72 74 73 |}, first| exports|
|00000440| 20 61 6c 6c 20 74 68 65 | 20 6e 65 63 65 73 73 61 | all the| necessa|
|00000450| 72 79 20 63 6f 6e 73 74 | 61 6e 74 73 2c 20 76 61 |ry const|ants, va|
|00000460| 72 69 61 62 6c 65 73 0a | 61 6e 64 20 66 75 6e 63 |riables.|and func|
|00000470| 74 69 6f 6e 73 2c 20 64 | 65 66 69 6e 65 73 20 73 |tions, d|efines s|
|00000480| 6f 6d 65 20 69 6d 70 6f | 72 74 61 6e 74 20 6d 61 |ome impo|rtant ma|
|00000490| 63 72 6f 73 2c 20 61 6e | 64 20 61 6c 73 6f 20 64 |cros, an|d also d|
|000004a0| 65 66 69 6e 65 73 20 74 | 68 65 20 66 75 6e 64 61 |efines t|he funda|
|000004b0| 6d 65 6e 74 61 6c 0a 74 | 79 70 65 20 66 6f 72 20 |mental.t|ype for |
|000004c0| 61 6c 6c 20 50 41 52 49 | 20 6f 62 6a 65 63 74 73 |all PARI| objects|
|000004d0| 3a 20 74 68 65 20 74 79 | 70 65 20 7b 5c 62 66 20 |: the ty|pe {\bf |
|000004e0| 5c 72 65 66 7b 47 45 4e | 7d 7d 2c 20 77 68 69 63 |\ref{GEN|}}, whic|
|000004f0| 68 20 69 73 20 73 69 6d | 70 6c 79 0a 61 20 70 6f |h is sim|ply.a po|
|00000500| 69 6e 74 65 72 20 74 6f | 20 7b 5c 74 74 20 6c 6f |inter to| {\tt lo|
|00000510| 6e 67 7d 2e 0a 0a 7b 5c | 62 66 20 54 65 63 68 6e |ng}...{\|bf Techn|
|00000520| 69 63 61 6c 20 6e 6f 74 | 65 7d 3a 20 77 65 20 77 |ical not|e}: we w|
|00000530| 6f 75 6c 64 20 68 61 76 | 65 20 6c 69 6b 65 64 20 |ould hav|e liked |
|00000540| 74 6f 20 64 65 66 69 6e | 65 20 61 20 74 79 70 65 |to defin|e a type|
|00000550| 20 47 45 4e 20 74 6f 20 | 62 65 20 61 0a 70 6f 69 | GEN to |be a.poi|
|00000560| 6e 74 65 72 20 6f 6e 20 | 69 74 73 65 6c 66 2e 20 |nter on |itself. |
|00000570| 54 68 69 73 20 75 6e 66 | 6f 72 74 75 6e 61 74 65 |This unf|ortunate|
|00000580| 6c 79 20 69 73 20 6e 6f | 74 20 70 6f 73 73 69 62 |ly is no|t possib|
|00000590| 6c 65 20 69 6e 20 43 2c | 20 65 78 63 65 70 74 20 |le in C,| except |
|000005a0| 62 79 0a 75 73 69 6e 67 | 20 73 74 72 75 63 74 75 |by.using| structu|
|000005b0| 72 65 73 2c 20 62 75 74 | 20 74 68 65 6e 20 74 68 |res, but| then th|
|000005c0| 65 20 6e 61 6d 65 73 20 | 62 65 63 6f 6d 65 20 75 |e names |become u|
|000005d0| 6e 77 69 65 6c 64 79 2e | 20 4f 6e 20 74 68 65 20 |nwieldy.| On the |
|000005e0| 6f 74 68 65 72 20 68 61 | 6e 64 2c 0a 62 79 20 61 |other ha|nd,.by a|
|000005f0| 20 73 69 6d 70 6c 65 20 | 74 72 69 63 6b 2c 20 69 | simple |trick, i|
|00000600| 74 20 63 61 6e 20 62 65 | 20 64 6f 6e 65 20 69 6e |t can be| done in|
|00000610| 20 50 61 73 63 61 6c 20 | 66 6f 72 20 65 78 61 6d | Pascal |for exam|
|00000620| 70 6c 65 2e 20 54 68 65 | 20 72 65 73 75 6c 74 20 |ple. The| result |
|00000630| 6f 66 20 74 68 69 73 0a | 69 73 20 74 68 61 74 20 |of this.|is that |
|00000640| 77 68 65 6e 20 77 65 20 | 77 69 6c 6c 20 75 73 65 |when we |will use|
|00000650| 20 61 20 63 6f 6d 70 6f | 6e 65 6e 74 20 6f 66 20 | a compo|nent of |
|00000660| 61 20 50 41 52 49 20 6f | 62 6a 65 63 74 2c 20 69 |a PARI o|bject, i|
|00000670| 74 20 77 69 6c 6c 20 62 | 65 20 61 20 7b 5c 73 6c |t will b|e a {\sl|
|00000680| 20 6c 6f 6e 67 7d 2c 0a | 68 65 6e 63 65 20 77 69 | long},.|hence wi|
|00000690| 6c 6c 20 6e 65 65 64 20 | 74 6f 20 62 65 20 74 79 |ll need |to be ty|
|000006a0| 70 65 63 61 73 74 65 64 | 20 74 6f 20 61 20 47 45 |pecasted| to a GE|
|000006b0| 4e 20 61 67 61 69 6e 20 | 69 66 20 77 65 20 77 61 |N again |if we wa|
|000006c0| 6e 74 20 74 6f 20 61 76 | 6f 69 64 20 77 61 72 6e |nt to av|oid warn|
|000006d0| 69 6e 67 73 0a 66 72 6f | 6d 20 74 68 65 20 63 6f |ings.fro|m the co|
|000006e0| 6d 70 69 6c 65 72 2e 20 | 54 68 69 73 20 77 69 6c |mpiler. |This wil|
|000006f0| 6c 20 73 6f 6d 65 74 69 | 6d 65 73 20 62 65 20 71 |l someti|mes be q|
|00000700| 75 69 74 65 20 74 65 64 | 69 6f 75 73 2c 20 62 75 |uite ted|ious, bu|
|00000710| 74 20 6f 66 20 63 6f 75 | 72 73 65 20 69 73 0a 74 |t of cou|rse is.t|
|00000720| 72 69 76 69 61 6c 6c 79 | 20 64 6f 6e 65 2e 0a 0a |rivially| done...|
|00000730| 54 6f 20 74 61 6b 65 20 | 61 6e 20 65 78 61 6d 70 |To take |an examp|
|00000740| 6c 65 2c 20 61 20 70 6f | 6c 79 6e 6f 6d 69 61 6c |le, a po|lynomial|
|00000750| 20 24 50 24 20 6f 66 20 | 64 65 67 72 65 65 20 32 | $P$ of |degree 2|
|00000760| 20 77 69 6c 6c 20 62 65 | 20 72 65 70 72 65 73 65 | will be| represe|
|00000770| 6e 74 65 64 20 62 79 20 | 61 20 63 68 75 6e 6b 0a |nted by |a chunk.|
|00000780| 6f 66 20 6d 65 6d 6f 72 | 79 20 70 6f 69 6e 74 65 |of memor|y pointe|
|00000790| 64 20 74 6f 20 62 79 20 | 74 68 65 20 47 45 4e 20 |d to by |the GEN |
|000007a0| 24 50 24 2e 20 24 50 5b | 30 5d 24 20 61 6e 64 20 |$P$. $P[|0]$ and |
|000007b0| 24 50 5b 31 5d 24 20 63 | 6f 6e 74 61 69 6e 20 63 |$P[1]$ c|ontain c|
|000007c0| 6f 64 65 0a 69 6e 66 6f | 72 6d 61 74 69 6f 6e 2c |ode.info|rmation,|
|000007d0| 20 69 6e 20 70 61 72 74 | 69 63 75 6c 61 72 20 74 | in part|icular t|
|000007e0| 68 65 20 74 79 70 65 20 | 6f 66 20 74 68 65 20 6f |he type |of the o|
|000007f0| 62 6a 65 63 74 2c 20 74 | 68 65 20 64 65 67 72 65 |bject, t|he degre|
|00000800| 65 20 6f 66 20 24 50 24 | 2c 20 65 74 63 5c 64 6f |e of $P$|, etc\do|
|00000810| 74 73 2e 0a 24 50 5b 32 | 5d 24 2c 20 24 50 5b 33 |ts..$P[2|]$, $P[3|
|00000820| 5d 24 2c 20 24 50 5b 34 | 5d 24 20 63 6f 6e 74 61 |]$, $P[4|]$ conta|
|00000830| 69 6e 20 70 6f 69 6e 74 | 65 72 73 20 74 6f 20 74 |in point|ers to t|
|00000840| 68 65 20 63 6f 65 66 66 | 69 63 69 65 6e 74 73 20 |he coeff|icients |
|00000850| 6f 66 20 64 65 67 72 65 | 65 20 30 2c 20 31 2c 0a |of degre|e 0, 1,.|
|00000860| 61 6e 64 20 32 20 6f 66 | 20 24 50 24 20 72 65 73 |and 2 of| $P$ res|
|00000870| 70 65 63 74 69 76 65 6c | 79 20 28 6e 6f 74 65 20 |pectivel|y (note |
|00000880| 74 68 65 20 61 73 63 65 | 6e 64 69 6e 67 20 6f 72 |the asce|nding or|
|00000890| 64 65 72 29 2e 20 54 68 | 69 73 20 69 73 20 77 68 |der). Th|is is wh|
|000008a0| 65 72 65 20 74 79 70 65 | 63 61 73 74 69 6e 67 0a |ere type|casting.|
|000008b0| 77 69 6c 6c 20 62 65 20 | 6e 65 63 65 73 73 61 72 |will be |necessar|
|000008c0| 79 3a 20 69 6e 20 70 72 | 69 6e 63 69 70 6c 65 20 |y: in pr|inciple |
|000008d0| 24 50 5b 69 5d 24 20 28 | 66 6f 72 20 24 69 3d 32 |$P[i]$ (|for $i=2|
|000008e0| 2c 33 2c 34 24 29 20 69 | 73 20 61 20 6c 6f 6e 67 |,3,4$) i|s a long|
|000008f0| 2c 20 62 75 74 20 77 65 | 20 77 69 6c 6c 0a 77 61 |, but we| will.wa|
|00000900| 6e 74 20 74 6f 20 75 73 | 65 20 69 74 20 61 73 20 |nt to us|e it as |
|00000910| 61 20 47 45 4e 2e 20 0a | 54 68 65 20 63 6f 65 66 |a GEN. .|The coef|
|00000920| 66 69 63 69 65 6e 74 73 | 20 24 50 5b 69 5d 24 20 |ficients| $P[i]$ |
|00000930| 74 68 65 6d 73 65 6c 76 | 65 73 20 61 72 65 20 69 |themselv|es are i|
|00000940| 6e 20 63 68 75 6e 6b 73 | 20 6f 66 20 6d 65 6d 6f |n chunks| of memo|
|00000950| 72 79 20 77 68 6f 73 65 | 20 63 6f 6d 70 6c 65 78 |ry whose| complex|
|00000960| 69 74 79 0a 64 65 70 65 | 6e 64 73 20 6f 6e 20 74 |ity.depe|nds on t|
|00000970| 68 65 20 74 79 70 65 73 | 20 6f 66 20 74 68 65 20 |he types| of the |
|00000980| 63 6f 65 66 66 69 63 69 | 65 6e 74 73 2c 20 61 6e |coeffici|ents, an|
|00000990| 64 20 73 6f 20 6f 6e 2e | 0a 0a 4e 6f 77 20 77 65 |d so on.|..Now we|
|000009a0| 20 6d 75 73 74 20 73 74 | 61 74 65 20 74 68 65 20 | must st|ate the |
|000009b0| 6d 6f 73 74 20 69 6d 70 | 6f 72 74 61 6e 74 20 6c |most imp|ortant l|
|000009c0| 61 77 20 61 62 6f 75 74 | 20 70 72 6f 67 72 61 6d |aw about| program|
|000009d0| 6d 69 6e 67 20 69 6e 20 | 50 41 52 49 2c 20 77 68 |ming in |PARI, wh|
|000009e0| 69 63 68 0a 6d 75 73 74 | 20 62 65 20 72 65 73 70 |ich.must| be resp|
|000009f0| 65 63 74 65 64 20 69 66 | 20 6f 6e 65 20 77 61 6e |ected if| one wan|
|00000a00| 74 73 20 74 6f 20 61 76 | 6f 69 64 20 64 69 73 61 |ts to av|oid disa|
|00000a10| 73 74 65 72 73 3a 0a 0a | 7b 5c 62 66 20 41 70 61 |sters:..|{\bf Apa|
|00000a20| 72 74 20 66 72 6f 6d 20 | 75 6e 69 76 65 72 73 61 |rt from |universa|
|00000a30| 6c 20 6f 62 6a 65 63 74 | 73 20 7b 5c 72 6d 20 28 |l object|s {\rm (|
|00000a40| 73 65 65 20 62 65 6c 6f | 77 29 7d 20 74 68 65 20 |see belo|w)} the |
|00000a50| 63 68 75 6e 6b 73 20 6f | 66 20 6d 65 6d 6f 72 79 |chunks o|f memory|
|00000a60| 0a 75 73 65 64 20 62 79 | 20 61 20 67 69 76 65 6e |.used by| a given|
|00000a70| 20 50 41 52 49 20 6f 62 | 6a 65 63 74 20 6d 75 73 | PARI ob|ject mus|
|00000a80| 74 20 62 65 20 69 6e 20 | 63 6f 6e 73 65 63 75 74 |t be in |consecut|
|00000a90| 69 76 65 20 6d 65 6d 6f | 72 79 20 6c 6f 63 61 74 |ive memo|ry locat|
|00000aa0| 69 6f 6e 73 7d 2e 0a 0a | 44 6f 6e 27 74 20 70 61 |ions}...|Don't pa|
|00000ab0| 6e 69 63 3a 20 6c 65 74 | 27 73 20 73 65 65 20 74 |nic: let|'s see t|
|00000ac0| 68 65 20 72 65 61 73 6f | 6e 20 61 6e 64 20 74 68 |he reaso|n and th|
|00000ad0| 65 20 6d 65 61 6e 69 6e | 67 20 6f 66 20 74 68 69 |e meanin|g of thi|
|00000ae0| 73 2c 20 61 6e 64 20 68 | 6f 77 20 0a 69 74 20 63 |s, and h|ow .it c|
|00000af0| 61 6e 20 62 65 20 61 63 | 68 69 65 76 65 64 2e 0a |an be ac|hieved..|
|00000b00| 0a 57 68 65 6e 20 64 6f | 69 6e 67 20 6c 61 72 67 |.When do|ing larg|
|00000b10| 65 20 63 6f 6d 70 75 74 | 61 74 69 6f 6e 73 2c 20 |e comput|ations, |
|00000b20| 75 6e 77 61 6e 74 65 64 | 20 69 6e 74 65 72 6d 65 |unwanted| interme|
|00000b30| 64 69 61 74 65 20 72 65 | 73 75 6c 74 73 20 63 6c |diate re|sults cl|
|00000b40| 75 74 74 65 72 20 75 70 | 0a 6d 65 6d 6f 72 79 20 |utter up|.memory |
|00000b50| 76 65 72 79 20 66 61 73 | 74 20 73 6f 20 73 6f 6d |very fas|t so som|
|00000b60| 65 20 6b 69 6e 64 20 6f | 66 20 67 61 72 62 61 67 |e kind o|f garbag|
|00000b70| 65 20 63 6f 6c 6c 65 63 | 74 69 6e 67 20 69 73 20 |e collec|ting is |
|00000b80| 6e 65 65 64 65 64 2e 20 | 4d 6f 73 74 20 6c 61 72 |needed. |Most lar|
|00000b90| 67 65 0a 73 79 73 74 65 | 6d 73 20 64 6f 20 67 61 |ge.syste|ms do ga|
|00000ba0| 72 62 61 67 65 20 63 6f | 6c 6c 65 63 74 69 6e 67 |rbage co|llecting|
|00000bb0| 20 77 68 65 6e 20 74 68 | 65 20 63 6c 75 74 74 65 | when th|e clutte|
|00000bc0| 72 69 6e 67 20 67 65 74 | 73 20 68 65 61 76 79 2c |ring get|s heavy,|
|00000bd0| 20 61 6e 64 20 74 68 69 | 73 20 73 6c 6f 77 73 0a | and thi|s slows.|
|00000be0| 64 6f 77 6e 20 74 68 65 | 20 70 65 72 66 6f 72 6d |down the| perform|
|00000bf0| 61 6e 63 65 2e 20 49 6e | 20 50 41 52 49 20 77 65 |ance. In| PARI we|
|00000c00| 20 68 61 76 65 20 74 61 | 6b 65 6e 20 61 20 64 69 | have ta|ken a di|
|00000c10| 66 66 65 72 65 6e 74 20 | 61 70 70 72 6f 61 63 68 |fferent |approach|
|00000c20| 3a 20 79 6f 75 20 6d 75 | 73 74 0a 64 6f 20 79 6f |: you mu|st.do yo|
|00000c30| 75 72 20 6f 77 6e 20 63 | 6c 65 61 6e 69 6e 67 20 |ur own c|leaning |
|00000c40| 75 70 20 61 73 20 73 6f | 6f 6e 20 61 73 20 74 68 |up as so|on as th|
|00000c50| 65 20 69 6e 74 65 72 6d | 65 64 69 61 74 65 20 72 |e interm|ediate r|
|00000c60| 65 73 75 6c 74 73 20 61 | 72 65 20 6e 6f 74 20 6e |esults a|re not n|
|00000c70| 65 65 64 65 64 2e 0a 53 | 70 65 63 69 61 6c 20 70 |eeded..S|pecial p|
|00000c80| 75 72 70 6f 73 65 20 72 | 6f 75 74 69 6e 65 73 20 |urpose r|outines |
|00000c90| 68 61 76 65 20 62 65 65 | 6e 20 77 72 69 74 74 65 |have bee|n writte|
|00000ca0| 6e 20 74 6f 20 64 6f 20 | 74 68 69 73 2c 20 62 75 |n to do |this, bu|
|00000cb0| 74 20 74 68 65 20 70 72 | 69 6d 61 72 79 0a 72 65 |t the pr|imary.re|
|00000cc0| 71 75 69 72 65 6d 65 6e | 74 20 69 73 20 65 78 61 |quiremen|t is exa|
|00000cd0| 63 74 6c 79 20 61 73 20 | 73 74 61 74 65 64 20 61 |ctly as |stated a|
|00000ce0| 62 6f 76 65 3a 20 61 20 | 50 41 52 49 20 6f 62 6a |bove: a |PARI obj|
|00000cf0| 65 63 74 20 6d 75 73 74 | 20 62 65 20 28 65 73 73 |ect must| be (ess|
|00000d00| 65 6e 74 69 61 6c 6c 79 | 29 0a 63 6f 6e 6e 65 63 |entially|).connec|
|00000d10| 74 65 64 2e 20 41 73 20 | 61 20 63 6f 6e 73 65 71 |ted. As |a conseq|
|00000d20| 75 65 6e 63 65 20 6f 66 | 20 74 68 69 73 20 65 78 |uence of| this ex|
|00000d30| 70 6c 61 6e 61 74 69 6f | 6e 2c 20 6f 6e 65 20 61 |planatio|n, one a|
|00000d40| 6c 73 6f 20 73 65 65 73 | 20 74 68 61 74 20 74 68 |lso sees| that th|
|00000d50| 65 72 65 0a 69 73 20 61 | 6e 20 65 76 69 64 65 6e |ere.is a|n eviden|
|00000d60| 74 20 65 78 63 65 70 74 | 69 6f 6e 20 74 6f 20 74 |t except|ion to t|
|00000d70| 68 65 20 61 62 6f 76 65 | 20 6c 61 77 3a 20 69 66 |he above| law: if|
|00000d80| 20 79 6f 75 72 20 63 6f | 6d 70 75 74 61 74 69 6f | your co|mputatio|
|00000d90| 6e 20 69 73 20 73 6d 61 | 6c 6c 20 65 6e 6f 75 67 |n is sma|ll enoug|
|00000da0| 68 0a 73 6f 20 74 68 61 | 74 20 79 6f 75 20 64 6f |h.so tha|t you do|
|00000db0| 6e 27 74 20 6e 65 65 64 | 20 74 6f 20 64 6f 20 61 |n't need| to do a|
|00000dc0| 6e 79 20 67 61 72 62 61 | 67 65 20 63 6f 6c 6c 65 |ny garba|ge colle|
|00000dd0| 63 74 69 6e 67 2c 20 74 | 68 65 6e 20 6a 75 73 74 |cting, t|hen just|
|00000de0| 20 67 6f 20 61 68 65 61 | 64 2c 0a 50 41 52 49 20 | go ahea|d,.PARI |
|00000df0| 77 6f 6e 27 74 20 6d 69 | 6e 64 20 64 69 73 63 6f |won't mi|nd disco|
|00000e00| 6e 6e 65 63 74 65 64 20 | 6f 62 6a 65 63 74 73 20 |nnected |objects |
|00000e10| 69 6e 20 6d 6f 73 74 20 | 63 61 73 65 73 2e 20 48 |in most |cases. H|
|00000e20| 6f 77 65 76 65 72 2c 20 | 73 69 6e 63 65 20 50 41 |owever, |since PA|
|00000e30| 52 49 0a 72 6f 75 74 69 | 6e 65 73 20 64 6f 20 74 |RI.routi|nes do t|
|00000e40| 68 65 69 72 20 6f 77 6e | 20 67 61 72 62 61 67 65 |heir own| garbage|
|00000e50| 20 63 6f 6c 6c 65 63 74 | 69 6e 67 2c 20 77 61 74 | collect|ing, wat|
|00000e60| 63 68 20 63 61 72 65 66 | 75 6c 6c 79 20 77 68 61 |ch caref|ully wha|
|00000e70| 74 20 79 6f 75 20 61 72 | 65 20 64 6f 69 6e 67 2e |t you ar|e doing.|
|00000e80| 0a 0a 54 68 65 20 6e 6f | 74 69 6f 6e 20 6f 66 20 |..The no|tion of |
|00000e90| 5c 72 65 66 7b 75 6e 69 | 76 65 72 73 61 6c 20 6f |\ref{uni|versal o|
|00000ea0| 62 6a 65 63 74 7d 20 61 | 6c 6c 75 64 65 64 20 74 |bject} a|lluded t|
|00000eb0| 6f 20 61 62 6f 76 65 20 | 69 73 20 71 75 69 74 65 |o above |is quite|
|00000ec0| 20 73 69 6d 70 6c 65 3a | 0a 64 75 72 69 6e 67 20 | simple:|.during |
|00000ed0| 74 68 65 20 65 78 65 63 | 75 74 69 6f 6e 20 6f 66 |the exec|ution of|
|00000ee0| 20 79 6f 75 72 20 70 72 | 6f 67 72 61 6d 2c 20 61 | your pr|ogram, a|
|00000ef0| 20 6e 75 6d 62 65 72 20 | 6f 66 20 6f 62 6a 65 63 | number |of objec|
|00000f00| 74 73 20 77 69 6c 6c 20 | 68 61 76 65 20 62 65 65 |ts will |have bee|
|00000f10| 6e 0a 64 65 66 69 6e 65 | 64 20 28 62 79 20 74 68 |n.define|d (by th|
|00000f20| 65 20 73 79 73 74 65 6d | 20 6f 72 20 62 79 20 79 |e system| or by y|
|00000f30| 6f 75 72 73 65 6c 66 29 | 20 77 69 74 68 20 74 68 |ourself)| with th|
|00000f40| 65 20 69 64 65 61 20 74 | 68 61 74 20 74 68 65 79 |e idea t|hat they|
|00000f50| 20 73 74 61 79 20 70 65 | 72 6d 61 6e 65 6e 74 6c | stay pe|rmanentl|
|00000f60| 79 0a 77 69 74 68 20 74 | 68 65 20 73 61 6d 65 20 |y.with t|he same |
|00000f70| 76 61 6c 75 65 73 2e 20 | 45 78 61 6d 70 6c 65 73 |values. |Examples|
|00000f80| 20 61 72 65 20 74 68 65 | 20 69 6e 74 65 67 65 72 | are the| integer|
|00000f90| 20 31 2c 20 74 68 65 20 | 66 72 61 63 74 69 6f 6e | 1, the |fraction|
|00000fa0| 20 24 5c 64 66 72 61 63 | 20 31 20 32 24 2c 0a 74 | $\dfrac| 1 2$,.t|
|00000fb0| 68 65 20 70 6f 6c 79 6e | 6f 6d 69 61 6c 20 24 58 |he polyn|omial $X|
|00000fc0| 24 2c 20 6f 72 20 61 20 | 70 72 69 6d 65 20 24 70 |$, or a |prime $p|
|00000fd0| 24 20 77 68 69 63 68 20 | 69 73 20 75 73 65 64 20 |$ which |is used |
|00000fe0| 61 73 20 61 20 62 61 73 | 65 20 6d 6f 64 75 6c 75 |as a bas|e modulu|
|00000ff0| 73 20 66 6f 72 0a 69 6e | 74 65 67 65 72 6d 6f 64 |s for.in|tegermod|
|00001000| 73 20 6f 72 20 24 70 24 | 2d 61 64 69 63 73 2e 20 |s or $p$|-adics. |
|00001010| 54 68 65 73 65 20 75 6e | 69 76 65 72 73 61 6c 20 |These un|iversal |
|00001020| 6f 62 6a 65 63 74 73 20 | 61 72 65 20 6f 66 20 63 |objects |are of c|
|00001030| 6f 75 72 73 65 20 61 6c | 6c 6f 77 65 64 20 74 6f |ourse al|lowed to|
|00001040| 20 62 65 0a 64 69 73 63 | 6f 6e 6e 65 63 74 65 64 | be.disc|onnected|
|00001050| 20 66 72 6f 6d 20 74 68 | 65 20 6f 74 68 65 72 20 | from th|e other |
|00001060| 50 41 52 49 20 6f 62 6a | 65 63 74 73 2e 0a 0a 41 |PARI obj|ects...A|
|00001070| 66 74 65 72 20 64 65 63 | 6c 61 72 69 6e 67 20 74 |fter dec|laring t|
|00001080| 68 65 20 75 73 65 20 6f | 66 20 74 68 65 20 66 69 |he use o|f the fi|
|00001090| 6c 65 20 67 65 6e 70 61 | 72 69 2e 68 2c 20 74 68 |le genpa|ri.h, th|
|000010a0| 65 20 66 69 72 73 74 20 | 65 78 65 63 75 74 61 62 |e first |executab|
|000010b0| 6c 65 20 73 74 61 74 65 | 6d 65 6e 74 0a 6f 66 20 |le state|ment.of |
|000010c0| 61 20 6d 61 69 6e 20 70 | 72 6f 67 72 61 6d 20 73 |a main p|rogram s|
|000010d0| 68 6f 75 6c 64 20 62 65 | 20 74 6f 20 69 6e 69 74 |hould be| to init|
|000010e0| 69 61 6c 69 7a 65 20 74 | 68 65 20 50 41 52 49 20 |ialize t|he PARI |
|000010f0| 73 79 73 74 65 6d 2c 20 | 61 6e 64 20 69 6e 20 70 |system, |and in p|
|00001100| 61 72 74 69 63 75 6c 61 | 72 0a 74 68 65 20 50 41 |articula|r.the PA|
|00001110| 52 49 20 73 74 61 63 6b | 20 77 68 69 63 68 20 77 |RI stack| which w|
|00001120| 69 6c 6c 20 63 6f 6e 74 | 61 69 6e 20 61 6c 6c 20 |ill cont|ain all |
|00001130| 74 68 65 20 63 6f 6d 70 | 75 74 61 74 69 6f 6e 73 |the comp|utations|
|00001140| 2e 20 54 68 69 73 20 69 | 73 20 73 69 6d 70 6c 79 |. This i|s simply|
|00001150| 20 64 6f 6e 65 0a 77 69 | 74 68 20 61 20 63 61 6c | done.wi|th a cal|
|00001160| 6c 20 74 6f 20 74 68 65 | 20 74 77 6f 20 76 61 72 |l to the| two var|
|00001170| 69 61 62 6c 65 20 66 75 | 6e 63 74 69 6f 6e 20 7b |iable fu|nction {|
|00001180| 5c 62 66 20 5c 72 65 66 | 7b 69 6e 69 74 7d 7d 2c |\bf \ref|{init}},|
|00001190| 20 6c 69 6b 65 20 0a 7b | 5c 74 74 20 69 6e 69 74 | like .{|\tt init|
|000011a0| 28 34 30 30 30 30 30 30 | 2c 31 30 30 30 30 30 29 |(4000000|,100000)|
|000011b0| 7d 2e 0a 54 68 65 20 66 | 69 72 73 74 20 61 72 67 |}..The f|irst arg|
|000011c0| 75 6d 65 6e 74 20 28 68 | 65 72 65 20 34 20 6d 69 |ument (h|ere 4 mi|
|000011d0| 6c 6c 69 6f 6e 29 20 69 | 73 20 74 68 65 20 6e 75 |llion) i|s the nu|
|000011e0| 6d 62 65 72 20 6f 66 20 | 62 79 74 65 73 20 67 69 |mber of |bytes gi|
|000011f0| 76 65 6e 20 74 6f 20 50 | 41 52 49 20 74 6f 0a 77 |ven to P|ARI to.w|
|00001200| 6f 72 6b 20 77 69 74 68 | 20 28 69 74 20 73 68 6f |ork with| (it sho|
|00001210| 75 6c 64 20 6e 6f 74 20 | 72 65 61 73 6f 6e 61 62 |uld not |reasonab|
|00001220| 6c 79 20 64 72 6f 70 20 | 75 6e 64 65 72 20 35 30 |ly drop |under 50|
|00001230| 30 30 30 30 29 2c 20 61 | 6e 64 20 74 68 65 20 73 |0000), a|nd the s|
|00001240| 65 63 6f 6e 64 20 69 73 | 20 74 68 65 0a 75 70 70 |econd is| the.upp|
|00001250| 65 72 20 6c 69 6d 69 74 | 20 6f 6e 20 61 20 70 72 |er limit| on a pr|
|00001260| 65 63 6f 6d 70 75 74 65 | 64 20 70 72 69 6d 65 20 |ecompute|d prime |
|00001270| 6e 75 6d 62 65 72 20 74 | 61 62 6c 65 2e 20 49 66 |number t|able. If|
|00001280| 20 79 6f 75 20 64 6f 6e | 27 74 20 77 61 6e 74 20 | you don|'t want |
|00001290| 70 72 69 6d 65 20 6e 75 | 6d 62 65 72 73 2c 0a 6a |prime nu|mbers,.j|
|000012a0| 75 73 74 20 70 75 74 20 | 32 2c 20 62 75 74 20 70 |ust put |2, but p|
|000012b0| 75 74 20 61 6e 20 61 72 | 67 75 6d 65 6e 74 20 61 |ut an ar|gument a|
|000012c0| 6e 79 77 61 79 20 62 65 | 63 61 75 73 65 20 7b 5c |nyway be|cause {\|
|000012d0| 74 74 20 69 6e 69 74 28 | 29 7d 20 65 78 70 65 63 |tt init(|)} expec|
|000012e0| 74 73 20 6f 6e 65 2e 0a | 0a 57 65 20 68 61 76 65 |ts one..|.We have|
|000012f0| 20 6e 6f 77 20 61 74 20 | 6f 75 72 20 64 69 73 70 | now at |our disp|
|00001300| 6f 73 61 6c 3a 0a 0a 24 | 5c 62 75 6c 6c 65 74 24 |osal:..$|\bullet$|
|00001310| 20 74 68 65 20 66 6f 6c | 6c 6f 77 69 6e 67 20 75 | the fol|lowing u|
|00001320| 6e 69 76 65 72 73 61 6c | 20 6f 62 6a 65 63 74 73 |niversal| objects|
|00001330| 3a 20 74 68 65 20 69 6e | 74 65 67 65 72 20 30 20 |: the in|teger 0 |
|00001340| 28 7b 5c 62 66 20 5c 72 | 65 66 7b 67 7a 65 72 6f |({\bf \r|ef{gzero|
|00001350| 7d 7d 20 61 73 20 61 20 | 47 45 4e 2c 0a 7b 5c 74 |}} as a |GEN,.{\t|
|00001360| 74 20 5c 72 65 66 7b 7a | 65 72 6f 7d 7d 20 61 73 |t \ref{z|ero}} as|
|00001370| 20 61 20 6c 6f 6e 67 29 | 2c 20 74 68 65 20 69 6e | a long)|, the in|
|00001380| 74 65 67 65 72 20 31 20 | 28 7b 5c 62 66 20 5c 72 |teger 1 |({\bf \r|
|00001390| 65 66 7b 67 75 6e 7d 7d | 20 61 73 20 61 20 47 45 |ef{gun}}| as a GE|
|000013a0| 4e 2c 20 7b 5c 74 74 20 | 5c 72 65 66 7b 75 6e 7d |N, {\tt |\ref{un}|
|000013b0| 7d 20 61 73 20 61 20 6c | 6f 6e 67 29 2c 20 74 68 |} as a l|ong), th|
|000013c0| 65 20 69 6e 74 65 67 65 | 72 20 32 0a 28 7b 5c 62 |e intege|r 2.({\b|
|000013d0| 66 20 5c 72 65 66 7b 67 | 64 65 75 78 7d 7d 20 61 |f \ref{g|deux}} a|
|000013e0| 73 20 61 20 47 45 4e 2c | 20 7b 5c 74 74 20 5c 72 |s a GEN,| {\tt \r|
|000013f0| 65 66 7b 64 65 75 78 7d | 7d 20 61 73 20 61 20 6c |ef{deux}|} as a l|
|00001400| 6f 6e 67 29 2c 20 74 68 | 65 20 66 72 61 63 74 69 |ong), th|e fracti|
|00001410| 6f 6e 20 24 5c 64 66 72 | 61 63 20 31 20 32 24 20 |on $\dfr|ac 1 2$ |
|00001420| 28 7b 5c 62 66 20 5c 72 | 65 66 7b 67 68 61 6c 66 |({\bf \r|ef{ghalf|
|00001430| 7d 7d 20 61 73 0a 61 20 | 47 45 4e 2c 20 7b 5c 74 |}} as.a |GEN, {\t|
|00001440| 74 20 5c 72 65 66 7b 6c | 68 61 6c 66 7d 7d 20 61 |t \ref{l|half}} a|
|00001450| 73 20 61 20 6c 6f 6e 67 | 29 2c 20 74 68 65 20 63 |s a long|), the c|
|00001460| 6f 6d 70 6c 65 78 20 6e | 75 6d 62 65 72 20 24 69 |omplex n|umber $i|
|00001470| 24 2c 20 7b 5c 62 66 20 | 5c 72 65 66 7b 67 69 7d |$, {\bf |\ref{gi}|
|00001480| 7d 20 61 73 20 61 20 47 | 45 4e 2e 20 49 6e 20 61 |} as a G|EN. In a|
|00001490| 64 64 69 74 69 6f 6e 2c | 20 73 70 61 63 65 20 69 |ddition,| space i|
|000014a0| 73 20 0a 72 65 73 65 72 | 76 65 64 20 66 6f 72 20 |s .reser|ved for |
|000014b0| 74 68 65 20 70 6f 6c 79 | 6e 6f 6d 69 61 6c 73 20 |the poly|nomials |
|000014c0| 31 20 28 7b 5c 62 66 20 | 5c 72 65 66 7b 70 6f 6c |1 ({\bf |\ref{pol|
|000014d0| 75 6e 5b 5d 7d 7d 20 61 | 73 20 61 20 47 45 4e 2c |un[]}} a|s a GEN,|
|000014e0| 20 7b 5c 74 74 20 5c 72 | 65 66 7b 6c 70 6f 6c 75 | {\tt \r|ef{lpolu|
|000014f0| 6e 7d 7d 20 61 73 20 61 | 20 6c 6f 6e 67 29 2c 0a |n}} as a| long),.|
|00001500| 61 6e 64 20 74 68 65 20 | 70 6f 6c 79 6e 6f 6d 69 |and the |polynomi|
|00001510| 61 6c 73 20 24 78 5f 76 | 24 2c 20 28 7b 5c 62 66 |als $x_v|$, ({\bf|
|00001520| 20 5c 72 65 66 7b 70 6f | 6c 78 5b 5d 7d 7d 20 61 | \ref{po|lx[]}} a|
|00001530| 73 20 47 45 4e 73 2c 20 | 7b 5c 74 74 20 5c 72 65 |s GENs, |{\tt \re|
|00001540| 66 7b 6c 70 6f 6c 78 7d | 7d 20 61 73 20 6c 6f 6e |f{lpolx}|} as lon|
|00001550| 67 73 29 2c 20 77 68 65 | 72 65 0a 24 78 5f 76 24 |gs), whe|re.$x_v$|
|00001560| 20 69 73 20 74 68 65 20 | 6e 61 6d 65 20 6f 66 20 | is the |name of |
|00001570| 76 61 72 69 61 62 6c 65 | 20 6e 75 6d 62 65 72 20 |variable| number |
|00001580| 24 76 24 2c 20 77 68 65 | 72 65 20 24 30 5c 6c 65 |$v$, whe|re $0\le|
|00001590| 20 76 5c 6c 65 20 32 35 | 35 24 2e 20 48 6f 77 65 | v\le 25|5$. Howe|
|000015a0| 76 65 72 2c 20 0a 74 68 | 65 79 20 61 72 65 20 6e |ver, .th|ey are n|
|000015b0| 6f 74 20 63 72 65 61 74 | 65 64 20 75 70 6f 6e 20 |ot creat|ed upon |
|000015c0| 69 6e 69 74 69 61 6c 69 | 7a 61 74 69 6f 6e 2c 20 |initiali|zation, |
|000015d0| 61 6e 64 20 69 74 20 69 | 73 20 74 68 65 20 70 72 |and it i|s the pr|
|000015e0| 6f 67 72 61 6d 6d 65 72 | 27 73 0a 72 65 73 70 6f |ogrammer|'s.respo|
|000015f0| 6e 73 69 62 69 6c 69 74 | 79 20 74 6f 20 66 69 6c |nsibilit|y to fil|
|00001600| 6c 20 74 68 65 6d 20 62 | 65 66 6f 72 65 20 75 73 |l them b|efore us|
|00001610| 65 2e 20 53 69 6e 63 65 | 20 74 68 69 73 20 69 73 |e. Since| this is|
|00001620| 20 6e 6f 74 20 76 65 72 | 79 20 65 61 73 79 2c 20 | not ver|y easy, |
|00001630| 77 65 0a 61 64 76 69 73 | 65 20 74 68 65 20 75 73 |we.advis|e the us|
|00001640| 65 72 20 74 6f 20 75 73 | 65 20 74 68 65 20 66 75 |er to us|e the fu|
|00001650| 6e 63 74 69 6f 6e 20 7b | 5c 74 74 20 5c 72 65 66 |nction {|\tt \ref|
|00001660| 7b 6c 69 73 73 65 71 7d | 7d 20 77 68 69 63 68 20 |{lisseq}|} which |
|00001670| 68 61 73 20 65 73 73 65 | 6e 74 69 61 6c 6c 79 0a |has esse|ntially.|
|00001680| 74 68 65 20 73 61 6d 65 | 20 65 66 66 65 63 74 20 |the same| effect |
|00001690| 61 73 20 7b 5c 74 74 20 | 5c 72 65 66 7b 6c 69 73 |as {\tt |\ref{lis|
|000016a0| 65 78 70 72 7d 7d 20 65 | 78 63 65 70 74 20 74 68 |expr}} e|xcept th|
|000016b0| 61 74 20 69 74 20 63 61 | 6e 20 65 78 65 63 75 74 |at it ca|n execut|
|000016c0| 65 20 61 20 73 65 71 75 | 65 6e 63 65 20 6f 66 0a |e a sequ|ence of.|
|000016d0| 65 78 70 72 65 73 73 69 | 6f 6e 73 20 61 6e 64 20 |expressi|ons and |
|000016e0| 6e 6f 74 20 6f 6e 6c 79 | 20 61 20 73 69 6e 67 6c |not only| a singl|
|000016f0| 65 20 65 78 70 72 65 73 | 73 69 6f 6e 2e 20 46 6f |e expres|sion. Fo|
|00001700| 72 20 65 78 61 6d 70 6c | 65 2c 20 74 6f 20 70 72 |r exampl|e, to pr|
|00001710| 65 70 61 72 65 20 66 6f | 72 20 75 73 65 0a 74 68 |epare fo|r use.th|
|00001720| 65 20 76 61 72 69 61 62 | 6c 65 73 20 24 61 24 2c |e variab|les $a$,|
|00001730| 24 62 24 2c 24 63 24 2c | 24 78 24 2c 20 77 72 69 |$b$,$c$,|$x$, wri|
|00001740| 74 65 20 0a 0a 5c 63 65 | 6e 74 65 72 6c 69 6e 65 |te ..\ce|nterline|
|00001750| 7b 5c 74 74 20 6c 69 73 | 73 65 71 28 22 78 3b 61 |{\tt lis|seq("x;a|
|00001760| 3b 62 3b 63 22 29 7d 0a | 0a 4e 6f 74 65 20 74 68 |;b;c")}.|.Note th|
|00001770| 61 74 20 7b 5c 74 74 20 | 70 6f 6c 75 6e 7d 20 61 |at {\tt |polun} a|
|00001780| 6e 64 20 7b 5c 74 74 20 | 70 6f 6c 78 7d 20 61 72 |nd {\tt |polx} ar|
|00001790| 65 20 61 72 72 61 79 73 | 2c 20 74 68 65 20 69 6e |e arrays|, the in|
|000017a0| 64 65 78 20 62 65 69 6e | 67 20 74 68 65 20 0a 70 |dex bein|g the .p|
|000017b0| 6f 6c 79 6e 6f 6d 69 61 | 6c 20 76 61 72 69 61 62 |olynomia|l variab|
|000017c0| 6c 65 20 6e 75 6d 62 65 | 72 2e 0a 0a 24 5c 62 75 |le numbe|r...$\bu|
|000017d0| 6c 6c 65 74 24 20 61 20 | 6c 61 72 67 65 20 50 41 |llet$ a |large PA|
|000017e0| 52 49 20 5c 72 65 66 7b | 73 74 61 63 6b 7d 20 63 |RI \ref{|stack} c|
|000017f0| 6f 6e 74 61 69 6e 69 6e | 67 20 6e 6f 74 68 69 6e |ontainin|g nothin|
|00001800| 67 20 62 75 74 20 28 69 | 6e 20 74 68 65 20 70 72 |g but (i|n the pr|
|00001810| 65 73 65 6e 74 20 76 65 | 72 73 69 6f 6e 29 0a 74 |esent ve|rsion).t|
|00001820| 68 65 20 31 36 37 20 6c | 6f 6e 67 20 77 6f 72 64 |he 167 l|ong word|
|00001830| 73 20 28 36 36 38 20 62 | 79 74 65 73 29 20 6f 66 |s (668 b|ytes) of|
|00001840| 20 74 68 65 20 70 72 65 | 64 65 66 69 6e 65 64 20 | the pre|defined |
|00001850| 75 6e 69 76 65 72 73 61 | 6c 20 6f 62 6a 65 63 74 |universa|l object|
|00001860| 73 2e 0a 0a 24 5c 62 75 | 6c 6c 65 74 24 20 61 20 |s...$\bu|llet$ a |
|00001870| 5c 72 65 66 7b 68 65 61 | 70 7d 20 77 68 69 63 68 |\ref{hea|p} which|
|00001880| 20 69 73 20 64 65 61 6c | 74 20 77 69 74 68 20 69 | is deal|t with i|
|00001890| 6e 20 61 20 64 69 66 66 | 65 72 65 6e 74 20 77 61 |n a diff|erent wa|
|000018a0| 79 20 66 72 6f 6d 20 74 | 68 65 20 73 74 61 63 6b |y from t|he stack|
|000018b0| 2c 0a 61 6e 64 20 77 69 | 6c 6c 20 63 6f 6e 74 61 |,.and wi|ll conta|
|000018c0| 69 6e 20 6f 74 68 65 72 | 20 70 65 72 6d 61 6e 65 |in other| permane|
|000018d0| 6e 74 20 75 6e 69 76 65 | 72 73 61 6c 20 6f 62 6a |nt unive|rsal obj|
|000018e0| 65 63 74 73 2e 0a 0a 24 | 5c 62 75 6c 6c 65 74 24 |ects...$|\bullet$|
|000018f0| 20 61 20 74 61 62 6c 65 | 20 6f 66 20 70 72 69 6d | a table| of prim|
|00001900| 65 73 2e 0a 0a 24 5c 62 | 75 6c 6c 65 74 24 20 61 |es...$\b|ullet$ a|
|00001910| 63 63 65 73 73 20 74 6f | 20 61 6c 6c 20 74 68 65 |ccess to| all the|
|00001920| 20 62 75 69 6c 74 2d 69 | 6e 20 66 75 6e 63 74 69 | built-i|n functi|
|00001930| 6f 6e 73 20 6f 66 20 74 | 68 65 20 50 41 52 49 20 |ons of t|he PARI |
|00001940| 6c 69 62 72 61 72 79 2e | 0a 0a 57 65 20 68 61 76 |library.|..We hav|
|00001950| 65 20 61 6c 72 65 61 64 | 79 20 64 65 73 63 72 69 |e alread|y descri|
|00001960| 62 65 64 20 6d 61 6e 79 | 20 6f 66 20 74 68 65 73 |bed many| of thes|
|00001970| 65 20 66 75 6e 63 74 69 | 6f 6e 73 20 69 6e 20 74 |e functi|ons in t|
|00001980| 68 65 20 70 72 65 63 65 | 64 69 6e 67 20 63 68 61 |he prece|ding cha|
|00001990| 70 74 65 72 73 2e 0a 48 | 6f 77 65 76 65 72 20 73 |pters..H|owever s|
|000019a0| 6f 6d 65 20 6f 66 20 74 | 68 65 6d 20 61 72 65 20 |ome of t|hem are |
|000019b0| 73 70 65 63 69 66 69 63 | 20 74 6f 20 6c 69 62 72 |specific| to libr|
|000019c0| 61 72 79 20 6d 6f 64 65 | 20 61 6e 64 20 74 68 75 |ary mode| and thu|
|000019d0| 73 20 77 69 6c 6c 20 62 | 65 20 65 78 70 6c 61 69 |s will b|e explai|
|000019e0| 6e 65 64 0a 69 6e 20 74 | 68 69 73 20 63 68 61 70 |ned.in t|his chap|
|000019f0| 74 65 72 2e 0a 0a 5c 73 | 75 62 73 65 63 7b 49 6e |ter...\s|ubsec{In|
|00001a00| 70 75 74 20 61 6e 64 20 | 6f 75 74 70 75 74 2e 7d |put and |output.}|
|00001a10| 0a 0a 54 77 6f 20 69 6d | 70 6f 72 74 61 6e 74 20 |..Two im|portant |
|00001a20| 61 73 70 65 63 74 73 20 | 68 61 76 65 20 6e 6f 74 |aspects |have not|
|00001a30| 20 79 65 74 20 62 65 65 | 6e 20 65 78 70 6c 61 69 | yet bee|n explai|
|00001a40| 6e 65 64 20 73 69 6e 63 | 65 20 74 68 65 79 20 61 |ned sinc|e they a|
|00001a50| 72 65 20 73 70 65 63 69 | 66 69 63 0a 74 6f 20 6c |re speci|fic.to l|
|00001a60| 69 62 72 61 72 79 20 6d | 6f 64 65 3a 20 69 6e 70 |ibrary m|ode: inp|
|00001a70| 75 74 20 61 6e 64 20 6f | 75 74 70 75 74 20 6f 66 |ut and o|utput of|
|00001a80| 20 50 41 52 49 20 6f 62 | 6a 65 63 74 73 2e 0a 0a | PARI ob|jects...|
|00001a90| 46 6f 72 20 5c 72 65 66 | 7b 69 6e 70 75 74 7d 2c |For \ref|{input},|
|00001aa0| 20 50 41 52 49 20 70 72 | 6f 76 69 64 65 73 20 79 | PARI pr|ovides y|
|00001ab0| 6f 75 20 77 69 74 68 20 | 74 77 6f 20 70 6f 77 65 |ou with |two powe|
|00001ac0| 72 66 75 6c 20 68 69 67 | 68 20 6c 65 76 65 6c 20 |rful hig|h level |
|00001ad0| 66 75 6e 63 74 69 6f 6e | 73 20 77 68 69 63 68 20 |function|s which |
|00001ae0| 65 6e 61 62 6c 65 73 0a | 79 6f 75 20 74 6f 20 69 |enables.|you to i|
|00001af0| 6e 70 75 74 20 79 6f 75 | 72 20 6f 62 6a 65 63 74 |nput you|r object|
|00001b00| 73 20 61 73 20 69 66 20 | 79 6f 75 20 77 65 72 65 |s as if |you were|
|00001b10| 20 75 6e 64 65 72 20 47 | 50 2e 20 49 6e 20 66 61 | under G|P. In fa|
|00001b20| 63 74 2c 20 74 68 65 20 | 73 65 63 6f 6e 64 0a 6f |ct, the |second.o|
|00001b30| 6e 65 20 7b 5c 73 6c 20 | 69 73 20 5c 2f 7d 0a 65 |ne {\sl |is \/}.e|
|00001b40| 73 73 65 6e 74 69 61 6c | 6c 79 20 74 68 65 20 47 |ssential|ly the G|
|00001b50| 50 20 73 79 6e 74 61 63 | 74 69 63 61 6c 20 70 61 |P syntac|tical pa|
|00001b60| 72 73 65 72 2c 20 68 65 | 6e 63 65 20 79 6f 75 20 |rser, he|nce you |
|00001b70| 63 61 6e 20 75 73 65 20 | 69 74 20 6e 6f 74 20 6f |can use |it not o|
|00001b80| 6e 6c 79 20 66 6f 72 0a | 69 6e 70 75 74 20 62 75 |nly for.|input bu|
|00001b90| 74 20 66 6f 72 20 61 6e | 79 20 63 6f 6d 70 75 74 |t for an|y comput|
|00001ba0| 61 74 69 6f 6e 20 74 68 | 61 74 20 79 6f 75 20 63 |ation th|at you c|
|00001bb0| 61 6e 20 64 6f 20 75 6e | 64 65 72 20 47 50 2e 20 |an do un|der GP. |
|00001bc0| 54 68 65 73 65 20 66 75 | 6e 63 74 69 6f 6e 73 20 |These fu|nctions |
|00001bd0| 61 72 65 0a 63 61 6c 6c | 65 64 20 7b 5c 62 66 20 |are.call|ed {\bf |
|00001be0| 5c 72 65 66 7b 6c 69 73 | 65 78 70 72 7d 7d 20 61 |\ref{lis|expr}} a|
|00001bf0| 6e 64 20 7b 5c 62 66 20 | 5c 72 65 66 7b 6c 69 73 |nd {\bf |\ref{lis|
|00001c00| 73 65 71 7d 7d 2e 20 54 | 68 65 20 66 69 72 73 74 |seq}}. T|he first|
|00001c10| 20 6f 6e 65 20 68 61 73 | 20 74 68 65 20 66 6f 6c | one has| the fol|
|00001c20| 6c 6f 77 69 6e 67 20 73 | 79 6e 74 61 78 3a 0a 0a |lowing s|yntax:..|
|00001c30| 7b 5c 74 74 20 47 45 4e | 20 6c 69 73 65 78 70 72 |{\tt GEN| lisexpr|
|00001c40| 28 63 68 61 72 2a 20 73 | 29 3b 7d 0a 0a 49 74 73 |(char* s|);}..Its|
|00001c50| 20 65 66 66 65 63 74 20 | 69 73 20 74 6f 20 61 6e | effect |is to an|
|00001c60| 61 6c 79 7a 65 20 74 68 | 65 20 69 6e 70 75 74 20 |alyze th|e input |
|00001c70| 73 74 72 69 6e 67 20 73 | 20 61 6e 64 20 74 6f 20 |string s| and to |
|00001c80| 63 6f 6d 70 75 74 65 20 | 74 68 65 20 72 65 73 75 |compute |the resu|
|00001c90| 6c 74 20 61 73 20 69 6e | 20 47 50 2e 0a 48 6f 77 |lt as in| GP..How|
|00001ca0| 65 76 65 72 20 69 74 20 | 69 73 20 6c 69 6d 69 74 |ever it |is limit|
|00001cb0| 65 64 20 74 6f 20 6f 6e | 65 20 65 78 70 72 65 73 |ed to on|e expres|
|00001cc0| 73 69 6f 6e 2e 20 49 66 | 20 79 6f 75 20 77 61 6e |sion. If| you wan|
|00001cd0| 74 20 74 6f 20 72 65 61 | 64 20 61 6e 64 20 65 76 |t to rea|d and ev|
|00001ce0| 61 6c 75 61 74 65 0a 61 | 20 73 65 71 75 65 6e 63 |aluate.a| sequenc|
|00001cf0| 65 20 6f 66 20 65 78 70 | 72 65 73 73 69 6f 6e 73 |e of exp|ressions|
|00001d00| 2c 20 75 73 65 0a 0a 7b | 5c 74 74 20 47 45 4e 20 |, use..{|\tt GEN |
|00001d10| 6c 69 73 73 65 71 28 63 | 68 61 72 2a 20 73 29 3b |lisseq(c|har* s);|
|00001d20| 7d 0a 0a 57 61 72 6e 69 | 6e 67 3a 20 74 68 65 72 |}..Warni|ng: ther|
|00001d30| 65 20 69 73 20 61 20 73 | 6c 69 67 68 74 20 64 69 |e is a s|light di|
|00001d40| 66 66 65 72 65 6e 63 65 | 20 62 65 74 77 65 65 6e |fference| between|
|00001d50| 20 74 68 65 73 65 20 66 | 75 6e 63 74 69 6f 6e 73 | these f|unctions|
|00001d60| 20 61 6e 64 20 74 68 65 | 20 47 50 0a 73 79 6e 74 | and the| GP.synt|
|00001d70| 61 63 74 69 63 61 6c 20 | 70 61 72 73 65 72 3a 20 |actical |parser: |
|00001d80| 74 68 65 20 65 78 70 72 | 65 73 73 69 6f 6e 73 20 |the expr|essions |
|00001d90| 61 6e 64 20 73 65 71 75 | 65 6e 63 65 73 20 77 68 |and sequ|ences wh|
|00001da0| 69 63 68 20 79 6f 75 20 | 75 73 65 20 6d 75 73 74 |ich you |use must|
|00001db0| 20 6e 6f 74 0a 63 6f 6e | 74 61 69 6e 20 61 6e 79 | not.con|tain any|
|00001dc0| 20 73 70 61 63 65 73 2e | 0a 0a 4f 6e 63 65 20 69 | spaces.|..Once i|
|00001dd0| 6e 20 61 20 77 68 69 6c | 65 2c 20 69 74 20 6d 61 |n a whil|e, it ma|
|00001de0| 79 20 62 65 20 75 73 65 | 66 75 6c 20 74 6f 20 68 |y be use|ful to h|
|00001df0| 61 76 65 20 74 68 65 20 | 65 76 61 6c 75 61 74 69 |ave the |evaluati|
|00001e00| 6f 6e 20 6f 66 20 74 68 | 65 20 73 74 72 69 6e 67 |on of th|e string|
|00001e10| 0a 69 6e 76 6f 6c 76 69 | 6e 67 0a 61 20 63 61 6c |.involvi|ng.a cal|
|00001e20| 6c 20 74 6f 20 61 20 66 | 75 6e 63 74 69 6f 6e 20 |l to a f|unction |
|00001e30| 79 6f 75 20 68 61 76 65 | 20 64 65 66 69 6e 65 64 |you have| defined|
|00001e40| 20 69 6e 20 43 2e 20 54 | 68 65 20 66 75 6e 63 74 | in C. T|he funct|
|00001e50| 69 6f 6e 20 7b 5c 62 66 | 20 5c 72 65 66 7b 69 6e |ion {\bf| \ref{in|
|00001e60| 73 74 61 6c 6c 7d 7d 0a | 61 6c 6c 6f 77 73 20 79 |stall}}.|allows y|
|00001e70| 6f 75 20 74 6f 20 67 69 | 76 65 20 61 20 6e 61 6d |ou to gi|ve a nam|
|00001e80| 65 20 74 6f 20 61 20 66 | 75 6e 63 74 69 6f 6e 20 |e to a f|unction |
|00001e90| 74 61 6b 69 6e 67 20 30 | 2c 20 31 2c 20 32 20 6f |taking 0|, 1, 2 o|
|00001ea0| 72 20 33 20 47 45 4e 20 | 61 72 67 75 6d 65 6e 74 |r 3 GEN |argument|
|00001eb0| 73 20 61 6e 64 0a 72 65 | 74 75 72 6e 69 6e 67 20 |s and.re|turning |
|00001ec0| 61 0a 73 69 6e 67 6c 65 | 20 47 45 4e 2e 20 54 68 |a.single| GEN. Th|
|00001ed0| 65 20 73 79 6e 74 61 78 | 20 69 73 20 0a 0a 7b 5c |e syntax| is ..{\|
|00001ee0| 74 74 20 76 6f 69 64 20 | 69 6e 73 74 61 6c 6c 28 |tt void |install(|
|00001ef0| 47 45 4e 20 28 2a 66 29 | 28 29 2c 20 63 68 61 72 |GEN (*f)|(), char|
|00001f00| 20 2a 6e 61 6d 65 2c 20 | 69 6e 74 20 76 61 6c 65 | *name, |int vale|
|00001f10| 6e 63 65 29 7d 0a 0a 77 | 68 65 72 65 20 7b 5c 74 |nce)}..w|here {\t|
|00001f20| 74 20 66 7d 20 69 73 20 | 74 68 65 20 28 61 64 64 |t f} is |the (add|
|00001f30| 72 65 73 73 20 6f 66 29 | 20 74 68 65 20 66 75 6e |ress of)| the fun|
|00001f40| 63 74 69 6f 6e 2c 20 7b | 5c 74 74 20 6e 61 6d 65 |ction, {|\tt name|
|00001f50| 7d 20 69 74 73 20 6e 65 | 77 20 6e 61 6d 65 2c 20 |} its ne|w name, |
|00001f60| 61 6e 64 0a 7b 5c 74 74 | 20 76 61 6c 65 6e 63 65 |and.{\tt| valence|
|00001f70| 7d 20 74 68 65 20 6e 75 | 6d 62 65 72 20 6f 66 20 |} the nu|mber of |
|00001f80| 69 74 73 20 61 72 67 75 | 6d 65 6e 74 73 2c 20 61 |its argu|ments, a|
|00001f90| 6e 20 69 6e 74 65 67 65 | 72 20 62 65 74 77 65 65 |n intege|r betwee|
|00001fa0| 6e 20 30 20 61 6e 64 20 | 33 2e 0a 0a 46 6f 72 20 |n 0 and |3...For |
|00001fb0| 5c 72 65 66 7b 6f 75 74 | 70 75 74 7d 2c 20 74 68 |\ref{out|put}, th|
|00001fc0| 65 72 65 20 65 78 69 73 | 74 20 66 6f 75 72 20 64 |ere exis|t four d|
|00001fd0| 69 66 66 65 72 65 6e 74 | 20 66 75 6e 63 74 69 6f |ifferent| functio|
|00001fe0| 6e 73 2e 20 46 69 72 73 | 74 2c 20 79 6f 75 20 63 |ns. Firs|t, you c|
|00001ff0| 61 6e 0a 75 73 65 20 74 | 68 65 20 66 75 6e 63 74 |an.use t|he funct|
|00002000| 69 6f 6e 20 7b 5c 62 66 | 20 5c 72 65 66 7b 73 6f |ion {\bf| \ref{so|
|00002010| 72 7d 7d 20 77 69 74 68 | 20 74 68 65 20 66 6f 6c |r}} with| the fol|
|00002020| 6c 6f 77 69 6e 67 20 73 | 79 6e 74 61 78 3a 0a 0a |lowing s|yntax:..|
|00002030| 7b 5c 74 74 20 76 6f 69 | 64 20 73 6f 72 28 47 45 |{\tt voi|d sor(GE|
|00002040| 4e 20 78 2c 63 68 61 72 | 20 66 6f 72 6d 61 74 2c |N x,char| format,|
|00002050| 6c 6f 6e 67 20 64 65 63 | 2c 6c 6f 6e 67 20 66 69 |long dec|,long fi|
|00002060| 65 6c 64 29 3b 7d 0a 0a | 48 65 72 65 20 66 6f 72 |eld);}..|Here for|
|00002070| 6d 61 74 20 69 73 20 65 | 69 74 68 65 72 20 7b 5c |mat is e|ither {\|
|00002080| 74 74 20 27 65 27 7d 2c | 20 7b 5c 74 74 20 27 66 |tt 'e'},| {\tt 'f|
|00002090| 27 7d 20 6f 72 20 7b 5c | 74 74 20 27 67 27 7d 20 |'} or {\|tt 'g'} |
|000020a0| 63 6f 72 72 65 73 70 6f | 6e 64 69 6e 67 20 74 6f |correspo|nding to|
|000020b0| 0a 74 68 65 20 74 68 72 | 65 65 20 6f 75 74 70 75 |.the thr|ee outpu|
|000020c0| 74 20 66 6f 72 6d 61 74 | 73 20 6f 66 20 47 50 2c |t format|s of GP,|
|000020d0| 20 7b 5c 74 74 20 64 65 | 63 7d 20 69 73 20 74 68 | {\tt de|c} is th|
|000020e0| 65 20 6e 75 6d 62 65 72 | 20 6f 66 20 70 72 69 6e |e number| of prin|
|000020f0| 74 65 64 20 73 69 67 6e | 69 66 69 63 61 6e 74 0a |ted sign|ificant.|
|00002100| 64 69 67 69 74 73 20 66 | 6f 72 20 72 65 61 6c 20 |digits f|or real |
|00002110| 6e 75 6d 62 65 72 73 2c | 20 61 6e 64 20 73 68 6f |numbers,| and sho|
|00002120| 75 6c 64 20 62 65 20 70 | 75 74 20 65 71 75 61 6c |uld be p|ut equal|
|00002130| 20 74 6f 20 2d 31 20 69 | 66 20 61 6c 6c 20 6f 66 | to -1 i|f all of|
|00002140| 20 74 68 65 6d 20 61 72 | 65 0a 77 61 6e 74 65 64 | them ar|e.wanted|
|00002150| 2c 20 61 6e 64 20 7b 5c | 74 74 20 66 69 65 6c 64 |, and {\|tt field|
|00002160| 7d 20 63 6f 72 72 65 73 | 70 6f 6e 64 73 20 74 6f |} corres|ponds to|
|00002170| 20 74 68 65 20 66 69 65 | 6c 64 20 77 69 64 74 68 | the fie|ld width|
|00002180| 20 6f 66 20 47 50 20 75 | 73 65 64 20 66 6f 72 20 | of GP u|sed for |
|00002190| 70 72 69 6e 74 69 6e 67 | 0a 69 6e 74 65 67 65 72 |printing|.integer|
|000021a0| 73 2e 0a 0a 41 20 64 65 | 66 61 75 6c 74 20 75 73 |s...A de|fault us|
|000021b0| 65 20 6f 66 20 74 68 69 | 73 20 66 75 6e 63 74 69 |e of thi|s functi|
|000021c0| 6f 6e 20 69 73 20 74 6f | 20 75 73 65 20 74 68 65 |on is to| use the|
|000021d0| 20 6d 61 63 72 6f 20 7b | 5c 74 74 20 5c 72 65 66 | macro {|\tt \ref|
|000021e0| 7b 6f 75 74 62 65 61 75 | 74 7d 28 47 45 4e 20 78 |{outbeau|t}(GEN x|
|000021f0| 29 7d 20 77 68 69 63 68 | 20 69 73 0a 65 71 75 69 |)} which| is.equi|
|00002200| 76 61 6c 65 6e 74 20 74 | 6f 20 7b 5c 74 74 20 73 |valent t|o {\tt s|
|00002210| 6f 72 28 78 2c 27 67 27 | 2c 2d 31 2c 30 29 7d 2e |or(x,'g'|,-1,0)}.|
|00002220| 0a 0a 54 68 65 20 73 65 | 63 6f 6e 64 20 66 6f 72 |..The se|cond for|
|00002230| 6d 61 74 20 63 6f 72 72 | 65 73 70 6f 6e 64 73 20 |mat corr|esponds |
|00002240| 74 6f 20 74 68 65 20 60 | 60 72 61 77 27 27 20 66 |to the `|`raw'' f|
|00002250| 6f 72 6d 61 74 20 6f 66 | 20 47 50 20 28 73 65 65 |ormat of| GP (see|
|00002260| 20 73 65 63 74 69 6f 6e | 20 32 2e 32 2e 35 29 0a | section| 2.2.5).|
|00002270| 61 6e 64 20 69 73 20 6f | 62 74 61 69 6e 65 64 20 |and is o|btained |
|00002280| 62 79 20 75 73 69 6e 67 | 20 74 68 65 20 66 75 6e |by using| the fun|
|00002290| 63 74 69 6f 6e 20 7b 5c | 62 66 20 5c 72 65 66 7b |ction {\|bf \ref{|
|000022a0| 62 72 75 74 65 7d 7d 20 | 77 69 74 68 20 74 68 65 |brute}} |with the|
|000022b0| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 73 79 6e 74 61 | followi|ng synta|
|000022c0| 78 3a 0a 0a 7b 5c 74 74 | 20 76 6f 69 64 20 62 72 |x:..{\tt| void br|
|000022d0| 75 74 65 28 47 45 4e 20 | 78 2c 63 68 61 72 20 66 |ute(GEN |x,char f|
|000022e0| 6f 72 6d 61 74 2c 6c 6f | 6e 67 20 64 65 63 29 3b |ormat,lo|ng dec);|
|000022f0| 7d 0a 0a 41 20 64 65 66 | 61 75 6c 74 20 75 73 65 |}..A def|ault use|
|00002300| 20 6f 66 20 74 68 69 73 | 20 66 75 6e 63 74 69 6f | of this| functio|
|00002310| 6e 20 69 73 20 74 6f 20 | 75 73 65 20 74 68 65 20 |n is to |use the |
|00002320| 6d 61 63 72 6f 20 7b 5c | 74 74 20 5c 72 65 66 7b |macro {\|tt \ref{|
|00002330| 6f 75 74 70 75 74 7d 28 | 47 45 4e 20 78 29 7d 20 |output}(|GEN x)} |
|00002340| 77 68 69 63 68 0a 69 73 | 20 65 71 75 69 76 61 6c |which.is| equival|
|00002350| 65 6e 74 20 74 6f 20 7b | 5c 74 74 20 62 72 75 74 |ent to {|\tt brut|
|00002360| 65 28 78 2c 27 67 27 2c | 2d 31 29 7d 2e 0a 0a 54 |e(x,'g',|-1)}...T|
|00002370| 68 65 20 74 68 69 72 64 | 20 66 6f 72 6d 61 74 20 |he third| format |
|00002380| 63 6f 72 72 65 73 70 6f | 6e 64 73 20 74 6f 20 74 |correspo|nds to t|
|00002390| 68 65 20 7b 5c 74 74 20 | 74 65 78 70 72 69 6e 74 |he {\tt |texprint|
|000023a0| 7d 20 66 75 6e 63 74 69 | 6f 6e 20 6f 66 20 47 50 |} functi|on of GP|
|000023b0| 2c 20 61 6e 64 20 67 69 | 76 65 73 0a 61 20 5c 54 |, and gi|ves.a \T|
|000023c0| 65 58 7b 7d 20 6f 75 74 | 70 75 74 20 6f 66 20 74 |eX{} out|put of t|
|000023d0| 68 65 20 72 65 73 75 6c | 74 2e 20 49 74 20 69 73 |he resul|t. It is|
|000023e0| 20 6f 62 74 61 69 6e 65 | 64 20 62 79 20 75 73 69 | obtaine|d by usi|
|000023f0| 6e 67 20 74 68 65 20 66 | 75 6e 63 74 69 6f 6e 0a |ng the f|unction.|
|00002400| 7b 5c 62 66 20 74 65 78 | 65 7d 20 77 69 74 68 20 |{\bf tex|e} with |
|00002410| 74 68 65 20 66 6f 6c 6c | 6f 77 69 6e 67 20 73 79 |the foll|owing sy|
|00002420| 6e 74 61 78 3a 0a 0a 7b | 5c 74 74 20 76 6f 69 64 |ntax:..{|\tt void|
|00002430| 20 5c 72 65 66 7b 74 65 | 78 65 7d 28 47 45 4e 20 | \ref{te|xe}(GEN |
|00002440| 78 2c 63 68 61 72 20 66 | 6f 72 6d 61 74 2c 6c 6f |x,char f|ormat,lo|
|00002450| 6e 67 20 64 65 63 29 3b | 7d 0a 0a 46 69 6e 61 6c |ng dec);|}..Final|
|00002460| 6c 79 2c 20 79 6f 75 20 | 63 61 6e 20 75 73 65 20 |ly, you |can use |
|00002470| 74 68 65 20 5c 72 65 66 | 7b 68 65 78 61 64 65 63 |the \ref|{hexadec|
|00002480| 69 6d 61 6c 20 74 72 65 | 65 20 6f 75 74 70 75 74 |imal tre|e output|
|00002490| 7d 20 63 6f 72 72 65 73 | 70 6f 6e 64 69 6e 67 20 |} corres|ponding |
|000024a0| 74 6f 20 74 68 65 20 47 | 50 0a 63 6f 6d 6d 61 6e |to the G|P.comman|
|000024b0| 64 20 24 5c 62 61 63 6b | 73 6c 61 73 68 24 78 20 |d $\back|slash$x |
|000024c0| 75 73 69 6e 67 20 74 68 | 65 20 66 75 6e 63 74 69 |using th|e functi|
|000024d0| 6f 6e 20 7b 5c 62 66 20 | 5c 72 65 66 7b 76 6f 69 |on {\bf |\ref{voi|
|000024e0| 72 7d 7d 20 77 69 74 68 | 20 74 68 65 20 66 6f 6c |r}} with| the fol|
|000024f0| 6c 6f 77 69 6e 67 20 73 | 79 6e 74 61 78 3a 0a 0a |lowing s|yntax:..|
|00002500| 7b 5c 74 74 20 76 6f 69 | 64 20 76 6f 69 72 28 47 |{\tt voi|d voir(G|
|00002510| 45 4e 20 78 2c 2d 31 29 | 3b 7d 0a 0a 41 67 61 69 |EN x,-1)|;}..Agai|
|00002520| 6e 20 74 68 65 20 6c 61 | 73 74 20 70 61 72 61 6d |n the la|st param|
|00002530| 65 74 65 72 20 6d 75 73 | 74 20 62 65 20 67 69 76 |eter mus|t be giv|
|00002540| 65 6e 20 61 6e 64 20 70 | 75 74 20 65 71 75 61 6c |en and p|ut equal|
|00002550| 20 74 6f 20 2d 31 2e 20 | 49 6e 20 70 72 69 6e 63 | to -1. |In princ|
|00002560| 69 70 6c 65 20 74 68 69 | 73 0a 6c 61 73 74 20 74 |iple thi|s.last t|
|00002570| 79 70 65 20 6f 66 20 6f | 75 74 70 75 74 20 69 73 |ype of o|utput is|
|00002580| 20 75 73 65 64 20 6f 6e | 6c 79 20 66 6f 72 20 64 | used on|ly for d|
|00002590| 65 62 75 67 67 69 6e 67 | 20 70 75 72 70 6f 73 65 |ebugging| purpose|
|000025a0| 73 2e 0a 0a 5c 73 65 63 | 74 69 6f 6e 7b 43 72 65 |s...\sec|tion{Cre|
|000025b0| 61 74 69 6f 6e 2c 20 64 | 65 73 74 72 75 63 74 69 |ation, d|estructi|
|000025c0| 6f 6e 2c 20 61 6e 64 20 | 69 6d 70 6c 65 6d 65 6e |on, and |implemen|
|000025d0| 74 61 74 69 6f 6e 20 6f | 66 20 74 68 65 20 50 41 |tation o|f the PA|
|000025e0| 52 49 20 6f 62 6a 65 63 | 74 73 2e 7d 0a 0a 42 79 |RI objec|ts.}..By|
|000025f0| 20 66 61 72 20 74 68 65 | 20 6d 6f 73 74 20 69 6d | far the| most im|
|00002600| 70 6f 72 74 61 6e 74 20 | 66 75 6e 63 74 69 6f 6e |portant |function|
|00002610| 73 20 77 68 69 63 68 20 | 61 72 65 20 73 70 65 63 |s which |are spec|
|00002620| 69 66 69 63 20 74 6f 20 | 74 68 65 20 6c 69 62 72 |ific to |the libr|
|00002630| 61 72 79 20 6d 6f 64 65 | 0a 61 72 65 20 74 68 65 |ary mode|.are the|
|00002640| 20 66 75 6e 63 74 69 6f | 6e 73 20 77 68 69 63 68 | functio|ns which|
|00002650| 20 61 6c 6c 6f 77 20 74 | 68 65 20 70 72 6f 67 72 | allow t|he progr|
|00002660| 61 6d 6d 65 72 20 74 6f | 20 63 72 65 61 74 65 20 |ammer to| create |
|00002670| 61 6e 64 20 64 65 6c 65 | 74 65 20 50 41 52 49 20 |and dele|te PARI |
|00002680| 6f 62 6a 65 63 74 73 2c | 0a 61 6e 64 20 74 68 65 |objects,|.and the|
|00002690| 20 61 73 73 69 67 6e 6d | 65 6e 74 20 73 74 61 74 | assignm|ent stat|
|000026a0| 65 6d 65 6e 74 73 2e 0a | 0a 5c 73 75 62 73 65 63 |ements..|.\subsec|
|000026b0| 7b 43 72 65 61 74 69 6f | 6e 20 6f 66 20 50 41 52 |{Creatio|n of PAR|
|000026c0| 49 20 6f 62 6a 65 63 74 | 73 2e 7d 5c 73 72 65 66 |I object|s.}\sref|
|000026d0| 7b 63 72 65 61 74 69 6f | 6e 7d 0a 54 68 65 20 62 |{creatio|n}.The b|
|000026e0| 61 73 69 63 20 66 75 6e | 63 74 69 6f 6e 20 77 68 |asic fun|ction wh|
|000026f0| 69 63 68 20 63 72 65 61 | 74 65 73 20 61 20 50 41 |ich crea|tes a PA|
|00002700| 52 49 20 6f 62 6a 65 63 | 74 20 69 73 20 74 68 65 |RI objec|t is the|
|00002710| 20 66 75 6e 63 74 69 6f | 6e 0a 7b 5c 62 66 20 5c | functio|n.{\bf \|
|00002720| 72 65 66 7b 63 67 65 74 | 67 7d 7d 20 77 68 6f 73 |ref{cget|g}} whos|
|00002730| 65 20 73 79 6e 74 61 78 | 20 69 73 3a 0a 0a 20 7b |e syntax| is:.. {|
|00002740| 5c 74 74 20 63 67 65 74 | 67 28 6c 6f 6e 67 20 6c |\tt cget|g(long l|
|00002750| 65 6e 67 74 68 2c 6c 6f | 6e 67 20 74 79 70 65 29 |ength,lo|ng type)|
|00002760| 3b 7d 0a 0a 48 65 72 65 | 20 6c 65 6e 67 74 68 20 |;}..Here| length |
|00002770| 69 73 20 61 20 6c 6f 6e | 67 20 73 70 65 63 69 66 |is a lon|g specif|
|00002780| 79 69 6e 67 20 74 68 65 | 20 6e 75 6d 62 65 72 20 |ying the| number |
|00002790| 6f 66 20 6c 6f 6e 67 77 | 6f 72 64 73 20 74 6f 20 |of longw|ords to |
|000027a0| 62 65 20 61 6c 6c 6f 63 | 61 74 65 64 20 74 6f 0a |be alloc|ated to.|
|000027b0| 74 68 65 20 6f 62 6a 65 | 63 74 2c 20 61 6e 64 20 |the obje|ct, and |
|000027c0| 74 79 70 65 20 69 73 20 | 61 20 6c 6f 6e 67 20 77 |type is |a long w|
|000027d0| 68 69 63 68 20 69 73 20 | 74 68 65 20 74 79 70 65 |hich is |the type|
|000027e0| 20 6e 75 6d 62 65 72 20 | 6f 66 20 74 68 65 20 6f | number |of the o|
|000027f0| 62 6a 65 63 74 0a 28 73 | 65 65 20 63 68 61 70 74 |bject.(s|ee chapt|
|00002800| 65 72 20 31 20 6f 72 20 | 62 65 6c 6f 77 20 66 6f |er 1 or |below fo|
|00002810| 72 20 74 68 65 20 6c 69 | 73 74 20 6f 66 20 74 68 |r the li|st of th|
|00002820| 65 73 65 0a 74 79 70 65 | 20 6e 75 6d 62 65 72 73 |ese.type| numbers|
|00002830| 29 2e 20 4e 6f 74 65 20 | 74 68 61 74 20 74 68 65 |). Note |that the|
|00002840| 20 6c 65 6e 67 74 68 20 | 69 73 20 74 68 65 20 66 | length |is the f|
|00002850| 69 72 73 74 20 61 72 67 | 75 6d 65 6e 74 2c 20 61 |irst arg|ument, a|
|00002860| 6e 64 20 74 79 70 65 20 | 74 68 65 20 73 65 63 6f |nd type |the seco|
|00002870| 6e 64 2e 0a 54 68 65 20 | 70 72 65 63 69 73 65 20 |nd..The |precise |
|00002880| 65 66 66 65 63 74 20 6f | 66 20 74 68 69 73 20 66 |effect o|f this f|
|00002890| 75 6e 63 74 69 6f 6e 20 | 69 73 20 61 73 20 66 6f |unction |is as fo|
|000028a0| 6c 6c 6f 77 73 3a 20 69 | 74 20 66 69 72 73 74 20 |llows: i|t first |
|000028b0| 63 72 65 61 74 65 73 20 | 6f 6e 20 74 68 65 20 73 |creates |on the s|
|000028c0| 74 61 63 6b 0a 61 20 63 | 68 75 6e 6b 20 6f 66 20 |tack.a c|hunk of |
|000028d0| 6d 65 6d 6f 72 79 20 6f | 66 20 73 69 7a 65 20 60 |memory o|f size `|
|000028e0| 60 6c 65 6e 67 74 68 27 | 27 20 6c 6f 6e 67 77 6f |`length'|' longwo|
|000028f0| 72 64 73 2c 20 61 6e 64 | 20 70 75 74 73 20 74 68 |rds, and| puts th|
|00002900| 65 20 61 64 64 72 65 73 | 73 20 6f 66 20 74 68 65 |e addres|s of the|
|00002910| 20 63 68 75 6e 6b 0a 61 | 73 20 74 68 65 20 72 65 | chunk.a|s the re|
|00002920| 74 75 72 6e 65 64 20 76 | 61 6c 75 65 2e 0a 49 66 |turned v|alue..If|
|00002930| 20 6e 6f 74 20 65 6e 6f | 75 67 68 20 6d 65 6d 6f | not eno|ugh memo|
|00002940| 72 79 20 69 73 20 61 76 | 61 69 6c 61 62 6c 65 2c |ry is av|ailable,|
|00002950| 20 61 20 6d 65 73 73 61 | 67 65 20 74 6f 20 74 68 | a messa|ge to th|
|00002960| 65 20 65 66 66 65 63 74 | 20 74 68 61 74 20 74 68 |e effect| that th|
|00002970| 65 20 50 41 52 49 20 73 | 74 61 63 6b 0a 6f 76 65 |e PARI s|tack.ove|
|00002980| 72 66 6c 6f 77 73 20 77 | 69 6c 6c 20 62 65 20 70 |rflows w|ill be p|
|00002990| 72 69 6e 74 65 64 2e 20 | 4f 74 68 65 72 77 69 73 |rinted. |Otherwis|
|000029a0| 65 2c 20 69 74 20 73 65 | 74 73 20 74 68 65 20 74 |e, it se|ts the t|
|000029b0| 79 70 65 20 6f 66 20 74 | 68 65 20 63 68 75 6e 6b |ype of t|he chunk|
|000029c0| 20 74 6f 20 60 60 74 79 | 70 65 27 27 2c 0a 73 65 | to ``ty|pe'',.se|
|000029d0| 74 73 20 74 68 65 20 6c | 65 6e 67 74 68 2c 20 61 |ts the l|ength, a|
|000029e0| 6e 64 20 73 65 74 73 20 | 74 68 65 20 72 65 66 65 |nd sets |the refe|
|000029f0| 72 65 6e 63 65 20 63 6f | 75 6e 74 20 74 6f 20 31 |rence co|unt to 1|
|00002a00| 2e 20 49 6e 20 65 66 66 | 65 63 74 2c 20 69 74 20 |. In eff|ect, it |
|00002a10| 66 69 6c 6c 73 0a 63 6f | 72 72 65 63 74 6c 79 20 |fills.co|rrectly |
|00002a20| 61 6e 64 20 63 6f 6d 70 | 6c 65 74 65 6c 79 20 74 |and comp|letely t|
|00002a30| 68 65 20 66 69 72 73 74 | 20 63 6f 64 65 77 6f 72 |he first| codewor|
|00002a40| 64 20 28 7a 5b 30 5d 20 | 6f 72 20 2a 7a 29 20 6f |d (z[0] |or *z) o|
|00002a50| 66 20 74 68 65 20 50 41 | 52 49 20 6f 62 6a 65 63 |f the PA|RI objec|
|00002a60| 74 2e 0a 4d 61 6e 79 20 | 50 41 52 49 20 6f 62 6a |t..Many |PARI obj|
|00002a70| 65 63 74 73 20 68 61 76 | 69 6e 67 20 61 6c 73 6f |ects hav|ing also|
|00002a80| 20 61 20 73 65 63 6f 6e | 64 20 63 6f 64 65 77 6f | a secon|d codewo|
|00002a90| 72 64 20 28 74 79 70 65 | 73 20 31 2c 32 2c 37 2c |rd (type|s 1,2,7,|
|00002aa0| 31 30 2c 31 31 29 2c 0a | 7b 5c 69 74 20 69 74 20 |10,11),.|{\it it |
|00002ab0| 69 73 20 74 68 65 20 70 | 72 6f 67 72 61 6d 6d 65 |is the p|rogramme|
|00002ac0| 72 27 73 20 72 65 73 70 | 6f 6e 73 69 62 69 6c 69 |r's resp|onsibili|
|00002ad0| 74 79 20 74 6f 20 66 69 | 6c 6c 20 74 68 69 73 20 |ty to fi|ll this |
|00002ae0| 73 65 63 6f 6e 64 20 63 | 6f 64 65 77 6f 72 64 5c |second c|odeword\|
|00002af0| 2f 7d 2c 0a 65 69 74 68 | 65 72 20 65 78 70 6c 69 |/},.eith|er expli|
|00002b00| 63 69 74 6c 79 20 28 73 | 65 65 20 62 65 6c 6f 77 |citly (s|ee below|
|00002b10| 29 2c 20 6f 72 20 69 6d | 70 6c 69 63 69 74 6c 79 |), or im|plicitly|
|00002b20| 20 75 73 69 6e 67 20 61 | 6e 20 61 73 73 69 67 6e | using a|n assign|
|00002b30| 6d 65 6e 74 20 73 74 61 | 74 65 6d 65 6e 74 2e 0a |ment sta|tement..|
|00002b40| 0a 4e 6f 74 65 20 74 68 | 61 74 20 74 68 65 20 61 |.Note th|at the a|
|00002b50| 72 67 75 6d 65 6e 74 20 | 60 60 6c 65 6e 67 74 68 |rgument |``length|
|00002b60| 27 27 20 69 73 20 66 6f | 72 63 65 64 20 66 6f 72 |'' is fo|rced for|
|00002b70| 20 61 20 6e 75 6d 62 65 | 72 20 6f 66 20 74 79 70 | a numbe|r of typ|
|00002b80| 65 73 3a 0a 33 20 66 6f | 72 20 74 79 70 65 73 20 |es:.3 fo|r types |
|00002b90| 33 2c 34 2c 35 2c 36 2c | 39 2c 31 33 2c 31 34 20 |3,4,5,6,|9,13,14 |
|00002ba0| 61 6e 64 20 31 36 2c 20 | 34 20 66 6f 72 20 74 79 |and 16, |4 for ty|
|00002bb0| 70 65 20 38 20 28 51 75 | 61 64 29 2c 20 61 6e 64 |pe 8 (Qu|ad), and|
|00002bc0| 20 35 20 66 6f 72 20 74 | 79 70 65 20 37 20 28 24 | 5 for t|ype 7 ($|
|00002bd0| 70 24 2d 61 64 69 63 29 | 2e 0a 48 6f 77 65 76 65 |p$-adic)|..Howeve|
|00002be0| 72 20 66 6f 72 20 65 66 | 66 69 63 69 65 6e 63 79 |r for ef|ficiency|
|00002bf0| 27 73 20 73 61 6b 65 20 | 6e 6f 20 63 68 65 63 6b |'s sake |no check|
|00002c00| 69 6e 67 20 69 73 20 6d | 61 64 65 20 69 6e 20 74 |ing is m|ade in t|
|00002c10| 68 65 20 66 75 6e 63 74 | 69 6f 6e 20 7b 5c 74 74 |he funct|ion {\tt|
|00002c20| 20 63 67 65 74 67 7d 20 | 73 6f 0a 64 69 73 61 73 | cgetg} |so.disas|
|00002c30| 74 72 6f 75 73 20 72 65 | 73 75 6c 74 73 20 63 61 |trous re|sults ca|
|00002c40| 6e 20 6f 63 63 75 72 20 | 69 66 20 79 6f 75 20 67 |n occur |if you g|
|00002c50| 69 76 65 20 61 6e 20 69 | 6e 63 6f 72 72 65 63 74 |ive an i|ncorrect|
|00002c60| 20 6c 65 6e 67 74 68 2e | 0a 0a 4e 6f 74 65 73 3a | length.|..Notes:|
|00002c70| 20 31 29 20 74 68 65 20 | 63 72 65 61 74 69 6f 6e | 1) the |creation|
|00002c80| 20 6f 66 20 6c 65 61 76 | 65 73 2c 20 69 2e 65 2e | of leav|es, i.e.|
|00002c90| 20 69 6e 74 65 67 65 72 | 73 20 6f 72 20 72 65 61 | integer|s or rea|
|00002ca0| 6c 73 2c 20 62 65 69 6e | 67 20 73 6f 20 63 6f 6d |ls, bein|g so com|
|00002cb0| 6d 6f 6e 2c 0a 7b 5c 62 | 66 20 5c 72 65 66 7b 63 |mon,.{\b|f \ref{c|
|00002cc0| 67 65 74 69 7d 7d 20 61 | 6e 64 20 7b 5c 62 66 20 |geti}} a|nd {\bf |
|00002cd0| 5c 72 65 66 7b 63 67 65 | 74 72 7d 7d 20 73 68 6f |\ref{cge|tr}} sho|
|00002ce0| 75 6c 64 20 62 65 20 75 | 73 65 64 20 69 6e 73 74 |uld be u|sed inst|
|00002cf0| 65 61 64 20 6f 66 20 0a | 7b 5c 74 74 20 63 67 65 |ead of .|{\tt cge|
|00002d00| 74 67 28 20 2c 31 29 7d | 20 61 6e 64 20 7b 5c 74 |tg( ,1)}| and {\t|
|00002d10| 74 20 63 67 65 74 67 28 | 20 2c 32 29 7d 2e 0a 0a |t cgetg(| ,2)}...|
|00002d20| 32 29 20 74 68 65 20 6d | 61 63 72 6f 73 20 7b 5c |2) the m|acros {\|
|00002d30| 74 74 20 5c 72 65 66 7b | 6c 67 65 74 67 7d 7d 2c |tt \ref{|lgetg}},|
|00002d40| 20 7b 5c 74 74 20 5c 72 | 65 66 7b 6c 67 65 74 69 | {\tt \r|ef{lgeti|
|00002d50| 7d 7d 20 61 6e 64 20 7b | 5c 74 74 20 5c 72 65 66 |}} and {|\tt \ref|
|00002d60| 7b 6c 67 65 74 72 7d 7d | 20 61 72 65 20 70 72 65 |{lgetr}}| are pre|
|00002d70| 64 65 66 69 6e 65 64 20 | 61 73 0a 7b 5c 74 74 20 |defined |as.{\tt |
|00002d80| 28 6c 6f 6e 67 29 63 67 | 65 74 67 7d 2c 20 7b 5c |(long)cg|etg}, {\|
|00002d90| 74 74 20 28 6c 6f 6e 67 | 29 63 67 65 74 69 7d 20 |tt (long|)cgeti} |
|00002da0| 61 6e 64 20 7b 5c 74 74 | 20 28 6c 6f 6e 67 29 63 |and {\tt| (long)c|
|00002db0| 67 65 74 72 7d 20 72 65 | 73 70 65 63 74 69 76 65 |getr} re|spective|
|00002dc0| 6c 79 2e 0a 0a 45 78 61 | 6d 70 6c 65 73 3a 0a 0a |ly...Exa|mples:..|
|00002dd0| 7b 5c 74 74 20 7a 20 3d | 20 63 67 65 74 69 28 36 |{\tt z =| cgeti(6|
|00002de0| 29 3b 7d 20 28 6f 72 20 | 7b 5c 74 74 20 63 67 65 |);} (or |{\tt cge|
|00002df0| 74 67 28 36 2c 20 31 29 | 3b 7d 29 20 63 72 65 61 |tg(6, 1)|;}) crea|
|00002e00| 74 65 73 20 61 6e 20 69 | 6e 74 65 67 65 72 20 74 |tes an i|nteger t|
|00002e10| 79 70 65 20 77 68 69 63 | 68 0a 63 61 6e 20 68 6f |ype whic|h.can ho|
|00002e20| 6c 64 20 6e 75 6d 62 65 | 72 73 20 6f 66 20 61 62 |ld numbe|rs of ab|
|00002e30| 73 6f 6c 75 74 65 20 76 | 61 6c 75 65 20 6c 65 73 |solute v|alue les|
|00002e40| 73 20 74 68 61 6e 20 24 | 32 5e 7b 31 32 38 7d 24 |s than $|2^{128}$|
|00002e50| 20 28 32 20 63 6f 64 65 | 77 6f 72 64 73 20 2b 0a | (2 code|words +.|
|00002e60| 34 20 6d 61 6e 74 69 73 | 73 61 20 6c 6f 6e 67 77 |4 mantis|sa longw|
|00002e70| 6f 72 64 73 29 2e 0a 0a | 7b 5c 74 74 20 7a 20 3d |ords)...|{\tt z =|
|00002e80| 20 63 67 65 74 67 28 33 | 2c 20 36 29 3b 20 7a 5b | cgetg(3|, 6); z[|
|00002e90| 31 5d 20 3d 20 6c 67 65 | 74 72 28 35 29 3b 20 7a |1] = lge|tr(5); z|
|00002ea0| 5b 32 5d 20 3d 20 6c 67 | 65 74 72 28 35 29 3b 7d |[2] = lg|etr(5);}|
|00002eb0| 0a 63 72 65 61 74 65 73 | 20 61 20 63 6f 6d 70 6c |.creates| a compl|
|00002ec0| 65 78 20 74 79 70 65 20 | 77 68 6f 73 65 20 72 65 |ex type |whose re|
|00002ed0| 61 6c 20 61 6e 64 20 69 | 6d 61 67 69 6e 61 72 79 |al and i|maginary|
|00002ee0| 20 70 61 72 74 20 63 61 | 6e 20 68 6f 6c 64 20 72 | part ca|n hold r|
|00002ef0| 65 61 6c 20 6e 75 6d 62 | 65 72 73 0a 6f 66 20 70 |eal numb|ers.of p|
|00002f00| 72 65 63 69 73 69 6f 6e | 20 39 36 20 62 69 74 73 |recision| 96 bits|
|00002f10| 2e 0a 0a 7b 5c 74 74 20 | 7a 20 3d 20 63 67 65 74 |...{\tt |z = cget|
|00002f20| 67 28 34 2c 20 31 39 29 | 3b 20 66 6f 72 28 69 3d |g(4, 19)|; for(i=|
|00002f30| 31 3b 20 69 3c 34 3b 20 | 69 2b 2b 29 20 7a 5b 69 |1; i<4; |i++) z[i|
|00002f40| 5d 20 3d 20 6c 67 65 74 | 67 28 35 2c 20 31 38 29 |] = lget|g(5, 18)|
|00002f50| 3b 7d 0a 63 72 65 61 74 | 65 73 20 61 20 6d 61 74 |;}.creat|es a mat|
|00002f60| 72 69 78 20 74 79 70 65 | 20 66 6f 72 20 24 34 5c |rix type| for $4\|
|00002f70| 74 69 6d 65 73 20 33 24 | 20 6d 61 74 72 69 63 65 |times 3$| matrice|
|00002f80| 73 2e 20 4f 6e 65 20 6d | 75 73 74 20 61 6c 73 6f |s. One m|ust also|
|00002f90| 20 63 72 65 61 74 65 20 | 73 70 61 63 65 0a 66 6f | create |space.fo|
|00002fa0| 72 20 74 68 65 20 6d 61 | 74 72 69 78 20 65 6c 65 |r the ma|trix ele|
|00002fb0| 6d 65 6e 74 73 20 74 68 | 65 6d 73 65 6c 76 65 73 |ments th|emselves|
|00002fc0| 20 75 73 69 6e 67 20 61 | 20 64 6f 75 62 6c 65 20 | using a| double |
|00002fd0| 6c 6f 6f 70 2e 0a 0a 54 | 68 65 73 65 20 6c 61 73 |loop...T|hese las|
|00002fe0| 74 20 74 77 6f 20 65 78 | 61 6d 70 6c 65 73 20 69 |t two ex|amples i|
|00002ff0| 6c 6c 75 73 74 72 61 74 | 65 73 20 74 68 65 20 66 |llustrat|es the f|
|00003000| 61 63 74 20 74 68 61 74 | 20 73 69 6e 63 65 20 50 |act that| since P|
|00003010| 41 52 49 20 74 79 70 65 | 73 20 61 72 65 20 72 65 |ARI type|s are re|
|00003020| 63 75 72 73 69 76 65 2c | 0a 61 6c 6c 20 74 68 65 |cursive,|.all the|
|00003030| 20 62 72 61 6e 63 68 65 | 73 20 6f 66 20 74 68 65 | branche|s of the|
|00003040| 20 74 72 65 65 20 6d 75 | 73 74 20 62 65 20 63 72 | tree mu|st be cr|
|00003050| 65 61 74 65 64 2e 20 54 | 68 65 20 66 75 6e 63 74 |eated. T|he funct|
|00003060| 69 6f 6e 20 7b 5c 74 74 | 20 63 67 65 74 67 7d 20 |ion {\tt| cgetg} |
|00003070| 63 72 65 61 74 65 73 20 | 6f 6e 6c 79 20 74 68 65 |creates |only the|
|00003080| 0a 60 60 72 6f 6f 74 27 | 27 2c 20 61 6e 64 20 6f |.``root'|', and o|
|00003090| 74 68 65 72 20 63 61 6c | 6c 73 20 74 6f 20 7b 5c |ther cal|ls to {\|
|000030a0| 74 74 20 63 67 65 74 67 | 7d 20 6d 75 73 74 20 62 |tt cgetg|} must b|
|000030b0| 65 20 6d 61 64 65 20 74 | 6f 20 67 65 74 20 74 68 |e made t|o get th|
|000030c0| 65 20 77 68 6f 6c 65 20 | 74 72 65 65 2e 0a 46 6f |e whole |tree..Fo|
|000030d0| 72 20 6d 61 74 72 69 63 | 65 73 2c 20 61 20 63 6f |r matric|es, a co|
|000030e0| 6d 6d 6f 6e 20 6d 69 73 | 74 61 6b 65 20 69 73 20 |mmon mis|take is |
|000030f0| 74 6f 20 74 68 69 6e 6b | 20 74 68 61 74 20 7b 5c |to think| that {\|
|00003100| 74 74 20 7a 20 3d 20 63 | 67 65 74 67 28 34 2c 20 |tt z = c|getg(4, |
|00003110| 31 39 29 7d 0a 28 66 6f | 72 20 65 78 61 6d 70 6c |19)}.(fo|r exampl|
|00003120| 65 29 20 77 69 6c 6c 20 | 63 72 65 61 74 65 20 74 |e) will |create t|
|00003130| 68 65 20 72 6f 6f 74 20 | 6f 66 20 74 68 65 20 6d |he root |of the m|
|00003140| 61 74 72 69 78 3a 20 6f | 6e 65 20 6e 65 65 64 73 |atrix: o|ne needs|
|00003150| 20 61 6c 73 6f 20 74 6f | 20 63 72 65 61 74 65 20 | also to| create |
|00003160| 0a 74 68 65 20 63 6f 6c | 75 6d 6e 20 76 65 63 74 |.the col|umn vect|
|00003170| 6f 72 73 20 6f 66 20 74 | 68 65 0a 6d 61 74 72 69 |ors of t|he.matri|
|00003180| 78 2e 20 54 68 69 73 20 | 69 73 20 62 65 63 61 75 |x. This |is becau|
|00003190| 73 65 20 61 20 6d 61 74 | 72 69 78 20 69 73 20 72 |se a mat|rix is r|
|000031a0| 65 61 6c 6c 79 20 6e 6f | 74 68 69 6e 67 20 65 6c |eally no|thing el|
|000031b0| 73 65 20 74 68 61 6e 20 | 61 20 6c 69 6e 65 20 76 |se than |a line v|
|000031c0| 65 63 74 6f 72 20 6f 66 | 0a 63 6f 6c 75 6d 6e 20 |ector of|.column |
|000031d0| 76 65 63 74 6f 72 73 20 | 28 68 65 6e 63 65 20 61 |vectors |(hence a|
|000031e0| 20 70 72 69 6f 72 69 20 | 6e 6f 74 20 61 20 62 61 | priori |not a ba|
|000031f0| 73 69 63 20 74 79 70 65 | 29 2c 20 62 75 74 20 69 |sic type|), but i|
|00003200| 74 20 68 61 73 20 62 65 | 65 6e 20 67 69 76 65 6e |t has be|en given|
|00003210| 20 61 20 73 70 65 63 69 | 61 6c 0a 74 79 70 65 20 | a speci|al.type |
|00003220| 6e 75 6d 62 65 72 20 73 | 6f 20 74 68 61 74 20 6f |number s|o that o|
|00003230| 70 65 72 61 74 69 6f 6e | 73 20 77 69 74 68 20 6d |peration|s with m|
|00003240| 61 74 72 69 63 65 73 20 | 62 65 63 6f 6d 65 20 70 |atrices |become p|
|00003250| 6f 73 73 69 62 6c 65 2e | 0a 0a 5c 73 75 62 73 65 |ossible.|..\subse|
|00003260| 63 7b 49 6d 70 6c 65 6d | 65 6e 74 61 74 69 6f 6e |c{Implem|entation|
|00003270| 20 6f 66 20 74 68 65 20 | 50 41 52 49 20 74 79 70 | of the |PARI typ|
|00003280| 65 73 7d 2e 0a 0a 41 6c | 74 68 6f 75 67 68 20 69 |es}...Al|though i|
|00003290| 74 20 69 73 20 61 20 6c | 69 74 74 6c 65 20 74 65 |t is a l|ittle te|
|000032a0| 64 69 6f 75 73 2c 20 77 | 65 20 6d 75 73 74 20 67 |dious, w|e must g|
|000032b0| 6f 20 74 68 72 6f 75 67 | 68 20 65 61 63 68 20 74 |o throug|h each t|
|000032c0| 79 70 65 20 61 6e 64 20 | 65 78 70 6c 61 69 6e 20 |ype and |explain |
|000032d0| 74 68 65 69 72 0a 69 6d | 70 6c 65 6d 65 6e 74 61 |their.im|plementa|
|000032e0| 74 69 6f 6e 2e 20 4c 65 | 74 20 7a 20 62 65 20 61 |tion. Le|t z be a|
|000032f0| 20 50 41 52 49 20 6f 62 | 6a 65 63 74 2e 20 43 6f | PARI ob|ject. Co|
|00003300| 6d 6d 6f 6e 20 74 6f 20 | 61 6c 6c 20 74 68 65 20 |mmon to |all the |
|00003310| 74 79 70 65 73 20 69 73 | 20 74 68 65 20 66 69 72 |types is| the fir|
|00003320| 73 74 0a 63 6f 64 65 77 | 6f 72 64 20 28 7a 5b 30 |st.codew|ord (z[0|
|00003330| 5d 29 2c 20 77 68 69 63 | 68 20 77 65 20 64 6f 6e |]), whic|h we don|
|00003340| 27 74 20 68 61 76 65 20 | 74 6f 20 77 6f 72 72 79 |'t have |to worry|
|00003350| 20 61 62 6f 75 74 20 73 | 69 6e 63 65 20 74 68 69 | about s|ince thi|
|00003360| 73 20 69 73 20 74 61 6b | 65 6e 20 63 61 72 65 20 |s is tak|en care |
|00003370| 6f 66 0a 62 79 20 7b 5c | 74 74 20 63 67 65 74 67 |of.by {\|tt cgetg|
|00003380| 7d 2e 20 48 6f 77 65 76 | 65 72 20 77 65 20 6e 65 |}. Howev|er we ne|
|00003390| 65 64 20 69 74 73 20 70 | 72 65 63 69 73 65 20 64 |ed its p|recise d|
|000033a0| 65 73 63 72 69 70 74 69 | 6f 6e 3a 20 74 68 65 20 |escripti|on: the |
|000033b0| 66 69 72 73 74 0a 62 79 | 74 65 20 69 73 20 74 68 |first.by|te is th|
|000033c0| 65 20 5c 72 65 66 7b 74 | 79 70 65 20 6e 75 6d 62 |e \ref{t|ype numb|
|000033d0| 65 72 7d 2c 20 74 68 65 | 20 73 65 63 6f 6e 64 20 |er}, the| second |
|000033e0| 62 79 74 65 20 69 73 20 | 74 68 65 20 5c 72 65 66 |byte is |the \ref|
|000033f0| 7b 72 65 66 65 72 65 6e | 63 65 20 63 6f 75 6e 74 |{referen|ce count|
|00003400| 7d 20 28 75 73 65 64 20 | 6f 6e 6c 79 0a 66 6f 72 |} (used |only.for|
|00003410| 20 67 61 72 62 61 67 65 | 20 63 6f 6c 6c 65 63 74 | garbage| collect|
|00003420| 69 6e 67 20 70 75 72 70 | 6f 73 65 73 29 2c 20 61 |ing purp|oses), a|
|00003430| 6e 64 20 74 68 65 20 6c | 61 73 74 20 74 77 6f 20 |nd the l|ast two |
|00003440| 62 79 74 65 73 20 28 74 | 68 65 20 6c 6f 77 20 6f |bytes (t|he low o|
|00003450| 72 64 65 72 20 77 6f 72 | 64 20 69 66 0a 79 6f 75 |rder wor|d if.you|
|00003460| 20 70 72 65 66 65 72 29 | 20 69 73 20 74 68 65 20 | prefer)| is the |
|00003470| 5c 72 65 66 7b 6c 65 6e | 67 74 68 7d 20 6f 66 20 |\ref{len|gth} of |
|00003480| 74 68 65 20 72 6f 6f 74 | 20 69 6e 20 6c 6f 6e 67 |the root| in long|
|00003490| 77 6f 72 64 73 2e 20 46 | 6f 72 20 69 6e 73 74 61 |words. F|or insta|
|000034a0| 6e 63 65 20 69 6e 20 74 | 68 65 20 65 78 61 6d 70 |nce in t|he examp|
|000034b0| 6c 65 0a 7b 5c 74 74 20 | 7a 20 3d 20 63 67 65 74 |le.{\tt |z = cget|
|000034c0| 69 28 36 29 7d 20 61 62 | 6f 76 65 2c 20 7a 5b 30 |i(6)} ab|ove, z[0|
|000034d0| 5d 20 77 69 6c 6c 20 62 | 65 20 73 65 74 20 74 6f |] will b|e set to|
|000034e0| 20 7b 5c 74 74 20 30 78 | 30 31 30 31 30 30 30 36 | {\tt 0x|01010006|
|000034f0| 7d 2e 0a 0a 54 68 65 73 | 65 20 62 79 74 65 73 20 |}...Thes|e bytes |
|00003500| 63 61 6e 20 62 65 20 68 | 61 6e 64 6c 65 64 20 74 |can be h|andled t|
|00003510| 68 72 6f 75 67 68 20 74 | 68 65 20 66 6f 6c 6c 6f |hrough t|he follo|
|00003520| 77 69 6e 67 20 66 75 6e | 63 74 69 6f 6e 73 3a 0a |wing fun|ctions:.|
|00003530| 0a 7b 5c 74 74 20 6c 6f | 6e 67 20 5c 72 65 66 7b |.{\tt lo|ng \ref{|
|00003540| 74 79 70 7d 28 47 45 4e | 20 7a 29 3b 7d 20 72 65 |typ}(GEN| z);} re|
|00003550| 74 75 72 6e 73 20 74 68 | 65 20 74 79 70 65 20 6e |turns th|e type n|
|00003560| 75 6d 62 65 72 20 6f 66 | 20 7a 2e 0a 0a 7b 5c 74 |umber of| z...{\t|
|00003570| 74 20 76 6f 69 64 20 5c | 72 65 66 7b 73 65 74 74 |t void \|ref{sett|
|00003580| 79 70 7d 28 47 45 4e 20 | 7a 2c 20 6c 6f 6e 67 20 |yp}(GEN |z, long |
|00003590| 6e 29 3b 7d 20 73 65 74 | 73 20 65 71 75 61 6c 20 |n);} set|s equal |
|000035a0| 74 6f 20 7b 5c 74 74 20 | 6e 7d 20 74 68 65 20 74 |to {\tt |n} the t|
|000035b0| 79 70 65 20 6e 75 6d 62 | 65 72 20 6f 66 20 7a 0a |ype numb|er of z.|
|000035c0| 28 79 6f 75 20 73 68 6f | 75 6c 64 20 6e 6f 74 20 |(you sho|uld not |
|000035d0| 68 61 76 65 20 74 6f 20 | 75 73 65 20 74 68 69 73 |have to |use this|
|000035e0| 20 66 75 6e 63 74 69 6f | 6e 20 69 66 20 79 6f 75 | functio|n if you|
|000035f0| 20 75 73 65 20 63 67 65 | 74 67 29 2e 0a 0a 7b 5c | use cge|tg)...{\|
|00003600| 74 74 20 6c 6f 6e 67 20 | 5c 72 65 66 7b 70 65 72 |tt long |\ref{per|
|00003610| 65 7d 28 47 45 4e 20 7a | 29 3b 7d 20 72 65 74 75 |e}(GEN z|);} retu|
|00003620| 72 6e 73 20 74 68 65 20 | 72 65 66 65 72 65 6e 63 |rns the |referenc|
|00003630| 65 20 63 6f 75 6e 74 20 | 6f 66 20 7a 2e 0a 0a 7b |e count |of z...{|
|00003640| 5c 74 74 20 76 6f 69 64 | 20 5c 72 65 66 7b 73 65 |\tt void| \ref{se|
|00003650| 74 70 65 72 65 7d 28 47 | 45 4e 20 7a 2c 20 6c 6f |tpere}(G|EN z, lo|
|00003660| 6e 67 20 6e 29 3b 7d 20 | 73 65 74 73 20 65 71 75 |ng n);} |sets equ|
|00003670| 61 6c 20 74 6f 20 7b 5c | 74 74 20 6e 7d 20 74 68 |al to {\|tt n} th|
|00003680| 65 20 72 65 66 65 72 65 | 6e 63 65 20 63 6f 75 6e |e refere|nce coun|
|00003690| 74 20 6f 66 20 7a 2e 0a | 0a 7b 5c 74 74 20 76 6f |t of z..|.{\tt vo|
|000036a0| 69 64 20 5c 72 65 66 7b | 69 6e 63 70 65 72 65 7d |id \ref{|incpere}|
|000036b0| 28 47 45 4e 20 7a 29 3b | 7d 20 69 6e 63 72 65 6d |(GEN z);|} increm|
|000036c0| 65 6e 74 73 20 74 68 65 | 20 72 65 66 65 72 65 6e |ents the| referen|
|000036d0| 63 65 20 63 6f 75 6e 74 | 20 6f 66 20 7a 0a 28 77 |ce count| of z.(w|
|000036e0| 69 74 68 20 73 61 74 75 | 72 61 74 69 6f 6e 20 61 |ith satu|ration a|
|000036f0| 74 20 32 35 35 29 2e 0a | 0a 7b 5c 74 74 20 6c 6f |t 255)..|.{\tt lo|
|00003700| 6e 67 20 5c 72 65 66 7b | 6c 67 7d 28 47 45 4e 20 |ng \ref{|lg}(GEN |
|00003710| 7a 29 3b 7d 20 72 65 74 | 75 72 6e 73 20 74 68 65 |z);} ret|urns the|
|00003720| 20 6c 65 6e 67 74 68 20 | 28 69 6e 20 6c 6f 6e 67 | length |(in long|
|00003730| 77 6f 72 64 73 29 20 6f | 66 20 74 68 65 20 72 6f |words) o|f the ro|
|00003740| 6f 74 20 6f 66 20 7a 2e | 0a 0a 7b 5c 74 74 20 6c |ot of z.|..{\tt l|
|00003750| 6f 6e 67 20 5c 72 65 66 | 7b 73 65 74 6c 67 7d 28 |ong \ref|{setlg}(|
|00003760| 47 45 4e 20 7a 2c 20 6c | 6f 6e 67 20 6c 29 3b 7d |GEN z, l|ong l);}|
|00003770| 20 73 65 74 73 20 65 71 | 75 61 6c 20 74 6f 20 7b | sets eq|ual to {|
|00003780| 5c 74 74 20 6c 7d 20 74 | 68 65 20 6c 65 6e 67 74 |\tt l} t|he lengt|
|00003790| 68 20 6f 66 20 7a 20 0a | 28 79 6f 75 20 73 68 6f |h of z .|(you sho|
|000037a0| 75 6c 64 20 6e 6f 74 20 | 68 61 76 65 20 74 6f 20 |uld not |have to |
|000037b0| 75 73 65 20 74 68 69 73 | 20 66 75 6e 63 74 69 6f |use this| functio|
|000037c0| 6e 20 69 66 20 79 6f 75 | 20 75 73 65 20 7b 5c 74 |n if you| use {\t|
|000037d0| 74 20 63 67 65 74 67 7d | 3b 20 68 6f 77 65 76 65 |t cgetg}|; howeve|
|000037e0| 72 2c 0a 73 65 65 20 61 | 6e 20 65 78 61 6d 70 6c |r,.see a|n exampl|
|000037f0| 65 20 6f 66 20 74 68 65 | 20 75 73 65 20 6f 66 20 |e of the| use of |
|00003800| 74 68 69 73 20 66 75 6e | 63 74 69 6f 6e 20 69 6e |this fun|ction in|
|00003810| 20 74 68 65 20 6d 61 74 | 65 78 70 20 66 75 6e 63 | the mat|exp func|
|00003820| 74 69 6f 6e 20 67 69 76 | 65 6e 20 69 6e 20 0a 73 |tion giv|en in .s|
|00003830| 65 63 74 69 6f 6e 20 34 | 2e 33 29 2e 0a 0a 4c 65 |ection 4|.3)...Le|
|00003840| 74 20 75 73 20 6e 6f 77 | 20 6c 6f 6f 6b 20 70 72 |t us now| look pr|
|00003850| 65 63 69 73 65 6c 79 20 | 61 74 20 74 68 65 20 74 |ecisely |at the t|
|00003860| 79 70 65 73 3a 0a 0a 7b | 5c 62 66 20 54 79 70 65 |ypes:..{|\bf Type|
|00003870| 20 31 20 28 69 6e 74 65 | 67 65 72 73 29 7d 3a 20 | 1 (inte|gers)}: |
|00003880| 5c 73 72 65 66 7b 49 6e | 74 65 67 65 72 7d 0a 74 |\sref{In|teger}.t|
|00003890| 68 69 73 20 74 79 70 65 | 20 68 61 73 20 61 20 73 |his type| has a s|
|000038a0| 65 63 6f 6e 64 20 63 6f | 64 65 77 6f 72 64 20 7a |econd co|deword z|
|000038b0| 5b 31 5d 20 77 68 69 63 | 68 20 63 6f 6e 74 61 69 |[1] whic|h contai|
|000038c0| 6e 73 20 74 68 65 0a 66 | 6f 6c 6c 6f 77 69 6e 67 |ns the.f|ollowing|
|000038d0| 20 69 6e 66 6f 72 6d 61 | 74 69 6f 6e 2e 20 54 68 | informa|tion. Th|
|000038e0| 65 20 66 69 72 73 74 20 | 62 79 74 65 20 69 73 20 |e first |byte is |
|000038f0| 74 68 65 20 73 69 67 6e | 20 6f 66 20 7a 2c 20 69 |the sign| of z, i|
|00003900| 2e 65 2e 20 31 20 69 66 | 20 7a 20 24 3e 24 20 30 |.e. 1 if| z $>$ 0|
|00003910| 2c 0a 30 20 69 66 20 7a | 20 24 3d 24 20 30 2c 20 |,.0 if z| $=$ 0, |
|00003920| 24 2d 31 24 20 69 66 20 | 7a 20 24 3c 24 20 30 2e |$-1$ if |z $<$ 0.|
|00003930| 20 54 68 65 20 73 65 63 | 6f 6e 64 20 62 79 74 65 | The sec|ond byte|
|00003940| 20 69 73 20 75 6e 75 73 | 65 64 2e 20 54 68 65 20 | is unus|ed. The |
|00003950| 6c 6f 77 20 6f 72 64 65 | 72 20 77 6f 72 64 20 69 |low orde|r word i|
|00003960| 73 0a 74 68 65 20 7b 5c | 62 66 20 65 66 66 65 63 |s.the {\|bf effec|
|00003970| 74 69 76 65 20 6c 65 6e | 67 74 68 7d 20 6f 66 20 |tive len|gth} of |
|00003980| 7a 2c 20 69 2e 65 2e 20 | 74 68 65 20 74 6f 74 61 |z, i.e. |the tota|
|00003990| 6c 20 6e 75 6d 62 65 72 | 20 6f 66 20 73 69 67 6e |l number| of sign|
|000039a0| 69 66 69 63 61 6e 74 20 | 6c 6f 6e 67 77 6f 72 64 |ificant |longword|
|000039b0| 73 2e 0a 54 68 69 73 20 | 6d 65 61 6e 73 20 74 68 |s..This |means th|
|000039c0| 65 20 66 6f 6c 6c 6f 77 | 69 6e 67 3a 20 61 70 61 |e follow|ing: apa|
|000039d0| 72 74 20 66 72 6f 6d 20 | 74 68 65 20 69 6e 74 65 |rt from |the inte|
|000039e0| 67 65 72 20 30 20 28 77 | 68 6f 73 65 20 73 65 63 |ger 0 (w|hose sec|
|000039f0| 6f 6e 64 20 63 6f 64 65 | 77 6f 72 64 20 69 73 0a |ond code|word is.|
|00003a00| 65 71 75 61 6c 20 74 6f | 20 32 29 2c 20 65 76 65 |equal to| 2), eve|
|00003a10| 72 79 20 69 6e 74 65 67 | 65 72 20 69 73 20 60 60 |ry integ|er is ``|
|00003a20| 6e 6f 72 6d 61 6c 69 7a | 65 64 27 27 2c 20 6d 65 |normaliz|ed'', me|
|00003a30| 61 6e 69 6e 67 20 74 68 | 61 74 20 74 68 65 20 66 |aning th|at the f|
|00003a40| 69 72 73 74 0a 6d 61 6e | 74 69 73 73 61 20 6c 6f |irst.man|tissa lo|
|00003a50| 6e 67 77 6f 72 64 20 28 | 69 2e 65 2e 20 7a 5b 32 |ngword (|i.e. z[2|
|00003a60| 5d 29 20 69 73 20 6e 6f | 6e 20 7a 65 72 6f 2e 20 |]) is no|n zero. |
|00003a70| 48 6f 77 65 76 65 72 2c | 20 74 68 65 20 69 6e 74 |However,| the int|
|00003a80| 65 67 65 72 20 6d 61 79 | 20 68 61 76 65 20 62 65 |eger may| have be|
|00003a90| 65 6e 0a 63 72 65 61 74 | 65 64 20 77 69 74 68 20 |en.creat|ed with |
|00003aa0| 61 20 6c 6f 6e 67 65 72 | 20 6c 65 6e 67 74 68 2e |a longer| length.|
|00003ab0| 20 48 65 6e 63 65 20 74 | 68 65 20 60 60 6c 65 6e | Hence t|he ``len|
|00003ac0| 67 74 68 27 27 20 77 68 | 69 63 68 20 69 73 20 69 |gth'' wh|ich is i|
|00003ad0| 6e 20 7a 5b 30 5d 20 63 | 61 6e 0a 62 65 20 6c 61 |n z[0] c|an.be la|
|00003ae0| 72 67 65 72 20 74 68 61 | 6e 20 74 68 65 20 60 60 |rger tha|n the ``|
|00003af0| 65 66 66 65 63 74 69 76 | 65 20 6c 65 6e 67 74 68 |effectiv|e length|
|00003b00| 27 27 20 77 68 69 63 68 | 20 69 73 20 69 6e 20 7a |'' which| is in z|
|00003b10| 5b 31 5d 2e 20 49 6e 20 | 66 61 63 74 2c 20 69 74 |[1]. In |fact, it|
|00003b20| 20 77 6f 75 6c 64 20 62 | 65 0a 61 20 64 69 73 61 | would b|e.a disa|
|00003b30| 73 74 65 72 20 74 6f 20 | 74 72 79 20 74 6f 20 61 |ster to |try to a|
|00003b40| 63 63 65 73 73 20 7a 5b | 69 5d 20 66 6f 72 20 69 |ccess z[|i] for i|
|00003b50| 20 6c 61 72 67 65 72 20 | 74 68 61 6e 20 6f 72 20 | larger |than or |
|00003b60| 65 71 75 61 6c 20 74 6f | 20 74 68 65 20 65 66 66 |equal to| the eff|
|00003b70| 65 63 74 69 76 65 20 6c | 65 6e 67 74 68 2e 0a 0a |ective l|ength...|
|00003b80| 54 68 69 73 20 69 6e 66 | 6f 72 6d 61 74 69 6f 6e |This inf|ormation|
|00003b90| 20 63 61 6e 20 62 65 20 | 68 61 6e 64 6c 65 64 20 | can be |handled |
|00003ba0| 75 73 69 6e 67 20 74 68 | 65 20 66 6f 6c 6c 6f 77 |using th|e follow|
|00003bb0| 69 6e 67 20 66 75 6e 63 | 74 69 6f 6e 73 3a 0a 0a |ing func|tions:..|
|00003bc0| 7b 5c 74 74 20 6c 6f 6e | 67 20 5c 72 65 66 7b 73 |{\tt lon|g \ref{s|
|00003bd0| 69 67 6e 65 7d 28 47 45 | 4e 20 7a 29 3b 7d 20 72 |igne}(GE|N z);} r|
|00003be0| 65 74 75 72 6e 73 20 74 | 68 65 20 73 69 67 6e 20 |eturns t|he sign |
|00003bf0| 6f 66 20 7a 2e 0a 0a 7b | 5c 74 74 20 76 6f 69 64 |of z...{|\tt void|
|00003c00| 20 5c 72 65 66 7b 73 65 | 74 73 69 67 6e 65 7d 28 | \ref{se|tsigne}(|
|00003c10| 47 45 4e 20 7a 2c 20 6c | 6f 6e 67 20 73 29 3b 7d |GEN z, l|ong s);}|
|00003c20| 20 73 65 74 73 20 65 71 | 75 61 6c 20 74 6f 20 7b | sets eq|ual to {|
|00003c30| 5c 74 74 20 73 7d 20 74 | 68 65 20 73 69 67 6e 20 |\tt s} t|he sign |
|00003c40| 6f 66 20 7a 2e 0a 0a 7b | 5c 74 74 20 6c 6f 6e 67 |of z...{|\tt long|
|00003c50| 20 5c 72 65 66 7b 6c 67 | 65 66 7d 28 47 45 4e 20 | \ref{lg|ef}(GEN |
|00003c60| 7a 29 3b 7d 20 72 65 74 | 75 72 6e 73 20 74 68 65 |z);} ret|urns the|
|00003c70| 20 5c 72 65 66 7b 65 66 | 66 65 63 74 69 76 65 20 | \ref{ef|fective |
|00003c80| 6c 65 6e 67 74 68 7d 20 | 6f 66 20 7a 2e 0a 0a 7b |length} |of z...{|
|00003c90| 5c 74 74 20 76 6f 69 64 | 20 5c 72 65 66 7b 73 65 |\tt void| \ref{se|
|00003ca0| 74 6c 67 65 66 7d 28 47 | 45 4e 20 7a 2c 20 6c 6f |tlgef}(G|EN z, lo|
|00003cb0| 6e 67 20 6c 29 3b 7d 20 | 73 65 74 73 20 65 71 75 |ng l);} |sets equ|
|00003cc0| 61 6c 20 74 6f 20 7b 5c | 74 74 20 6c 7d 20 74 68 |al to {\|tt l} th|
|00003cd0| 65 20 65 66 66 65 63 74 | 69 76 65 20 6c 65 6e 67 |e effect|ive leng|
|00003ce0| 74 68 20 6f 66 20 7a 2e | 0a 0a 54 68 65 20 69 6e |th of z.|..The in|
|00003cf0| 74 65 67 65 72 20 30 20 | 63 61 6e 20 62 65 20 63 |teger 0 |can be c|
|00003d00| 68 61 72 61 63 74 65 72 | 69 7a 65 64 20 65 69 74 |haracter|ized eit|
|00003d10| 68 65 72 20 62 79 20 69 | 74 73 20 73 69 67 6e 20 |her by i|ts sign |
|00003d20| 65 71 75 61 6c 20 74 6f | 20 30 2c 20 6f 72 20 62 |equal to| 0, or b|
|00003d30| 79 0a 69 74 73 20 65 66 | 66 65 63 74 69 76 65 20 |y.its ef|fective |
|00003d40| 6c 65 6e 67 74 68 20 65 | 71 75 61 6c 20 74 6f 20 |length e|qual to |
|00003d50| 32 2e 20 41 70 61 72 74 | 20 66 72 6f 6d 20 7a 20 |2. Apart| from z |
|00003d60| 24 3d 24 20 30 2c 20 7a | 5b 32 5d 20 65 78 69 73 |$=$ 0, z|[2] exis|
|00003d70| 74 73 20 61 6e 64 20 69 | 73 20 6e 6f 6e 20 7a 65 |ts and i|s non ze|
|00003d80| 72 6f 2c 0a 61 6e 64 20 | 74 68 65 20 61 62 73 6f |ro,.and |the abso|
|00003d90| 6c 75 74 65 20 76 61 6c | 75 65 20 6f 66 20 7a 20 |lute val|ue of z |
|00003da0| 69 73 20 28 7a 5b 32 5d | 2c 7a 5b 33 5d 2c 5c 64 |is (z[2]|,z[3],\d|
|00003db0| 6f 74 73 2c 7a 5b 6c 67 | 65 66 28 7a 29 2d 31 5d |ots,z[lg|ef(z)-1]|
|00003dc0| 29 20 69 6e 20 62 61 73 | 65 20 24 32 5e 7b 33 32 |) in bas|e $2^{32|
|00003dd0| 7d 24 2c 0a 77 68 65 72 | 65 20 61 73 20 75 73 75 |}$,.wher|e as usu|
|00003de0| 61 6c 20 69 6e 20 74 68 | 69 73 20 6e 6f 74 61 74 |al in th|is notat|
|00003df0| 69 6f 6e 20 7a 5b 32 5d | 20 69 73 20 74 68 65 20 |ion z[2]| is the |
|00003e00| 68 69 67 68 20 6f 72 64 | 65 72 20 6c 6f 6e 67 77 |high ord|er longw|
|00003e10| 6f 72 64 2e 0a 0a 7b 5c | 62 66 20 54 79 70 65 20 |ord...{\|bf Type |
|00003e20| 32 20 28 72 65 61 6c 20 | 6e 75 6d 62 65 72 73 29 |2 (real |numbers)|
|00003e30| 7d 3a 20 5c 73 72 65 66 | 7b 52 65 61 6c 20 6e 75 |}: \sref|{Real nu|
|00003e40| 6d 62 65 72 7d 0a 74 68 | 69 73 20 74 79 70 65 20 |mber}.th|is type |
|00003e50| 68 61 73 20 61 20 73 65 | 63 6f 6e 64 20 63 6f 64 |has a se|cond cod|
|00003e60| 65 77 6f 72 64 20 7a 5b | 31 5d 20 77 68 6f 73 65 |eword z[|1] whose|
|00003e70| 20 66 69 72 73 74 20 62 | 79 74 65 0a 69 73 20 61 | first b|yte.is a|
|00003e80| 6c 73 6f 20 74 68 65 20 | 73 69 67 6e 20 28 6f 62 |lso the |sign (ob|
|00003e90| 74 61 69 6e 65 64 20 6f | 72 20 73 65 74 20 75 73 |tained o|r set us|
|00003ea0| 69 6e 67 20 74 68 65 20 | 73 61 6d 65 20 66 75 6e |ing the |same fun|
|00003eb0| 63 74 69 6f 6e 73 20 61 | 73 20 66 6f 72 20 74 68 |ctions a|s for th|
|00003ec0| 65 20 69 6e 74 65 67 65 | 72 73 29 2c 0a 62 75 74 |e intege|rs),.but|
|00003ed0| 20 77 68 6f 73 65 20 33 | 20 6c 6f 77 20 6f 72 64 | whose 3| low ord|
|00003ee0| 65 72 20 62 79 74 65 73 | 20 63 6f 6e 74 61 69 6e |er bytes| contain|
|00003ef0| 73 20 61 20 62 69 61 73 | 65 64 20 62 69 6e 61 72 |s a bias|ed binar|
|00003f00| 79 20 65 78 70 6f 6e 65 | 6e 74 20 28 69 2e 65 2e |y expone|nt (i.e.|
|00003f10| 20 74 68 65 20 65 78 70 | 6f 6e 65 6e 74 0a 70 6c | the exp|onent.pl|
|00003f20| 75 73 20 24 32 5e 7b 32 | 33 7d 24 29 2e 20 54 68 |us $2^{2|3}$). Th|
|00003f30| 69 73 20 65 78 70 6f 6e | 65 6e 74 20 63 61 6e 20 |is expon|ent can |
|00003f40| 62 65 20 68 61 6e 64 6c | 65 64 20 75 73 69 6e 67 |be handl|ed using|
|00003f50| 20 74 68 65 20 66 6f 6c | 6c 6f 77 69 6e 67 20 66 | the fol|lowing f|
|00003f60| 75 6e 63 74 69 6f 6e 73 | 3a 0a 0a 7b 5c 74 74 20 |unctions|:..{\tt |
|00003f70| 6c 6f 6e 67 20 5c 72 65 | 66 7b 65 78 70 6f 7d 28 |long \re|f{expo}(|
|00003f80| 47 45 4e 20 7a 29 3b 7d | 20 72 65 74 75 72 6e 73 |GEN z);}| returns|
|00003f90| 20 74 68 65 20 74 72 75 | 65 20 28 75 6e 62 69 61 | the tru|e (unbia|
|00003fa0| 73 65 64 29 20 65 78 70 | 6f 6e 65 6e 74 20 6f 66 |sed) exp|onent of|
|00003fb0| 20 7a 2e 20 54 68 69 73 | 20 69 73 0a 64 65 66 69 | z. This| is.defi|
|00003fc0| 6e 65 64 20 65 76 65 6e | 20 77 68 65 6e 20 7a 20 |ned even| when z |
|00003fd0| 69 73 20 65 71 75 61 6c | 20 74 6f 20 7a 65 72 6f |is equal| to zero|
|00003fe0| 2c 20 73 65 65 20 73 65 | 63 74 69 6f 6e 20 31 2e |, see se|ction 1.|
|00003ff0| 32 2e 36 2e 0a 0a 4e 6f | 74 65 20 61 6c 73 6f 20 |2.6...No|te also |
|00004000| 74 68 65 20 66 75 6e 63 | 74 69 6f 6e 20 7b 5c 74 |the func|tion {\t|
|00004010| 74 20 6c 6f 6e 67 20 5c | 72 65 66 7b 67 65 78 70 |t long \|ref{gexp|
|00004020| 6f 7d 28 47 45 4e 20 7a | 29 7d 20 77 68 69 63 68 |o}(GEN z|)} which|
|00004030| 20 74 72 69 65 73 20 74 | 6f 20 72 65 74 75 72 6e | tries t|o return|
|00004040| 20 61 6e 20 65 78 70 6f | 6e 65 6e 74 0a 66 6f 72 | an expo|nent.for|
|00004050| 20 24 7a 24 20 65 76 65 | 6e 20 69 66 20 24 7a 24 | $z$ eve|n if $z$|
|00004060| 20 69 73 20 6e 6f 74 20 | 61 20 72 65 61 6c 20 6e | is not |a real n|
|00004070| 75 6d 62 65 72 2e 0a 0a | 7b 5c 74 74 20 76 6f 69 |umber...|{\tt voi|
|00004080| 64 20 5c 72 65 66 7b 73 | 65 74 65 78 70 6f 7d 28 |d \ref{s|etexpo}(|
|00004090| 47 45 4e 20 7a 2c 20 6c | 6f 6e 67 20 65 29 3b 7d |GEN z, l|ong e);}|
|000040a0| 20 73 65 74 73 20 65 71 | 75 61 6c 20 74 6f 20 7b | sets eq|ual to {|
|000040b0| 5c 74 74 20 65 7d 20 74 | 68 65 20 65 78 70 6f 6e |\tt e} t|he expon|
|000040c0| 65 6e 74 20 6f 66 20 7a | 2c 20 6f 66 20 63 6f 75 |ent of z|, of cou|
|000040d0| 72 73 65 0a 61 66 74 65 | 72 20 61 64 64 69 6e 67 |rse.afte|r adding|
|000040e0| 20 74 68 65 20 62 69 61 | 73 2e 0a 0a 54 68 65 20 | the bia|s...The |
|000040f0| 72 65 61 6c 20 7a 65 72 | 6f 20 69 73 20 63 68 61 |real zer|o is cha|
|00004100| 72 61 63 74 65 72 69 7a | 65 64 20 62 79 20 68 61 |racteriz|ed by ha|
|00004110| 76 69 6e 67 20 69 74 73 | 20 73 69 67 6e 20 65 71 |ving its| sign eq|
|00004120| 75 61 6c 20 74 6f 20 30 | 2e 20 48 6f 77 65 76 65 |ual to 0|. Howeve|
|00004130| 72 2c 20 75 73 75 61 6c | 6c 79 0a 74 68 65 20 66 |r, usual|ly.the f|
|00004140| 69 72 73 74 20 6d 61 6e | 74 69 73 73 61 20 77 6f |irst man|tissa wo|
|00004150| 72 64 20 7a 5b 32 5d 20 | 69 73 20 64 65 66 69 6e |rd z[2] |is defin|
|00004160| 65 64 20 61 6e 64 20 65 | 71 75 61 6c 20 74 6f 20 |ed and e|qual to |
|00004170| 30 2e 20 54 68 69 73 20 | 66 61 63 74 20 6d 75 73 |0. This |fact mus|
|00004180| 74 20 7b 5c 69 74 20 6e | 65 76 65 72 5c 2f 7d 0a |t {\it n|ever\/}.|
|00004190| 62 65 20 75 73 65 64 20 | 74 6f 20 63 68 61 72 61 |be used |to chara|
|000041a0| 63 74 65 72 69 7a 65 20 | 30 2e 20 49 66 20 7a 20 |cterize |0. If z |
|000041b0| 69 73 20 6e 6f 74 20 65 | 71 75 61 6c 20 74 6f 20 |is not e|qual to |
|000041c0| 30 2c 20 74 68 65 20 66 | 69 72 73 74 20 6d 61 6e |0, the f|irst man|
|000041d0| 74 69 73 73 61 20 77 6f | 72 64 20 7a 5b 32 5d 0a |tissa wo|rd z[2].|
|000041e0| 69 73 20 6e 6f 72 6d 61 | 6c 69 7a 65 64 2c 20 69 |is norma|lized, i|
|000041f0| 2e 65 2e 20 69 74 73 20 | 66 69 72 73 74 20 62 69 |.e. its |first bi|
|00004200| 74 20 69 73 20 31 2e 20 | 54 68 65 20 6d 61 6e 74 |t is 1. |The mant|
|00004210| 69 73 73 61 20 69 73 20 | 28 7a 5b 32 5d 2c 7a 5b |issa is |(z[2],z[|
|00004220| 33 5d 2c 5c 64 6f 74 73 | 2c 7a 5b 6c 67 28 7a 5d |3],\dots|,z[lg(z]|
|00004230| 2d 31 5d 29 0a 69 6e 20 | 62 61 73 65 20 24 32 5e |-1]).in |base $2^|
|00004240| 7b 33 32 7d 24 20 77 68 | 65 72 65 20 7a 5b 32 5d |{32}$ wh|ere z[2]|
|00004250| 20 69 73 20 74 68 65 20 | 6d 6f 73 74 20 73 69 67 | is the |most sig|
|00004260| 6e 69 66 69 63 61 6e 74 | 20 6c 6f 6e 67 77 6f 72 |nificant| longwor|
|00004270| 64 2c 20 61 6e 64 20 74 | 68 65 20 6d 61 6e 74 69 |d, and t|he manti|
|00004280| 73 73 61 0a 69 73 20 75 | 6e 64 65 72 73 74 6f 6f |ssa.is u|nderstoo|
|00004290| 64 20 74 6f 20 62 65 20 | 62 65 74 77 65 65 6e 20 |d to be |between |
|000042a0| 31 20 61 6e 64 20 32 2e | 20 54 68 75 73 20 74 68 |1 and 2.| Thus th|
|000042b0| 65 20 72 65 61 6c 20 6e | 75 6d 62 65 72 20 24 2d |e real n|umber $-|
|000042c0| 33 2e 35 24 20 69 73 20 | 72 65 70 72 65 73 65 6e |3.5$ is |represen|
|000042d0| 74 65 64 0a 28 69 66 20 | 74 68 65 20 6c 65 6e 67 |ted.(if |the leng|
|000042e0| 74 68 20 69 73 20 34 29 | 20 61 73 20 7b 5c 74 74 |th is 4)| as {\tt|
|000042f0| 20 30 78 30 32 30 31 30 | 30 30 34 2c 20 30 78 66 | 0x02010|004, 0xf|
|00004300| 66 38 30 30 30 30 31 2c | 20 30 78 65 30 30 30 30 |f800001,| 0xe0000|
|00004310| 30 30 30 2c 20 30 7d 2e | 0a 0a 7b 5c 62 66 20 54 |000, 0}.|..{\bf T|
|00004320| 79 70 65 20 33 20 28 69 | 6e 74 65 67 65 72 6d 6f |ype 3 (i|ntegermo|
|00004330| 64 73 29 7d 3a 20 5c 73 | 72 65 66 7b 49 6e 74 65 |ds)}: \s|ref{Inte|
|00004340| 67 65 72 6d 6f 64 7d 0a | 7a 5b 31 5d 20 70 6f 69 |germod}.|z[1] poi|
|00004350| 6e 74 73 20 74 6f 20 74 | 68 65 20 6d 6f 64 75 6c |nts to t|he modul|
|00004360| 75 73 2c 20 61 6e 64 20 | 7a 5b 32 5d 20 6f 6e 20 |us, and |z[2] on |
|00004370| 74 68 65 20 6e 75 6d 62 | 65 72 0a 72 65 70 72 65 |the numb|er.repre|
|00004380| 73 65 6e 74 69 6e 67 20 | 74 68 65 20 63 6c 61 73 |senting |the clas|
|00004390| 73 20 7a 2e 20 42 6f 74 | 68 20 6d 75 73 74 20 62 |s z. Bot|h must b|
|000043a0| 65 20 6f 66 20 74 79 70 | 65 20 69 6e 74 65 67 65 |e of typ|e intege|
|000043b0| 72 2e 20 49 6e 20 70 72 | 69 6e 63 69 70 6c 65 20 |r. In pr|inciple |
|000043c0| 7a 5b 31 5d 20 24 3e 24 | 0a 30 20 61 6e 64 20 30 |z[1] $>$|.0 and 0|
|000043d0| 20 24 3c 3d 24 20 7a 5b | 32 5d 20 24 3c 24 20 7a | $<=$ z[|2] $<$ z|
|000043e0| 5b 31 5d 2c 20 62 75 74 | 20 74 68 69 73 20 72 75 |[1], but| this ru|
|000043f0| 6c 65 20 64 6f 65 73 20 | 6e 6f 74 20 68 61 76 65 |le does |not have|
|00004400| 20 74 6f 20 62 65 20 73 | 74 72 69 63 74 6c 79 20 | to be s|trictly |
|00004410| 6f 62 65 79 65 64 0a 62 | 79 20 74 68 65 20 75 73 |obeyed.b|y the us|
|00004420| 65 72 2e 20 41 6e 79 20 | 69 6e 74 65 67 65 72 6d |er. Any |integerm|
|00004430| 6f 64 20 6f 62 74 61 69 | 6e 65 64 20 61 66 74 65 |od obtai|ned afte|
|00004440| 72 20 61 20 50 41 52 49 | 20 6f 70 65 72 61 74 69 |r a PARI| operati|
|00004450| 6f 6e 20 77 69 6c 6c 20 | 69 6e 20 70 72 69 6e 63 |on will |in princ|
|00004460| 69 70 6c 65 0a 73 61 74 | 69 73 66 79 20 74 68 65 |iple.sat|isfy the|
|00004470| 73 65 20 63 6f 6e 64 69 | 74 69 6f 6e 73 2e 0a 0a |se condi|tions...|
|00004480| 7b 5c 62 66 20 54 79 70 | 65 73 20 34 20 61 6e 64 |{\bf Typ|es 4 and|
|00004490| 20 35 20 28 72 61 74 69 | 6f 6e 61 6c 20 6e 75 6d | 5 (rati|onal num|
|000044a0| 62 65 72 73 29 7d 3a 20 | 5c 73 72 65 66 7b 52 61 |bers)}: |\sref{Ra|
|000044b0| 74 69 6f 6e 61 6c 20 6e | 75 6d 62 65 72 7d 0a 7a |tional n|umber}.z|
|000044c0| 5b 31 5d 20 70 6f 69 6e | 74 73 20 74 6f 20 74 68 |[1] poin|ts to th|
|000044d0| 65 20 6e 75 6d 65 72 61 | 74 6f 72 2c 20 61 6e 64 |e numera|tor, and|
|000044e0| 20 7a 5b 32 5d 20 6f 6e | 20 74 68 65 20 0a 64 65 | z[2] on| the .de|
|000044f0| 6e 6f 6d 69 6e 61 74 6f | 72 2e 20 42 6f 74 68 20 |nominato|r. Both |
|00004500| 6d 75 73 74 20 62 65 20 | 6f 66 20 74 79 70 65 20 |must be |of type |
|00004510| 69 6e 74 65 67 65 72 2e | 20 49 6e 20 70 72 69 6e |integer.| In prin|
|00004520| 63 69 70 6c 65 20 7a 5b | 32 5d 20 24 3e 24 20 30 |ciple z[|2] $>$ 0|
|00004530| 2c 20 62 75 74 20 74 68 | 69 73 0a 72 75 6c 65 20 |, but th|is.rule |
|00004540| 64 6f 65 73 20 6e 6f 74 | 20 68 61 76 65 20 74 6f |does not| have to|
|00004550| 20 62 65 20 73 74 72 69 | 63 74 6c 79 20 6f 62 65 | be stri|ctly obe|
|00004560| 79 65 64 20 65 69 74 68 | 65 72 2e 0a 0a 7b 5c 62 |yed eith|er...{\b|
|00004570| 66 20 54 79 70 65 20 36 | 20 28 63 6f 6d 70 6c 65 |f Type 6| (comple|
|00004580| 78 20 6e 75 6d 62 65 72 | 73 29 7d 3a 20 0a 5c 73 |x number|s)}: .\s|
|00004590| 72 65 66 7b 43 6f 6d 70 | 6c 65 78 20 6e 75 6d 62 |ref{Comp|lex numb|
|000045a0| 65 72 7d 7a 5b 31 5d 20 | 70 6f 69 6e 74 73 20 6f |er}z[1] |points o|
|000045b0| 6e 20 74 68 65 20 72 65 | 61 6c 20 70 61 72 74 2c |n the re|al part,|
|000045c0| 20 61 6e 64 20 7a 5b 32 | 5d 20 6f 6e 20 74 68 65 | and z[2|] on the|
|000045d0| 0a 69 6d 61 67 69 6e 61 | 72 79 20 70 61 72 74 2e |.imagina|ry part.|
|000045e0| 20 41 20 70 72 69 6f 72 | 69 20 7a 5b 31 5d 20 61 | A prior|i z[1] a|
|000045f0| 6e 64 20 7a 5b 32 5d 20 | 63 61 6e 20 62 65 20 6f |nd z[2] |can be o|
|00004600| 66 20 61 6e 79 20 74 79 | 70 65 2c 20 62 75 74 20 |f any ty|pe, but |
|00004610| 6f 6e 6c 79 20 63 65 72 | 74 61 69 6e 20 74 79 70 |only cer|tain typ|
|00004620| 65 73 0a 61 72 65 20 75 | 73 65 66 75 6c 20 61 6e |es.are u|seful an|
|00004630| 64 20 6d 61 6b 65 20 73 | 65 6e 73 65 2e 0a 0a 7b |d make s|ense...{|
|00004640| 5c 62 66 20 54 79 70 65 | 20 37 20 28 24 70 24 2d |\bf Type| 7 ($p$-|
|00004650| 61 64 69 63 20 6e 75 6d | 62 65 72 73 29 7d 3a 20 |adic num|bers)}: |
|00004660| 5c 73 72 65 66 7b 70 2d | 61 64 69 63 20 6e 75 6d |\sref{p-|adic num|
|00004670| 62 65 72 7d 0a 74 68 69 | 73 20 74 79 70 65 20 68 |ber}.thi|s type h|
|00004680| 61 73 20 61 20 73 65 63 | 6f 6e 64 20 63 6f 64 65 |as a sec|ond code|
|00004690| 77 6f 72 64 20 7a 5b 31 | 5d 20 77 68 69 63 68 0a |word z[1|] which.|
|000046a0| 63 6f 6e 74 61 69 6e 73 | 20 74 68 65 20 66 6f 6c |contains| the fol|
|000046b0| 6c 6f 77 69 6e 67 20 69 | 6e 66 6f 72 6d 61 74 69 |lowing i|nformati|
|000046c0| 6f 6e 3a 20 74 68 65 20 | 66 69 72 73 74 20 7b 5c |on: the |first {\|
|000046d0| 69 74 20 77 6f 72 64 5c | 2f 7d 20 63 6f 6e 74 61 |it word\|/} conta|
|000046e0| 69 6e 73 20 74 68 65 20 | 65 78 70 6f 6e 65 6e 74 |ins the |exponent|
|000046f0| 0a 6f 66 20 24 70 24 20 | 6d 6f 64 75 6c 6f 20 77 |.of $p$ |modulo w|
|00004700| 68 69 63 68 20 74 68 65 | 20 24 70 24 2d 61 64 69 |hich the| $p$-adi|
|00004710| 63 20 75 6e 69 74 20 63 | 6f 72 72 65 73 70 6f 6e |c unit c|orrespon|
|00004720| 64 69 6e 67 20 74 6f 20 | 7a 20 69 73 20 64 65 66 |ding to |z is def|
|00004730| 69 6e 65 64 20 28 69 66 | 20 7a 20 69 73 20 6e 6f |ined (if| z is no|
|00004740| 74 20 30 29 2c 0a 69 2e | 65 2e 20 6f 6e 65 20 6c |t 0),.i.|e. one l|
|00004750| 65 73 73 20 74 68 61 6e | 20 74 68 65 20 6e 75 6d |ess than| the num|
|00004760| 62 65 72 20 6f 66 20 73 | 69 67 6e 69 66 69 63 61 |ber of s|ignifica|
|00004770| 6e 74 20 24 70 24 2d 61 | 64 69 63 20 64 69 67 69 |nt $p$-a|dic digi|
|00004780| 74 73 2e 20 74 68 65 20 | 73 65 63 6f 6e 64 20 77 |ts. the |second w|
|00004790| 6f 72 64 0a 63 6f 6e 74 | 61 69 6e 73 20 74 68 65 |ord.cont|ains the|
|000047a0| 20 62 69 61 73 65 64 20 | 65 78 70 6f 6e 65 6e 74 | biased |exponent|
|000047b0| 20 6f 66 20 7a 20 28 74 | 68 65 20 62 69 61 73 20 | of z (t|he bias |
|000047c0| 62 65 69 6e 67 20 68 65 | 72 65 20 65 71 75 61 6c |being he|re equal|
|000047d0| 20 74 6f 20 24 32 5e 7b | 31 35 7d 24 29 2e 0a 54 | to $2^{|15}$)..T|
|000047e0| 68 69 73 20 69 6e 66 6f | 72 6d 61 74 69 6f 6e 20 |his info|rmation |
|000047f0| 63 61 6e 20 62 65 20 68 | 61 6e 64 6c 65 64 20 75 |can be h|andled u|
|00004800| 73 69 6e 67 20 74 68 65 | 20 66 6f 6c 6c 6f 77 69 |sing the| followi|
|00004810| 6e 67 20 66 75 6e 63 74 | 69 6f 6e 73 3a 0a 0a 7b |ng funct|ions:..{|
|00004820| 5c 74 74 20 6c 6f 6e 67 | 20 5c 72 65 66 7b 70 72 |\tt long| \ref{pr|
|00004830| 65 63 70 7d 28 47 45 4e | 20 7a 29 3b 7d 20 72 65 |ecp}(GEN| z);} re|
|00004840| 74 75 72 6e 73 20 74 68 | 65 20 24 70 24 2d 61 64 |turns th|e $p$-ad|
|00004850| 69 63 20 70 72 65 63 69 | 73 69 6f 6e 20 6f 66 20 |ic preci|sion of |
|00004860| 7a 2c 20 69 2e 65 2e 20 | 6f 6e 65 20 6c 65 73 73 |z, i.e. |one less|
|00004870| 0a 74 68 61 6e 20 74 68 | 65 20 6e 75 6d 62 65 72 |.than th|e number|
|00004880| 20 6f 66 20 73 69 67 6e | 69 66 69 63 61 6e 74 20 | of sign|ificant |
|00004890| 24 70 24 2d 61 64 69 63 | 20 64 69 67 69 74 73 2e |$p$-adic| digits.|
|000048a0| 0a 0a 7b 5c 74 74 20 76 | 6f 69 64 20 5c 72 65 66 |..{\tt v|oid \ref|
|000048b0| 7b 73 65 74 70 72 65 63 | 70 7d 28 47 45 4e 20 7a |{setprec|p}(GEN z|
|000048c0| 2c 20 6c 6f 6e 67 20 6c | 29 3b 7d 20 73 65 74 73 |, long l|);} sets|
|000048d0| 20 65 71 75 61 6c 20 74 | 6f 20 7b 5c 74 74 20 6c | equal t|o {\tt l|
|000048e0| 7d 20 74 68 65 20 24 70 | 24 2d 61 64 69 63 20 70 |} the $p|$-adic p|
|000048f0| 72 65 63 69 73 69 6f 6e | 20 6f 66 20 7a 2e 0a 0a |recision| of z...|
|00004900| 7b 5c 74 74 20 6c 6f 6e | 67 20 5c 72 65 66 7b 76 |{\tt lon|g \ref{v|
|00004910| 61 6c 70 7d 28 47 45 4e | 20 7a 29 3b 7d 20 72 65 |alp}(GEN| z);} re|
|00004920| 74 75 72 6e 73 20 74 68 | 65 20 24 70 24 2d 61 64 |turns th|e $p$-ad|
|00004930| 69 63 20 76 61 6c 75 61 | 74 69 6f 6e 20 6f 66 20 |ic valua|tion of |
|00004940| 7a 20 28 69 2e 65 2e 20 | 74 68 65 0a 75 6e 62 69 |z (i.e. |the.unbi|
|00004950| 61 73 65 64 20 65 78 70 | 6f 6e 65 6e 74 29 2e 20 |ased exp|onent). |
|00004960| 54 68 69 73 20 69 73 20 | 64 65 66 69 6e 65 64 20 |This is |defined |
|00004970| 65 76 65 6e 20 69 66 20 | 7a 20 69 73 20 65 71 75 |even if |z is equ|
|00004980| 61 6c 20 74 6f 20 30 2c | 20 73 65 65 20 73 65 63 |al to 0,| see sec|
|00004990| 74 69 6f 6e 20 31 2e 32 | 2e 36 2e 0a 0a 7b 5c 74 |tion 1.2|.6...{\t|
|000049a0| 74 20 76 6f 69 64 20 5c | 72 65 66 7b 73 65 74 76 |t void \|ref{setv|
|000049b0| 61 6c 70 7d 28 47 45 4e | 20 7a 2c 20 6c 6f 6e 67 |alp}(GEN| z, long|
|000049c0| 20 65 29 3b 7d 20 73 65 | 74 73 20 65 71 75 61 6c | e);} se|ts equal|
|000049d0| 20 74 6f 20 7b 5c 74 74 | 20 65 7d 20 74 68 65 20 | to {\tt| e} the |
|000049e0| 24 70 24 2d 61 64 69 63 | 20 76 61 6c 75 61 74 69 |$p$-adic| valuati|
|000049f0| 6f 6e 20 6f 66 20 7a 2e | 0a 0a 49 6e 20 61 64 64 |on of z.|..In add|
|00004a00| 69 74 69 6f 6e 20 74 6f | 20 74 68 69 73 20 63 6f |ition to| this co|
|00004a10| 64 65 77 6f 72 64 2c 20 | 7a 5b 32 5d 20 70 6f 69 |deword, |z[2] poi|
|00004a20| 6e 74 73 20 74 6f 20 74 | 68 65 20 70 72 69 6d 65 |nts to t|he prime|
|00004a30| 20 24 70 24 2c 20 7a 5b | 33 5d 20 70 6f 69 6e 74 | $p$, z[|3] point|
|00004a40| 73 20 74 6f 0a 24 70 5e | 7b 5c 74 65 78 74 7b 70 |s to.$p^|{\text{p|
|00004a50| 72 65 63 70 28 7a 29 7d | 7d 24 2c 20 61 6e 64 20 |recp(z)}|}$, and |
|00004a60| 7a 5b 34 5d 20 70 6f 69 | 6e 74 73 20 74 6f 20 61 |z[4] poi|nts to a|
|00004a70| 6e 20 69 6e 74 65 67 65 | 72 20 72 65 70 72 65 73 |n intege|r repres|
|00004a80| 65 6e 74 69 6e 67 20 74 | 68 65 20 24 70 24 2d 61 |enting t|he $p$-a|
|00004a90| 64 69 63 0a 75 6e 69 74 | 20 61 73 73 6f 63 69 61 |dic.unit| associa|
|00004aa0| 74 65 64 20 74 6f 20 7a | 20 6d 6f 64 75 6c 6f 20 |ted to z| modulo |
|00004ab0| 7a 5b 33 5d 20 28 6f 72 | 20 70 6f 69 6e 74 73 20 |z[3] (or| points |
|00004ac0| 74 6f 20 7a 65 72 6f 20 | 69 66 20 7a 20 69 73 20 |to zero |if z is |
|00004ad0| 7a 65 72 6f 29 2e 0a 54 | 6f 20 73 75 6d 6d 61 72 |zero)..T|o summar|
|00004ae0| 69 7a 65 2c 20 77 65 20 | 68 61 76 65 20 74 68 65 |ize, we |have the|
|00004af0| 20 65 71 75 61 6c 69 74 | 79 3a 0a 24 24 7a 3d 70 | equalit|y:.$$z=p|
|00004b00| 5e 7b 5c 74 65 78 74 7b | 76 61 6c 70 28 7a 29 7d |^{\text{|valp(z)}|
|00004b10| 7d 2a 28 7a 5b 34 5d 2b | 4f 28 7a 5b 33 5d 29 29 |}*(z[4]+|O(z[3]))|
|00004b20| 3d 70 5e 7b 5c 74 65 78 | 74 7b 76 61 6c 70 28 7a |=p^{\tex|t{valp(z|
|00004b30| 29 7d 7d 2a 28 7a 5b 34 | 5d 2b 4f 28 70 5e 7b 5c |)}}*(z[4|]+O(p^{\|
|00004b40| 74 65 78 74 7b 70 72 65 | 63 70 28 7a 29 7d 7d 29 |text{pre|cp(z)}})|
|00004b50| 29 24 24 0a 0a 7b 5c 62 | 66 20 54 79 70 65 20 38 |)$$..{\b|f Type 8|
|00004b60| 20 28 71 75 61 64 72 61 | 74 69 63 20 6e 75 6d 62 | (quadra|tic numb|
|00004b70| 65 72 73 29 7d 3a 20 5c | 73 72 65 66 7b 51 75 61 |ers)}: \|sref{Qua|
|00004b80| 64 72 61 74 69 63 20 6e | 75 6d 62 65 72 7d 0a 7a |dratic n|umber}.z|
|00004b90| 5b 31 5d 20 70 6f 69 6e | 74 73 20 6f 6e 20 74 68 |[1] poin|ts on th|
|00004ba0| 65 20 70 6f 6c 79 6e 6f | 6d 69 61 6c 20 64 65 66 |e polyno|mial def|
|00004bb0| 69 6e 69 6e 67 20 74 68 | 65 0a 71 75 61 64 72 61 |ining th|e.quadra|
|00004bc0| 74 69 63 20 66 69 65 6c | 64 2c 20 7a 5b 32 5d 20 |tic fiel|d, z[2] |
|00004bd0| 6f 6e 20 74 68 65 20 60 | 60 72 65 61 6c 20 70 61 |on the `|`real pa|
|00004be0| 72 74 27 27 20 61 6e 64 | 20 7a 5b 33 5d 20 6f 6e |rt'' and| z[3] on|
|00004bf0| 20 74 68 65 20 60 60 69 | 6d 61 67 69 6e 61 72 79 | the ``i|maginary|
|00004c00| 20 70 61 72 74 27 27 2c | 0a 77 68 65 72 65 20 74 | part'',|.where t|
|00004c10| 68 69 73 20 69 73 20 74 | 6f 20 62 65 20 74 61 6b |his is t|o be tak|
|00004c20| 65 6e 20 61 73 20 74 68 | 65 20 63 6f 65 66 66 69 |en as th|e coeffi|
|00004c30| 63 69 65 6e 74 73 20 6f | 66 20 7a 20 6f 6e 20 74 |cients o|f z on t|
|00004c40| 68 65 20 60 60 63 61 6e | 6f 6e 69 63 61 6c 27 27 |he ``can|onical''|
|00004c50| 20 62 61 73 69 73 20 28 | 31 2c 77 29 0a 28 73 65 | basis (|1,w).(se|
|00004c60| 65 20 73 65 63 74 69 6f | 6e 20 31 2e 32 2e 33 29 |e sectio|n 1.2.3)|
|00004c70| 2e 20 43 6f 6d 70 6c 65 | 78 20 6e 75 6d 62 65 72 |. Comple|x number|
|00004c80| 73 20 61 72 65 20 70 61 | 72 74 69 63 75 6c 61 72 |s are pa|rticular|
|00004c90| 20 63 61 73 65 73 20 6f | 66 20 71 75 61 64 72 61 | cases o|f quadra|
|00004ca0| 74 69 63 73 20 62 75 74 | 20 64 65 73 65 72 76 65 |tics but| deserve|
|00004cb0| 0a 61 20 73 65 70 61 72 | 61 74 65 20 74 79 70 65 |.a separ|ate type|
|00004cc0| 2e 0a 0a 7b 5c 62 66 20 | 54 79 70 65 20 39 20 28 |...{\bf |Type 9 (|
|00004cd0| 70 6f 6c 79 6d 6f 64 73 | 29 7d 3a 20 5c 73 72 65 |polymods|)}: \sre|
|00004ce0| 66 7b 50 6f 6c 79 6d 6f | 64 7d 0a 65 78 61 63 74 |f{Polymo|d}.exact|
|00004cf0| 6c 79 20 61 73 20 66 6f | 72 20 69 6e 74 65 67 65 |ly as fo|r intege|
|00004d00| 72 6d 6f 64 73 2c 20 7a | 5b 31 5d 20 70 6f 69 6e |rmods, z|[1] poin|
|00004d10| 74 73 20 6f 6e 20 74 68 | 65 20 6d 6f 64 75 6c 75 |ts on th|e modulu|
|00004d20| 73 2c 0a 61 6e 64 20 7a | 5b 32 5d 20 6f 6e 20 61 |s,.and z|[2] on a|
|00004d30| 20 70 6f 6c 79 6e 6f 6d | 69 61 6c 20 72 65 70 72 | polynom|ial repr|
|00004d40| 65 73 65 6e 74 69 6e 67 | 20 74 68 65 20 63 6c 61 |esenting| the cla|
|00004d50| 73 73 20 6f 66 20 7a 2e | 20 42 6f 74 68 20 6d 75 |ss of z.| Both mu|
|00004d60| 73 74 20 62 65 20 6f 66 | 20 74 79 70 65 20 0a 70 |st be of| type .p|
|00004d70| 6f 6c 79 6e 6f 6d 69 61 | 6c 2e 20 48 6f 77 65 76 |olynomia|l. Howev|
|00004d80| 65 72 2c 20 6f 6e 65 20 | 6d 75 73 74 20 6f 62 65 |er, one |must obe|
|00004d90| 79 20 74 68 65 20 72 75 | 6c 65 73 20 65 78 70 6c |y the ru|les expl|
|00004da0| 61 69 6e 65 64 20 69 6e | 20 63 68 61 70 74 65 72 |ained in| chapter|
|00004db0| 20 32 20 63 6f 6e 63 65 | 72 6e 69 6e 67 0a 74 68 | 2 conce|rning.th|
|00004dc0| 65 20 68 69 65 72 61 72 | 63 68 69 63 61 6c 20 73 |e hierar|chical s|
|00004dd0| 74 72 75 63 74 75 72 65 | 20 6f 66 20 74 68 65 20 |tructure| of the |
|00004de0| 76 61 72 69 61 62 6c 65 | 73 20 6f 66 20 61 20 70 |variable|s of a p|
|00004df0| 6f 6c 79 6d 6f 64 2e 0a | 0a 7b 5c 62 66 20 54 79 |olymod..|.{\bf Ty|
|00004e00| 70 65 20 31 30 20 28 70 | 6f 6c 79 6e 6f 6d 69 61 |pe 10 (p|olynomia|
|00004e10| 6c 73 29 7d 3a 20 5c 73 | 72 65 66 7b 50 6f 6c 79 |ls)}: \s|ref{Poly|
|00004e20| 6e 6f 6d 69 61 6c 7d 0a | 74 68 69 73 20 74 79 70 |nomial}.|this typ|
|00004e30| 65 20 68 61 73 20 61 20 | 73 65 63 6f 6e 64 20 63 |e has a |second c|
|00004e40| 6f 64 65 77 6f 72 64 20 | 77 68 69 63 68 20 69 73 |odeword |which is|
|00004e50| 20 61 6e 61 6c 6f 67 6f | 75 73 20 74 6f 0a 74 68 | analogo|us to.th|
|00004e60| 65 20 6f 6e 65 20 66 6f | 72 20 69 6e 74 65 67 65 |e one fo|r intege|
|00004e70| 72 73 2e 20 54 68 65 20 | 66 69 72 73 74 20 62 79 |rs. The |first by|
|00004e80| 74 65 20 69 73 20 74 68 | 65 20 60 60 73 69 67 6e |te is th|e ``sign|
|00004e90| 27 27 2c 20 69 2e 65 2e | 20 30 20 69 66 20 74 68 |'', i.e.| 0 if th|
|00004ea0| 65 20 70 6f 6c 79 6e 6f | 6d 69 61 6c 0a 69 73 20 |e polyno|mial.is |
|00004eb0| 65 71 75 61 6c 20 74 6f | 20 30 2c 20 61 6e 64 20 |equal to| 0, and |
|00004ec0| 31 20 69 66 20 6e 6f 74 | 20 28 73 65 65 20 68 6f |1 if not| (see ho|
|00004ed0| 77 65 76 65 72 20 74 68 | 65 20 69 6d 70 6f 72 74 |wever th|e import|
|00004ee0| 61 6e 74 20 72 65 6d 61 | 72 6b 20 62 65 6c 6f 77 |ant rema|rk below|
|00004ef0| 29 2e 0a 54 68 65 20 73 | 65 63 6f 6e 64 20 62 79 |)..The s|econd by|
|00004f00| 74 65 20 69 73 20 74 68 | 65 20 76 61 72 69 61 62 |te is th|e variab|
|00004f10| 6c 65 20 6e 75 6d 62 65 | 72 20 0a 28 65 2e 67 2e |le numbe|r .(e.g.|
|00004f20| 20 30 20 66 6f 72 20 24 | 58 24 2c 20 31 20 66 6f | 0 for $|X$, 1 fo|
|00004f30| 72 20 24 59 24 2c 20 65 | 74 63 5c 64 6f 74 73 29 |r $Y$, e|tc\dots)|
|00004f40| 2e 20 54 68 69 73 20 6e | 75 6d 62 65 72 20 63 61 |. This n|umber ca|
|00004f50| 6e 20 62 65 20 68 61 6e | 64 6c 65 64 20 77 69 74 |n be han|dled wit|
|00004f60| 68 20 74 68 65 20 0a 66 | 6f 6c 6c 6f 77 69 6e 67 |h the .f|ollowing|
|00004f70| 20 66 75 6e 63 74 69 6f | 6e 73 3a 0a 0a 7b 5c 74 | functio|ns:..{\t|
|00004f80| 74 20 6c 6f 6e 67 20 5c | 72 65 66 7b 76 61 72 6e |t long \|ref{varn|
|00004f90| 7d 28 47 45 4e 20 7a 29 | 3b 7d 20 72 65 74 75 72 |}(GEN z)|;} retur|
|00004fa0| 6e 73 20 74 68 65 20 76 | 61 72 69 61 62 6c 65 20 |ns the v|ariable |
|00004fb0| 6e 75 6d 62 65 72 20 6f | 66 20 74 68 65 20 6f 62 |number o|f the ob|
|00004fc0| 6a 65 63 74 20 7a 2e 0a | 0a 4e 6f 74 65 20 61 6c |ject z..|.Note al|
|00004fd0| 73 6f 20 74 68 65 20 66 | 75 6e 63 74 69 6f 6e 20 |so the f|unction |
|00004fe0| 7b 5c 74 74 20 6c 6f 6e | 67 20 5c 72 65 66 7b 67 |{\tt lon|g \ref{g|
|00004ff0| 76 61 72 7d 28 47 45 4e | 20 7a 29 7d 20 77 68 69 |var}(GEN| z)} whi|
|00005000| 63 68 20 74 72 69 65 73 | 20 74 6f 20 72 65 74 75 |ch tries| to retu|
|00005010| 72 6e 20 61 20 76 61 72 | 69 61 62 6c 65 20 6e 75 |rn a var|iable nu|
|00005020| 6d 62 65 72 0a 66 6f 72 | 20 24 7a 24 2c 20 65 76 |mber.for| $z$, ev|
|00005030| 65 6e 20 69 66 20 24 7a | 24 20 69 73 20 6e 6f 74 |en if $z|$ is not|
|00005040| 20 61 20 70 6f 6c 79 6e | 6f 6d 69 61 6c 20 6f 72 | a polyn|omial or|
|00005050| 20 70 6f 77 65 72 20 73 | 65 72 69 65 73 2e 20 54 | power s|eries. T|
|00005060| 68 65 20 76 61 72 69 61 | 62 6c 65 20 6e 75 6d 62 |he varia|ble numb|
|00005070| 65 72 20 6f 66 0a 61 20 | 73 63 61 6c 61 72 20 74 |er of.a |scalar t|
|00005080| 79 70 65 20 69 73 20 73 | 65 74 20 62 79 20 64 65 |ype is s|et by de|
|00005090| 66 69 6e 69 74 69 6f 6e | 20 65 71 75 61 6c 20 74 |finition| equal t|
|000050a0| 6f 20 33 32 37 36 37 2e | 0a 0a 7b 5c 74 74 20 76 |o 32767.|..{\tt v|
|000050b0| 6f 69 64 20 5c 72 65 66 | 7b 73 65 74 76 61 72 6e |oid \ref|{setvarn|
|000050c0| 7d 28 47 45 4e 20 7a 2c | 6c 6f 6e 67 20 76 29 3b |}(GEN z,|long v);|
|000050d0| 7d 20 73 65 74 73 20 65 | 71 75 61 6c 20 74 6f 20 |} sets e|qual to |
|000050e0| 7b 5c 74 74 20 76 7d 20 | 74 68 65 20 76 61 72 69 |{\tt v} |the vari|
|000050f0| 61 62 6c 65 20 6e 75 6d | 62 65 72 20 6f 66 20 7a |able num|ber of z|
|00005100| 2e 0a 0a 54 68 65 20 6c | 65 61 73 74 20 73 69 67 |...The l|east sig|
|00005110| 6e 69 66 69 63 61 6e 74 | 20 77 6f 72 64 20 6f 66 |nificant| word of|
|00005120| 20 74 68 65 20 73 65 63 | 6f 6e 64 20 63 6f 64 65 | the sec|ond code|
|00005130| 77 6f 72 64 20 69 73 20 | 74 68 65 20 65 66 66 65 |word is |the effe|
|00005140| 63 74 69 76 65 20 6c 65 | 6e 67 74 68 20 6f 66 0a |ctive le|ngth of.|
|00005150| 74 68 65 20 70 6f 6c 79 | 6e 6f 6d 69 61 6c 2e 20 |the poly|nomial. |
|00005160| 4e 6f 74 65 20 74 68 61 | 74 20 74 68 65 20 64 65 |Note tha|t the de|
|00005170| 67 72 65 65 20 6f 66 20 | 74 68 65 20 70 6f 6c 79 |gree of |the poly|
|00005180| 6e 6f 6d 69 61 6c 20 69 | 73 20 65 71 75 61 6c 20 |nomial i|s equal |
|00005190| 74 6f 20 74 68 65 20 65 | 66 66 65 63 74 69 76 65 |to the e|ffective|
|000051a0| 0a 6c 65 6e 67 74 68 20 | 6d 69 6e 75 73 20 74 68 |.length |minus th|
|000051b0| 72 65 65 2e 20 54 68 65 | 20 66 75 6e 63 74 69 6f |ree. The| functio|
|000051c0| 6e 73 20 75 73 65 64 20 | 74 6f 20 68 61 6e 64 6c |ns used |to handl|
|000051d0| 65 20 74 68 69 73 20 63 | 6f 64 65 77 6f 72 64 20 |e this c|odeword |
|000051e0| 61 72 65 20 74 68 65 20 | 73 61 6d 65 0a 61 73 20 |are the |same.as |
|000051f0| 66 6f 72 20 69 6e 74 65 | 67 65 72 73 2e 20 54 68 |for inte|gers. Th|
|00005200| 65 20 63 6f 6d 70 6f 6e | 65 6e 74 73 20 7a 5b 32 |e compon|ents z[2|
|00005210| 5d 2c 20 7a 5b 33 5d 2c | 5c 64 6f 74 73 20 7a 5b |], z[3],|\dots z[|
|00005220| 6c 67 65 66 28 7a 29 2d | 31 5d 0a 70 6f 69 6e 74 |lgef(z)-|1].point|
|00005230| 20 74 6f 20 74 68 65 20 | 63 6f 65 66 66 69 63 69 | to the |coeffici|
|00005240| 65 6e 74 73 20 6f 66 20 | 74 68 65 20 70 6f 6c 79 |ents of |the poly|
|00005250| 6e 6f 6d 69 61 6c 20 7b | 5c 69 74 20 69 6e 20 61 |nomial {|\it in a|
|00005260| 73 63 65 6e 64 69 6e 67 | 20 6f 72 64 65 72 5c 2f |scending| order\/|
|00005270| 7d 2c 20 77 69 74 68 0a | 7a 5b 32 5d 20 62 65 69 |}, with.|z[2] bei|
|00005280| 6e 67 20 74 68 65 20 63 | 6f 6e 73 74 61 6e 74 20 |ng the c|onstant |
|00005290| 74 65 72 6d 20 61 6e 64 | 20 73 6f 20 6f 6e 2e 0a |term and| so on..|
|000052a0| 0a 7b 5c 73 6c 20 49 6d | 70 6f 72 74 61 6e 74 20 |.{\sl Im|portant |
|000052b0| 72 65 6d 61 72 6b 5c 2f | 7d 2e 20 41 20 7a 65 72 |remark\/|}. A zer|
|000052c0| 6f 20 70 6f 6c 79 6e 6f | 6d 69 61 6c 20 63 61 6e |o polyno|mial can|
|000052d0| 20 62 65 20 63 68 61 72 | 61 63 74 65 72 69 7a 65 | be char|acterize|
|000052e0| 64 20 62 79 20 74 68 65 | 20 66 61 63 74 0a 74 68 |d by the| fact.th|
|000052f0| 61 74 20 69 74 73 20 73 | 69 67 6e 20 69 73 20 30 |at its s|ign is 0|
|00005300| 2e 20 48 6f 77 65 76 65 | 72 2c 20 69 74 73 20 65 |. Howeve|r, its e|
|00005310| 66 66 65 63 74 69 76 65 | 20 6c 65 6e 67 74 68 20 |ffective| length |
|00005320| 6d 61 79 20 62 65 20 65 | 71 75 61 6c 20 74 6f 20 |may be e|qual to |
|00005330| 32 2c 20 6f 72 20 67 72 | 65 61 74 65 72 0a 74 68 |2, or gr|eater.th|
|00005340| 61 6e 20 32 2e 20 49 66 | 20 69 74 20 69 73 20 67 |an 2. If| it is g|
|00005350| 72 65 61 74 65 72 20 74 | 68 61 6e 20 32 2c 20 74 |reater t|han 2, t|
|00005360| 68 69 73 20 6d 65 61 6e | 73 20 74 68 61 74 20 61 |his mean|s that a|
|00005370| 6c 6c 20 74 68 65 20 63 | 6f 65 66 66 69 63 69 65 |ll the c|oefficie|
|00005380| 6e 74 73 20 6f 66 20 74 | 68 65 0a 70 6f 6c 79 6e |nts of t|he.polyn|
|00005390| 6f 6d 69 61 6c 20 61 72 | 65 20 65 71 75 61 6c 20 |omial ar|e equal |
|000053a0| 74 6f 20 7a 65 72 6f 20 | 28 61 73 20 74 68 65 79 |to zero |(as they|
|000053b0| 20 73 68 6f 75 6c 64 20 | 66 6f 72 20 61 20 7a 65 | should |for a ze|
|000053c0| 72 6f 20 70 6f 6c 79 6e | 6f 6d 69 61 6c 29 2c 20 |ro polyn|omial), |
|000053d0| 62 75 74 20 6e 6f 74 0a | 61 6c 6c 20 6f 66 20 74 |but not.|all of t|
|000053e0| 68 65 73 65 20 7a 65 72 | 6f 73 20 61 72 65 20 65 |hese zer|os are e|
|000053f0| 78 61 63 74 20 7a 65 72 | 6f 73 2c 20 61 6e 64 20 |xact zer|os, and |
|00005400| 6d 6f 72 65 20 70 72 65 | 63 69 73 65 6c 79 20 74 |more pre|cisely t|
|00005410| 68 65 20 6c 65 61 64 69 | 6e 67 20 74 65 72 6d 0a |he leadi|ng term.|
|00005420| 7a 5b 6c 67 65 66 28 7a | 29 2d 31 5d 20 69 73 20 |z[lgef(z|)-1] is |
|00005430| 6e 6f 74 20 61 6e 20 65 | 78 61 63 74 20 7a 65 72 |not an e|xact zer|
|00005440| 6f 2e 0a 0a 7b 5c 62 66 | 20 54 79 70 65 20 31 31 |o...{\bf| Type 11|
|00005450| 20 28 70 6f 77 65 72 20 | 73 65 72 69 65 73 29 7d | (power |series)}|
|00005460| 3a 20 5c 73 72 65 66 7b | 50 6f 77 65 72 20 73 65 |: \sref{|Power se|
|00005470| 72 69 65 73 7d 0a 54 68 | 69 73 20 74 79 70 65 20 |ries}.Th|is type |
|00005480| 61 6c 73 6f 20 68 61 73 | 20 61 20 73 65 63 6f 6e |also has| a secon|
|00005490| 64 20 63 6f 64 65 77 6f | 72 64 2e 0a 49 74 73 20 |d codewo|rd..Its |
|000054a0| 66 69 72 73 74 20 62 79 | 74 65 20 69 73 20 74 68 |first by|te is th|
|000054b0| 65 20 60 60 73 69 67 6e | 27 27 2c 20 69 2e 65 2e |e ``sign|'', i.e.|
|000054c0| 20 30 20 69 66 20 74 68 | 65 20 70 6f 77 65 72 20 | 0 if th|e power |
|000054d0| 73 65 72 69 65 73 0a 69 | 73 20 30 2c 20 61 6e 64 |series.i|s 0, and|
|000054e0| 20 31 20 69 66 20 6e 6f | 74 2e 20 54 68 65 20 73 | 1 if no|t. The s|
|000054f0| 65 63 6f 6e 64 20 62 79 | 74 65 20 69 73 20 74 68 |econd by|te is th|
|00005500| 65 20 76 61 72 69 61 62 | 6c 65 20 6e 75 6d 62 65 |e variab|le numbe|
|00005510| 72 2c 20 61 73 20 66 6f | 72 20 70 6f 6c 79 6e 6f |r, as fo|r polyno|
|00005520| 6d 69 61 6c 73 2e 0a 54 | 68 65 20 6c 61 73 74 20 |mials..T|he last |
|00005530| 74 77 6f 20 62 79 74 65 | 73 20 63 6f 64 65 20 66 |two byte|s code f|
|00005540| 6f 72 20 61 20 62 69 61 | 73 65 64 20 65 78 70 6f |or a bia|sed expo|
|00005550| 6e 65 6e 74 20 77 69 74 | 68 20 61 20 62 69 61 73 |nent wit|h a bias|
|00005560| 20 6f 66 0a 24 32 5e 7b | 31 35 7d 24 2e 20 54 68 | of.$2^{|15}$. Th|
|00005570| 69 73 20 69 6e 66 6f 72 | 6d 61 74 69 6f 6e 20 63 |is infor|mation c|
|00005580| 61 6e 20 62 65 20 68 61 | 6e 64 6c 65 64 20 77 69 |an be ha|ndled wi|
|00005590| 74 68 20 74 68 65 20 66 | 6f 6c 6c 6f 77 69 6e 67 |th the f|ollowing|
|000055a0| 20 66 75 6e 63 74 69 6f | 6e 73 3a 0a 0a 7b 5c 74 | functio|ns:..{\t|
|000055b0| 74 20 5c 72 65 66 7b 73 | 69 67 6e 65 7d 2c 20 5c |t \ref{s|igne}, \|
|000055c0| 72 65 66 7b 73 65 74 73 | 69 67 6e 65 7d 2c 20 5c |ref{sets|igne}, \|
|000055d0| 72 65 66 7b 76 61 72 6e | 7d 2c 20 5c 72 65 66 7b |ref{varn|}, \ref{|
|000055e0| 73 65 74 76 61 72 6e 7d | 7d 20 61 73 20 66 6f 72 |setvarn}|} as for|
|000055f0| 20 0a 70 6f 6c 79 6e 6f | 6d 69 61 6c 73 2c 20 61 | .polyno|mials, a|
|00005600| 6e 64 20 7b 5c 74 74 20 | 5c 72 65 66 7b 76 61 6c |nd {\tt |\ref{val|
|00005610| 70 7d 2c 20 5c 72 65 66 | 7b 73 65 74 76 61 6c 70 |p}, \ref|{setvalp|
|00005620| 7d 7d 20 66 6f 72 0a 74 | 68 65 20 65 78 70 6f 6e |}} for.t|he expon|
|00005630| 65 6e 74 2e 20 42 65 77 | 61 72 65 20 6e 6f 74 20 |ent. Bew|are not |
|00005640| 74 6f 20 75 73 65 20 7b | 5c 74 74 20 65 78 70 6f |to use {|\tt expo|
|00005650| 7d 20 61 6e 64 20 7b 5c | 74 74 20 73 65 74 65 78 |} and {\|tt setex|
|00005660| 70 6f 7d 20 66 6f 72 20 | 70 6f 77 65 72 20 73 65 |po} for |power se|
|00005670| 72 69 65 73 2e 0a 0a 49 | 66 20 74 68 65 20 70 6f |ries...I|f the po|
|00005680| 77 65 72 20 73 65 72 69 | 65 73 20 69 73 20 6e 6f |wer seri|es is no|
|00005690| 6e 20 7a 65 72 6f 2c 20 | 7a 5b 32 5d 2c 20 7a 5b |n zero, |z[2], z[|
|000056a0| 33 5d 2c 5c 64 6f 74 73 | 20 7a 5b 6c 67 28 7a 29 |3],\dots| z[lg(z)|
|000056b0| 2d 31 5d 20 70 6f 69 6e | 74 20 74 6f 20 74 68 65 |-1] poin|t to the|
|000056c0| 0a 63 6f 65 66 66 69 63 | 69 65 6e 74 73 20 6f 66 |.coeffic|ients of|
|000056d0| 20 7a 20 69 6e 20 61 73 | 63 65 6e 64 69 6e 67 20 | z in as|cending |
|000056e0| 6f 72 64 65 72 2c 20 7a | 5b 32 5d 20 62 65 69 6e |order, z|[2] bein|
|000056f0| 67 20 74 68 65 20 66 69 | 72 73 74 20 6e 6f 6e 2d |g the fi|rst non-|
|00005700| 7a 65 72 6f 20 63 6f 65 | 66 66 69 63 69 65 6e 74 |zero coe|fficient|
|00005710| 2e 0a 4e 6f 74 65 20 74 | 68 61 74 20 74 68 65 20 |..Note t|hat the |
|00005720| 65 78 70 6f 6e 65 6e 74 | 20 6f 66 20 61 20 70 6f |exponent| of a po|
|00005730| 77 65 72 20 73 65 72 69 | 65 73 20 63 61 6e 20 62 |wer seri|es can b|
|00005740| 65 20 6e 65 67 61 74 69 | 76 65 2c 20 69 2e 65 2e |e negati|ve, i.e.|
|00005750| 20 77 65 20 63 61 6e 20 | 64 65 61 6c 20 77 69 74 | we can |deal wit|
|00005760| 68 0a 4c 61 75 72 65 6e | 74 20 73 65 72 69 65 73 |h.Lauren|t series|
|00005770| 20 77 69 74 68 20 61 20 | 66 69 6e 69 74 65 20 6e | with a |finite n|
|00005780| 75 6d 62 65 72 20 6f 66 | 20 6e 65 67 61 74 69 76 |umber of| negativ|
|00005790| 65 20 74 65 72 6d 73 2e | 0a 0a 7b 5c 62 66 20 54 |e terms.|..{\bf T|
|000057a0| 79 70 65 73 20 31 33 20 | 61 6e 64 20 31 34 20 28 |ypes 13 |and 14 (|
|000057b0| 72 61 74 69 6f 6e 61 6c | 20 66 75 6e 63 74 69 6f |rational| functio|
|000057c0| 6e 73 29 7d 3a 20 5c 73 | 72 65 66 7b 52 61 74 69 |ns)}: \s|ref{Rati|
|000057d0| 6f 6e 61 6c 20 66 75 6e | 63 74 69 6f 6e 7d 0a 7a |onal fun|ction}.z|
|000057e0| 5b 31 5d 20 70 6f 69 6e | 74 73 20 6f 6e 20 74 68 |[1] poin|ts on th|
|000057f0| 65 20 6e 75 6d 65 72 61 | 74 6f 72 2c 20 61 6e 64 |e numera|tor, and|
|00005800| 20 7a 5b 32 5d 0a 6f 6e | 20 74 68 65 20 64 65 6e | z[2].on| the den|
|00005810| 6f 6d 69 6e 61 74 6f 72 | 2e 20 42 6f 74 68 20 6d |ominator|. Both m|
|00005820| 75 73 74 20 62 65 20 6f | 66 20 74 79 70 65 20 70 |ust be o|f type p|
|00005830| 6f 6c 79 6e 6f 6d 69 61 | 6c 2e 0a 0a 7b 5c 62 66 |olynomia|l...{\bf|
|00005840| 20 54 79 70 65 20 31 36 | 20 28 62 69 6e 61 72 79 | Type 16| (binary|
|00005850| 20 71 75 61 64 72 61 74 | 69 63 20 66 6f 72 6d 73 | quadrat|ic forms|
|00005860| 29 7d 3a 20 5c 73 72 65 | 66 7b 42 69 6e 61 72 79 |)}: \sre|f{Binary|
|00005870| 20 71 75 61 64 72 61 74 | 69 63 20 66 6f 72 6d 7d | quadrat|ic form}|
|00005880| 0a 7a 5b 31 5d 2c 20 7a | 5b 32 5d 2c 20 7a 5b 33 |.z[1], z|[2], z[3|
|00005890| 5d 20 70 6f 69 6e 74 20 | 6f 6e 20 74 68 65 20 74 |] point |on the t|
|000058a0| 68 72 65 65 0a 63 6f 65 | 66 66 69 63 69 65 6e 74 |hree.coe|fficient|
|000058b0| 73 20 6f 66 20 74 68 65 | 20 66 6f 72 6d 2e 20 41 |s of the| form. A|
|000058c0| 6c 6c 20 74 68 72 65 65 | 20 73 68 6f 75 6c 64 20 |ll three| should |
|000058d0| 62 65 20 6f 66 20 74 79 | 70 65 20 69 6e 74 65 67 |be of ty|pe integ|
|000058e0| 65 72 2e 0a 0a 7b 5c 62 | 66 20 54 79 70 65 73 20 |er...{\b|f Types |
|000058f0| 31 37 20 61 6e 64 20 31 | 38 20 28 76 65 63 74 6f |17 and 1|8 (vecto|
|00005900| 72 73 29 7d 3a 20 5c 73 | 72 65 66 7b 52 6f 77 20 |rs)}: \s|ref{Row |
|00005910| 76 65 63 74 6f 72 7d 5c | 73 72 65 66 7b 43 6f 6c |vector}\|sref{Col|
|00005920| 75 6d 6e 20 76 65 63 74 | 6f 72 7d 0a 7a 5b 31 5d |umn vect|or}.z[1]|
|00005930| 2c 20 7a 5b 32 5d 2c 5c | 64 6f 74 73 20 7a 5b 6c |, z[2],\|dots z[l|
|00005940| 67 28 7a 29 2d 31 5d 20 | 70 6f 69 6e 74 20 6f 6e |g(z)-1] |point on|
|00005950| 20 74 68 65 20 63 6f 6d | 70 6f 6e 65 6e 74 73 0a | the com|ponents.|
|00005960| 6f 66 20 74 68 65 20 76 | 65 63 74 6f 72 2e 0a 0a |of the v|ector...|
|00005970| 7b 5c 62 66 20 54 79 70 | 65 20 31 39 20 28 6d 61 |{\bf Typ|e 19 (ma|
|00005980| 74 72 69 63 65 73 29 7d | 3a 20 5c 73 72 65 66 7b |trices)}|: \sref{|
|00005990| 4d 61 74 72 69 78 7d 0a | 7a 5b 31 5d 2c 20 7a 5b |Matrix}.|z[1], z[|
|000059a0| 32 5d 2c 5c 64 6f 74 73 | 20 7a 5b 6c 67 28 7a 29 |2],\dots| z[lg(z)|
|000059b0| 2d 31 5d 20 70 6f 69 6e | 74 20 6f 6e 20 74 68 65 |-1] poin|t on the|
|000059c0| 20 63 6f 6c 75 6d 6e 20 | 76 65 63 74 6f 72 73 0a | column |vectors.|
|000059d0| 6f 66 20 7a 2c 20 69 2e | 65 2e 20 74 68 65 79 20 |of z, i.|e. they |
|000059e0| 6d 75 73 74 20 62 65 20 | 6f 66 20 74 79 70 65 20 |must be |of type |
|000059f0| 31 38 20 61 6e 64 20 6f | 66 20 74 68 65 20 73 61 |18 and o|f the sa|
|00005a00| 6d 65 20 6c 65 6e 67 74 | 68 2e 0a 0a 5c 73 75 62 |me lengt|h...\sub|
|00005a10| 73 65 63 7b 41 73 73 69 | 67 6e 6d 65 6e 74 20 61 |sec{Assi|gnment a|
|00005a20| 6e 64 20 63 6f 70 79 69 | 6e 67 20 6f 66 20 50 41 |nd copyi|ng of PA|
|00005a30| 52 49 20 6f 62 6a 65 63 | 74 73 7d 2e 0a 0a 54 68 |RI objec|ts}...Th|
|00005a40| 65 20 67 65 6e 65 72 61 | 6c 20 5c 72 65 66 7b 61 |e genera|l \ref{a|
|00005a50| 73 73 69 67 6e 6d 65 6e | 74 7d 20 66 75 6e 63 74 |ssignmen|t} funct|
|00005a60| 69 6f 6e 20 69 73 20 74 | 68 65 20 66 75 6e 63 74 |ion is t|he funct|
|00005a70| 69 6f 6e 20 7b 5c 62 66 | 20 5c 72 65 66 7b 67 61 |ion {\bf| \ref{ga|
|00005a80| 66 66 65 63 74 7d 7d 20 | 77 69 74 68 0a 74 68 65 |ffect}} |with.the|
|00005a90| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 73 79 6e 74 61 | followi|ng synta|
|00005aa0| 78 3a 0a 0a 7b 5c 74 74 | 20 76 6f 69 64 20 67 61 |x:..{\tt| void ga|
|00005ab0| 66 66 65 63 74 28 47 45 | 4e 20 78 2c 20 47 45 4e |ffect(GE|N x, GEN|
|00005ac0| 20 79 29 3b 7d 0a 0a 49 | 74 73 20 65 66 66 65 63 | y);}..I|ts effec|
|00005ad0| 74 20 69 73 20 74 6f 20 | 61 73 73 69 67 6e 20 74 |t is to |assign t|
|00005ae0| 68 65 20 50 41 52 49 20 | 6f 62 6a 65 63 74 20 78 |he PARI |object x|
|00005af0| 20 69 6e 74 6f 20 74 68 | 65 20 28 70 72 65 65 78 | into th|e (preex|
|00005b00| 69 73 74 69 6e 67 29 20 | 6f 62 6a 65 63 74 20 79 |isting) |object y|
|00005b10| 2e 0a 4d 61 6e 79 20 63 | 6f 6e 64 69 74 69 6f 6e |..Many c|ondition|
|00005b20| 73 20 6d 75 73 74 20 62 | 65 20 6d 65 74 20 66 6f |s must b|e met fo|
|00005b30| 72 20 74 68 65 20 61 73 | 73 69 67 6e 6d 65 6e 74 |r the as|signment|
|00005b40| 20 74 6f 20 62 65 20 70 | 6f 73 73 69 62 6c 65 2e | to be p|ossible.|
|00005b50| 20 46 6f 72 20 69 6e 73 | 74 61 6e 63 65 20 69 74 | For ins|tance it|
|00005b60| 20 69 73 0a 61 6c 6c 6f | 77 65 64 20 74 6f 20 61 | is.allo|wed to a|
|00005b70| 73 73 69 67 6e 20 61 6e | 20 69 6e 74 65 67 65 72 |ssign an| integer|
|00005b80| 20 69 6e 74 6f 20 61 20 | 72 65 61 6c 20 6e 75 6d | into a |real num|
|00005b90| 62 65 72 2c 20 62 75 74 | 20 74 68 65 20 63 6f 6e |ber, but| the con|
|00005ba0| 76 65 72 73 65 20 69 73 | 20 66 6f 72 62 69 64 64 |verse is| forbidd|
|00005bb0| 65 6e 2e 0a 46 6f 72 20 | 74 68 61 74 2c 20 79 6f |en..For |that, yo|
|00005bc0| 75 20 6d 75 73 74 20 75 | 73 65 20 74 68 65 20 74 |u must u|se the t|
|00005bd0| 72 75 6e 63 61 74 69 6f | 6e 20 6f 72 20 72 6f 75 |runcatio|n or rou|
|00005be0| 6e 64 69 6e 67 20 66 75 | 6e 63 74 69 6f 6e 20 6f |nding fu|nction o|
|00005bf0| 66 20 79 6f 75 72 20 63 | 68 6f 69 63 65 0a 28 73 |f your c|hoice.(s|
|00005c00| 65 65 20 73 65 63 74 69 | 6f 6e 20 33 2e 32 29 2e |ee secti|on 3.2).|
|00005c10| 20 49 74 20 63 61 6e 0a | 61 6c 73 6f 20 68 61 70 | It can.|also hap|
|00005c20| 70 65 6e 20 74 68 61 74 | 20 79 20 69 73 20 6e 6f |pen that| y is no|
|00005c30| 74 20 6c 61 72 67 65 20 | 65 6e 6f 75 67 68 20 6f |t large |enough o|
|00005c40| 72 20 64 6f 65 73 20 6e | 6f 74 20 68 61 76 65 20 |r does n|ot have |
|00005c50| 74 68 65 20 70 72 6f 70 | 65 72 20 74 72 65 65 20 |the prop|er tree |
|00005c60| 73 74 72 75 63 74 75 72 | 65 0a 74 6f 20 72 65 63 |structur|e.to rec|
|00005c70| 65 69 76 65 20 74 68 65 | 20 6f 62 6a 65 63 74 20 |eive the| object |
|00005c80| 78 2e 20 41 73 20 61 6e | 20 65 78 74 72 65 6d 65 |x. As an| extreme|
|00005c90| 20 65 78 61 6d 70 6c 65 | 2c 20 61 73 73 75 6d 65 | example|, assume|
|00005ca0| 20 79 20 69 73 20 74 68 | 65 20 7a 65 72 6f 20 69 | y is th|e zero i|
|00005cb0| 6e 74 65 67 65 72 20 77 | 69 74 68 0a 6c 65 6e 67 |nteger w|ith.leng|
|00005cc0| 74 68 20 65 71 75 61 6c | 20 74 6f 20 32 2e 20 54 |th equal| to 2. T|
|00005cd0| 68 65 6e 20 61 6c 6c 20 | 61 73 73 69 67 6e 6d 65 |hen all |assignme|
|00005ce0| 6e 74 73 20 6f 66 20 61 | 20 6e 6f 6e 20 7a 65 72 |nts of a| non zer|
|00005cf0| 6f 20 69 6e 74 65 67 65 | 72 20 69 6e 74 6f 20 79 |o intege|r into y|
|00005d00| 20 77 69 6c 6c 0a 72 65 | 73 75 6c 74 20 69 6e 20 | will.re|sult in |
|00005d10| 61 6e 20 65 72 72 6f 72 | 20 6d 65 73 73 61 67 65 |an error| message|
|00005d20| 20 73 69 6e 63 65 20 79 | 20 69 73 20 6e 6f 74 20 | since y| is not |
|00005d30| 6c 61 72 67 65 20 65 6e | 6f 75 67 68 20 74 6f 20 |large en|ough to |
|00005d40| 66 69 74 20 61 20 6e 6f | 6e 20 7a 65 72 6f 20 69 |fit a no|n zero i|
|00005d50| 6e 74 65 67 65 72 2e 0a | 49 6e 20 67 65 6e 65 72 |nteger..|In gener|
|00005d60| 61 6c 20 63 6f 6d 6d 6f | 6e 20 73 65 6e 73 65 20 |al commo|n sense |
|00005d70| 77 69 6c 6c 20 74 65 6c | 6c 20 79 6f 75 20 77 68 |will tel|l you wh|
|00005d80| 61 74 20 69 73 20 70 6f | 73 73 69 62 6c 65 2c 20 |at is po|ssible, |
|00005d90| 6b 65 65 70 69 6e 67 20 | 69 6e 20 6d 69 6e 64 20 |keeping |in mind |
|00005da0| 74 68 65 0a 50 41 52 49 | 20 70 68 69 6c 6f 73 6f |the.PARI| philoso|
|00005db0| 70 68 79 20 77 68 69 63 | 68 20 73 61 79 73 20 74 |phy whic|h says t|
|00005dc0| 68 61 74 20 69 66 20 69 | 74 20 6d 61 6b 65 73 20 |hat if i|t makes |
|00005dd0| 73 65 6e 73 65 20 69 74 | 20 69 73 20 6c 65 67 61 |sense it| is lega|
|00005de0| 6c 20 28 74 68 65 20 61 | 73 73 69 67 6e 6d 65 6e |l (the a|ssignmen|
|00005df0| 74 20 6f 66 0a 61 6e 20 | 69 6d 70 72 65 63 69 73 |t of.an |imprecis|
|00005e00| 65 20 6f 62 6a 65 63 74 | 20 69 6e 74 6f 20 61 20 |e object| into a |
|00005e10| 70 72 65 63 69 73 65 20 | 6f 6e 65 20 64 6f 65 73 |precise |one does|
|00005e20| 20 7b 5c 69 74 20 6e 6f | 74 5c 2f 7d 20 6d 61 6b | {\it no|t\/} mak|
|00005e30| 65 20 73 65 6e 73 65 2e | 20 48 6f 77 65 76 65 72 |e sense.| However|
|00005e40| 2c 0a 61 20 63 68 61 6e | 67 65 20 69 6e 20 70 72 |,.a chan|ge in pr|
|00005e50| 65 63 69 73 69 6f 6e 20 | 6f 66 20 69 6d 70 72 65 |ecision |of impre|
|00005e60| 63 69 73 65 20 6f 62 6a | 65 63 74 73 20 69 73 20 |cise obj|ects is |
|00005e70| 61 6c 6c 6f 77 65 64 29 | 2e 0a 0a 49 74 20 69 73 |allowed)|...It is|
|00005e80| 20 61 6c 73 6f 20 6e 65 | 63 65 73 73 61 72 79 20 | also ne|cessary |
|00005e90| 74 6f 20 61 73 73 69 67 | 6e 20 6f 72 64 69 6e 61 |to assig|n ordina|
|00005ea0| 72 79 20 33 32 2d 62 69 | 74 20 6c 6f 6e 67 20 6e |ry 32-bi|t long n|
|00005eb0| 75 6d 62 65 72 73 20 6f | 66 20 43 20 69 6e 74 6f |umbers o|f C into|
|00005ec0| 20 61 20 50 41 52 49 0a | 6f 62 6a 65 63 74 2e 20 | a PARI.|object. |
|00005ed0| 54 68 69 73 20 69 73 20 | 64 6f 6e 65 20 75 73 69 |This is |done usi|
|00005ee0| 6e 67 20 74 68 65 20 66 | 75 6e 63 74 69 6f 6e 20 |ng the f|unction |
|00005ef0| 7b 5c 62 66 20 5c 72 65 | 66 7b 67 61 66 66 73 67 |{\bf \re|f{gaffsg|
|00005f00| 7d 7d 20 77 69 74 68 20 | 74 68 65 20 66 6f 6c 6c |}} with |the foll|
|00005f10| 6f 77 69 6e 67 20 73 79 | 6e 74 61 78 3a 0a 0a 7b |owing sy|ntax:..{|
|00005f20| 5c 74 74 20 76 6f 69 64 | 20 67 61 66 66 73 67 28 |\tt void| gaffsg(|
|00005f30| 6c 6f 6e 67 20 73 2c 20 | 47 45 4e 20 79 29 3b 7d |long s, |GEN y);}|
|00005f40| 0a 0a 49 74 20 69 73 20 | 61 6c 73 6f 20 76 65 72 |..It is |also ver|
|00005f50| 79 20 75 73 65 66 75 6c | 20 74 6f 20 63 6f 70 79 |y useful| to copy|
|00005f60| 20 61 20 50 41 52 49 20 | 6f 62 6a 65 63 74 2c 20 | a PARI |object, |
|00005f70| 6e 6f 74 20 6a 75 73 74 | 20 62 79 20 6d 6f 76 69 |not just| by movi|
|00005f80| 6e 67 20 61 72 6f 75 6e | 64 20 61 20 70 6f 69 6e |ng aroun|d a poin|
|00005f90| 74 65 72 2c 0a 62 75 74 | 20 62 79 20 70 68 79 73 |ter,.but| by phys|
|00005fa0| 69 63 61 6c 6c 79 20 63 | 72 65 61 74 69 6e 67 20 |ically c|reating |
|00005fb0| 61 20 63 6f 70 79 20 6f | 66 20 74 68 65 20 77 68 |a copy o|f the wh|
|00005fc0| 6f 6c 65 20 74 72 65 65 | 20 73 74 72 75 63 74 75 |ole tree| structu|
|00005fd0| 72 65 2e 20 54 68 65 20 | 66 75 6e 63 74 69 6f 6e |re. The |function|
|00005fe0| 0a 77 68 69 63 68 20 64 | 6f 65 73 20 74 68 69 73 |.which d|oes this|
|00005ff0| 20 69 73 20 63 61 6c 6c | 65 64 20 7b 5c 62 66 20 | is call|ed {\bf |
|00006000| 5c 72 65 66 7b 67 63 6f | 70 79 7d 7d 2c 20 77 69 |\ref{gco|py}}, wi|
|00006010| 74 68 20 74 68 65 20 70 | 72 65 64 65 66 69 6e 65 |th the p|redefine|
|00006020| 64 20 6d 61 63 72 6f 20 | 0a 7b 5c 74 74 20 5c 72 |d macro |.{\tt \r|
|00006030| 65 66 7b 6c 63 6f 70 79 | 7d 7d 20 61 73 20 61 20 |ef{lcopy|}} as a |
|00006040| 73 79 6e 6f 6e 79 6d 20 | 66 6f 72 20 7b 5c 74 74 |synonym |for {\tt|
|00006050| 20 28 6c 6f 6e 67 29 67 | 63 6f 70 79 7d 2e 20 49 | (long)g|copy}. I|
|00006060| 74 73 20 73 79 6e 74 61 | 78 20 69 73 3a 0a 0a 7b |ts synta|x is:..{|
|00006070| 5c 74 74 20 47 45 4e 20 | 67 63 6f 70 79 28 47 45 |\tt GEN |gcopy(GE|
|00006080| 4e 20 78 29 3b 7d 0a 0a | 61 6e 64 20 74 68 65 20 |N x);}..|and the |
|00006090| 65 66 66 65 63 74 20 69 | 73 20 74 6f 20 63 72 65 |effect i|s to cre|
|000060a0| 61 74 65 20 61 20 6e 65 | 77 20 63 6f 70 79 20 6f |ate a ne|w copy o|
|000060b0| 66 20 78 20 6f 6e 20 74 | 68 65 20 50 41 52 49 20 |f x on t|he PARI |
|000060c0| 73 74 61 63 6b 2e 0a 0a | 48 6f 77 65 76 65 72 2c |stack...|However,|
|000060d0| 20 69 74 20 6d 61 79 20 | 61 6c 73 6f 20 62 65 20 | it may |also be |
|000060e0| 75 73 65 66 75 6c 20 74 | 6f 20 63 72 65 61 74 65 |useful t|o create|
|000060f0| 20 61 20 7b 5c 73 6c 20 | 70 65 72 6d 61 6e 65 6e | a {\sl |permanen|
|00006100| 74 7d 20 63 6f 70 79 20 | 6f 66 20 61 20 50 41 52 |t} copy |of a PAR|
|00006110| 49 0a 6f 62 6a 65 63 74 | 2e 20 54 68 69 73 20 77 |I.object|. This w|
|00006120| 69 6c 6c 20 6e 6f 74 20 | 62 65 20 63 72 65 61 74 |ill not |be creat|
|00006130| 65 64 20 6f 6e 20 74 68 | 65 20 73 74 61 63 6b 20 |ed on th|e stack |
|00006140| 62 75 74 20 6f 6e 20 74 | 68 65 20 68 65 61 70 2e |but on t|he heap.|
|00006150| 20 54 68 65 20 66 75 6e | 63 74 69 6f 6e 0a 77 68 | The fun|ction.wh|
|00006160| 69 63 68 20 64 6f 65 73 | 20 74 68 69 73 20 69 73 |ich does| this is|
|00006170| 20 63 61 6c 6c 65 64 20 | 7b 5c 62 66 20 5c 72 65 | called |{\bf \re|
|00006180| 66 7b 67 63 6c 6f 6e 65 | 7d 7d 2c 20 77 69 74 68 |f{gclone|}}, with|
|00006190| 20 74 68 65 20 70 72 65 | 64 65 66 69 6e 65 64 20 | the pre|defined |
|000061a0| 6d 61 63 72 6f 20 0a 7b | 5c 74 74 20 5c 72 65 66 |macro .{|\tt \ref|
|000061b0| 7b 6c 63 6c 6f 6e 65 7d | 7d 20 61 73 20 61 20 73 |{lclone}|} as a s|
|000061c0| 79 6e 6f 6e 79 6d 20 66 | 6f 72 20 7b 5c 74 74 20 |ynonym f|or {\tt |
|000061d0| 28 6c 6f 6e 67 29 67 63 | 6c 6f 6e 65 7d 2e 20 49 |(long)gc|lone}. I|
|000061e0| 74 73 20 73 79 6e 74 61 | 78 20 69 73 3a 0a 0a 7b |ts synta|x is:..{|
|000061f0| 5c 74 74 20 47 45 4e 20 | 67 63 6c 6f 6e 65 28 47 |\tt GEN |gclone(G|
|00006200| 45 4e 20 78 29 3b 7d 0a | 0a 41 20 66 69 6e 61 6c |EN x);}.|.A final|
|00006210| 20 63 6c 61 73 73 20 6f | 66 20 66 75 6e 63 74 69 | class o|f functi|
|00006220| 6f 6e 73 20 73 68 6f 75 | 6c 64 20 62 65 20 6d 65 |ons shou|ld be me|
|00006230| 6e 74 69 6f 6e 65 64 20 | 69 6e 20 74 68 69 73 20 |ntioned |in this |
|00006240| 73 75 62 73 65 63 74 69 | 6f 6e 3a 20 66 75 6e 63 |subsecti|on: func|
|00006250| 74 69 6f 6e 73 20 77 68 | 69 63 68 0a 63 6f 6e 76 |tions wh|ich.conv|
|00006260| 65 72 74 20 66 72 6f 6d | 20 43 20 6f 62 6a 65 63 |ert from| C objec|
|00006270| 74 73 20 74 6f 20 50 41 | 52 49 20 6f 62 6a 65 63 |ts to PA|RI objec|
|00006280| 74 73 20 28 77 69 74 68 | 20 63 72 65 61 74 69 6f |ts (with| creatio|
|00006290| 6e 20 6f 66 20 74 68 65 | 20 6f 62 6a 65 63 74 73 |n of the| objects|
|000062a0| 20 6f 6e 20 74 68 65 20 | 73 74 61 63 6b 29 2e 0a | on the |stack)..|
|000062b0| 54 68 65 79 20 61 72 65 | 20 61 73 20 66 6f 6c 6c |They are| as foll|
|000062c0| 6f 77 73 3a 0a 0a 7b 5c | 74 74 20 47 45 4e 20 5c |ows:..{\|tt GEN \|
|000062d0| 72 65 66 7b 73 74 6f 69 | 7d 28 6c 6f 6e 67 20 73 |ref{stoi|}(long s|
|000062e0| 29 3b 0a 0a 47 45 4e 20 | 5c 72 65 66 7b 64 62 6c |);..GEN |\ref{dbl|
|000062f0| 74 6f 72 7d 28 64 6f 75 | 62 6c 65 20 73 29 3b 7d |tor}(dou|ble s);}|
|00006300| 0a 0a 54 68 65 69 72 20 | 6d 65 61 6e 69 6e 67 20 |..Their |meaning |
|00006310| 69 73 20 63 6c 65 61 72 | 20 66 72 6f 6d 20 74 68 |is clear| from th|
|00006320| 65 69 72 20 6e 61 6d 65 | 73 2e 20 54 68 65 20 63 |eir name|s. The c|
|00006330| 6f 6e 76 65 72 73 65 20 | 66 75 6e 63 74 69 6f 6e |onverse |function|
|00006340| 73 0a 0a 7b 5c 74 74 20 | 6c 6f 6e 67 20 5c 72 65 |s..{\tt |long \re|
|00006350| 66 7b 67 74 6f 6c 6f 6e | 67 7d 28 47 45 4e 20 7a |f{gtolon|g}(GEN z|
|00006360| 29 3b 0a 0a 64 6f 75 62 | 6c 65 20 5c 72 65 66 7b |);..doub|le \ref{|
|00006370| 67 74 6f 64 6f 75 62 6c | 65 7d 28 47 45 4e 20 7a |gtodoubl|e}(GEN z|
|00006380| 29 3b 7d 0a 0a 61 6c 73 | 6f 20 65 78 69 73 74 2c |);}..als|o exist,|
|00006390| 20 62 75 74 20 61 72 65 | 20 73 65 6c 64 6f 6d 20 | but are| seldom |
|000063a0| 75 73 65 64 2e 0a 0a 5c | 73 75 62 73 65 63 7b 44 |used...\|subsec{D|
|000063b0| 65 73 74 72 75 63 74 69 | 6f 6e 20 6f 66 20 50 41 |estructi|on of PA|
|000063c0| 52 49 20 6f 62 6a 65 63 | 74 73 20 61 6e 64 20 67 |RI objec|ts and g|
|000063d0| 61 72 62 61 67 65 20 63 | 6f 6c 6c 65 63 74 69 6f |arbage c|ollectio|
|000063e0| 6e 7d 2e 0a 0a 49 66 20 | 79 6f 75 20 77 61 6e 74 |n}...If |you want|
|000063f0| 20 74 6f 20 64 65 73 74 | 72 6f 79 20 28 69 2e 65 | to dest|roy (i.e|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.