12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603 |
- <a name=r38_0001>
- <title>IDENTIFIER</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>IDENTIFIER</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>type</b><P>
- <P>
-
- Identifiers in REDUCE consist of one or more alphanumeric characters, of
- which the first must be alphabetical. The maximum number of characters
- allowed is system dependent, but is usually over 100. However, printing
- is simplified if they are kept under 25 characters.
- <P>
- <P>
- You can also use special characters in your identifiers, but each must be
- preceded by an exclamation point <em>!</em> as an escape character. Useful
- special characters are <em> # $ % ^ & * - + = ? < > ~ | / !</em> and
- the space. Note that the use of the exclamation point as a special
- character requires a second exclamation point as an escape character.
- The underscore <em>_</em> is special in this regard. It must be preceded
- by an escape character in the first position in an identifier, but is
- treated like a normal letter within an identifier.
- <P>
- <P>
- Other characters, such as <em>( ) # ; ` ' "</em> can also be used if
- preceded by a <em>!</em>, but as they have special meanings to the Lisp
- reader it is best to avoid them to avoid confusion.
- <P>
- <P>
- Many system identifiers have * before or after their names, or - between
- words. If you accidentally pick one of these names for your own identifier,
- it could have disastrous effects. For this reason it is wise not to include
- * or - anywhere in your identifiers.
- <P>
- <P>
- You will notice that REDUCE does not use the escape characters when it prints
- identifiers containing special characters; however, you still must use them
- when you refer to these identifiers. Be careful when editing statements
- containing escaped special characters to treat the character and its escape
- as an inseparable pair.
- <P>
- <P>
- Identifiers are used for variable names, labels for <em>go to</em> statements,
- and names of arrays, matrices, operators, and procedures. Once an identifier is
- used as a matrix, array, scalar or operator identifier, it may not be used
- again as a matrix, array or operator. An operator or array identifier may
- later be used as a scalar without problems, but a matrix identifier cannot be
- used as a scalar. All procedures are entered into the system as operators, so
- the name of a procedure may not be used as a matrix, array, or operator
- identifier either.
- <P>
- <P>
- <a name=r38_0002>
- <title>KERNEL</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>KERNEL</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>type</b><P>
- <P>
-
- A <em>kernel</em> is a form that cannot be modified further by the REDUCE
- canonical simplifier. Scalar variables are always kernels. The
- other important class of kernels are operators with their arguments.
- Some examples should help clarify this concept:
- <P>
- <P>
- <p><pre><tt>
- Expression Kernel?
- x Yes
- varname Yes
- cos(a) Yes
- log(sin(x**2)) Yes
- a*b No
- (x+y)**4 No
- matrix-identifier No
- </tt></pre><p>Many REDUCE operators expect kernels among their arguments. Error
- messages
- result from attempts to use non-kernel expressions for these arguments.
- <P>
- <P>
- <a name=r38_0003>
- <title>STRING</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>STRING</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>type</b><P>
- <P>
-
- A <em>string</em> is any collection of characters enclosed in double quotation
- marks (<em>"</em>). It may be used as an argument for a variety of commands
-
- and operators, such as <em>in</em>, <em>rederr</em> and <em>write</em>.
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- write "this is a string";
- this is a string
- write a, " ", b, " ",c,"!";
- A B C!
- </tt></pre><p><P>
- <P>
- <a name=r38_0004>
- <title>Concepts</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>Concepts</b><menu>
- <li><a href=r38_0001.html#r38_0001>IDENTIFIER type</a><P>
- <li><a href=r38_0001.html#r38_0002>KERNEL type</a><P>
- <li><a href=r38_0001.html#r38_0003>STRING type</a><P>
- </menu>
- <a name=r38_0005>
- <title>assumptions</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>ASSUMPTIONS</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>variable</b><P>
- <P>
-
- <P>
- <P>
- After solving a linear or polynomial equation system
- with parameters, the variable <em>assumptions</em> contains a list
- of side relations for the parameters. The solution is valid only
- as long as none of these expression is zero.
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- solve({a*x-b*y+x,y-c},{x,y});
- b*c
- {{x=-----,y=c}}
- a + 1
- assumptions;
- {a + 1}
- </tt></pre><p><P>
- <P>
- <a name=r38_0006>
- <title>CARD_NO</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>CARD\_NO</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>variable</b><P>
- <P>
-
- <P>
- <P>
- <em>card_no</em>sets the total number of cards allowed in a Fortran
- output statement when <em>fort</em> is on. Default is 20.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- on fort;
- card_no := 4;
- CARD_NO=4.
- z := (x + y)**15;
- ANS1=5005.*X**6*Y**9+3003.*X**5*Y**10+1365.*X**4*Y**
- . 11+455.*X**3*Y**12+105.*X**2*Y**13+15.*X*Y**14+Y**15
- Z=X**15+15.*X**14*Y+105.*X**13*Y**2+455.*X**12*Y**3+
- . 1365.*X**11*Y**4+3003.*X**10*Y**5+5005.*X**9*Y**6+
- . 6435.*X**8*Y**7+6435.*X**7*Y**8+ANS1
- </tt></pre><p>Twenty total cards means 19 continuation cards. You may set it for
- more
- if your Fortran system allows more. Expressions are broken apart in a
- Fortran-compatible way if they extend for more than <em>card_no</em>
- continuation cards.
- <P>
- <P>
- <P>
- <a name=r38_0007>
- <title>E</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>E</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>constant</b><P>
- <P>
-
- The constant <em>e</em> is reserved for use as the base of the natural
- logarithm. Its value is approximately 2.71828284590, which REDUCE gives
- to the current decimal precision when the switch
- <a href=r38_0300.html#r38_0330>rounded</a> is on.
- <P>
- <P>
- <em>e</em>may be used as an iterative variable in a
- <a href=r38_0001.html#r38_0047>for</a> statement,
- or as a local variable or a
- <a href=r38_0050.html#r38_0055>procedure</a>. If <em>e</em> is defined
- as a local
- variable inside the procedure, the normal definition as the base of the
- natural logarithm would be suspended inside the procedure.
- <P>
- <P>
- <P>
- <a name=r38_0008>
- <title>EVAL_MODE</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>EVAL\_MODE</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>variable</b><P>
- <P>
-
- <P>
- <P>
- The system variable <em>eval_mode</em> contains the current mode, either
- <a href=r38_0150.html#r38_0186>algebraic</a> or
- <a href=r38_0200.html#r38_0221>symbolic</a>.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- EVAL_MODE;
- ALGEBRAIC
- </tt></pre><p>Some commands do not behave the same way in algebraic and symbolic
- modes.
- <P>
- <P>
- <P>
- <a name=r38_0009>
- <title>FORT_WIDTH</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>FORT\_WIDTH</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>variable</b><P>
- <P>
-
- <P>
- <P>
- The <em>fort_width</em> variable sets the number of characters in a line of
- Fortran-compatible output produced when the
- <a href=r38_0250.html#r38_0289>fort</a> switch is on.
- Default is 70.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- fort_width := 30;
- FORT_WIDTH := 30
- on fort;
- df(sin(x**3*y),x);
- ANS=3.*COS(X
- . **3*Y)*X**2*
- . Y
- </tt></pre><p><em>fort_width</em>includes the usually blank characters at the be
- ginning
- of the card. As you may notice above, it is conservative and makes the
- lines even shorter than it was told.
- <P>
- <P>
- <P>
- <a name=r38_0010>
- <title>HIGH_POW</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>HIGH\_POW</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>variable</b><P>
- <P>
-
- <P>
- <P>
- The variable <em>high_pow</em> is set by
- <a href=r38_0100.html#r38_0141>coeff</a> to the highest power
- of the variable of interest in the given expression. You can access this
- variable for use in further computation or display.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- coeff((x+1)^5*(x*(y+3)^2)^2,x);
- {0,
- 0,
- 4 3 2
- Y + 12*Y + 54*Y + 108*Y + 81,
- 4 3 2
- 5*(Y + 12*Y + 54*Y + 108*Y + 81),
- 4 3 2
- 10*(Y + 12*Y + 54*Y + 108*Y + 81),
- 4 3 2
- 10*(Y + 12*Y + 54*Y + 108*Y + 81),
- 4 3 2
- 5*(Y + 12*Y + 54*Y + 108*Y + 81),
- 4 3 2
- Y + 12*Y + 54*Y + 108*Y + 81}
- high_pow;
- 7
- </tt></pre><p>
- <a name=r38_0011>
- <title>I</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>I</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>constant</b><P>
- <P>
-
- <P>
- <P>
- REDUCE knows <em>i</em> is the square root of -1,
- and that i^2 = -1.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- (a + b*i)*(c + d*i);
- A*C + A*D*I + B*C*I - B*D
- i**2;
- -1
- </tt></pre><p><em>i</em>cannot be used as an identifier. It is all right to use
- <em>i</em>
- as an index variable in a <em>for</em> loop, or as a local (<em>scalar</em>)
- variable inside a <em>begin...end</em> block, but it loses its definition as
- the square root of -1 inside the block in that case.
- <P>
- <P>
- Only the simplest properties of i are known by REDUCE unless
- the switch
- <a href=r38_0250.html#r38_0274>complex</a> is turned on, which implements full c
- omplex
- arithmetic in factoring, simplification, and functional values.
- <em>complex</em> is ordinarily off.
- <P>
- <P>
- <P>
- <a name=r38_0012>
- <title>INFINITY</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>INFINITY</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>constant</b><P>
- <P>
-
- The name <em>infinity</em> is used to represent the infinite positive number.
- However, at the present time, arithmetic in terms of this operator reflects
- finite arithmetic, rather than true operations on infinity.
- <P>
- <P>
- <a name=r38_0013>
- <title>LOW_POW</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>LOW\_POW</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>variable</b><P>
- <P>
-
- <P>
- <P>
- The variable <em>low_pow</em> is set by
- <a href=r38_0100.html#r38_0141>coeff</a> to the lowest power
- of the variable of interest in the given expression. You can access this
- variable for use in further computation or display.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- coeff((x+2*y)**6,y);
- 6
- {X ,
- 5
- 12*X ,
- 4
- 60*X ,
- 3
- 160*X ,
- 2
- 240*X ,
- 192*X,
- 64}
- low_pow;
- 0
- coeff(x**2*(x*sin(y) + 1),x);
-
- {0,0,1,SIN(Y)}
- low_pow;
- 2
- </tt></pre><p>
- <a name=r38_0014>
- <title>NIL</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>NIL</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>constant</b><P>
- <P>
-
- <P>
- <P>
- <em>nil</em>represents the truth value false in symbolic mode, and is
- a synonym for 0 in algebraic mode. It cannot be used for any other
- purpose, even inside procedures or
- <a href=r38_0001.html#r38_0047>for</a> loops.
- <P>
- <P>
- <a name=r38_0015>
- <title>PI</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>PI</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>constant</b><P>
- <P>
-
- The identifier <em>pi</em> is reserved for use as the circular constant.
- Its value is given by 3.14159265358..., which REDUCE gives to the current
- decimal precision when REDUCE is in a floating-point mode.
- <P>
- <P>
- <em>pi</em>may be used as a looping variable in a
- <a href=r38_0001.html#r38_0047>for</a> statement,
- or as a local variable in a
- <a href=r38_0050.html#r38_0055>procedure</a>. Its value in such cases
- will be taken from the local environment.
- <P>
- <P>
- <P>
- <a name=r38_0016>
- <title>requirements</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>REQUIREMENTS</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>variable</b><P>
- <P>
-
- <P>
- <P>
- After an attempt to solve an inconsistent equation system
- with parameters, the variable <em>requirements</em> contains a list
- of expressions. These expressions define a set of conditions implicitly
- equated with zero. Any solution to this system defines a setting for
- the parameters sufficient to make the original system consistent.
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- solve({x-a,x-y,y-1},{x,y});
- {}
- requirements;
- {a - 1}
- </tt></pre><p><P>
- <P>
- <a name=r38_0017>
- <title>ROOT_MULTIPLICITIES</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>ROOT\_MULTIPLICITIES</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>variable</b><P>
- <P>
-
- <P>
- <P>
- The <em>root_multiplicities</em> variable is set to the list of the
- multiplicities of the roots of an equation by the
- <a href=r38_0150.html#r38_0179>solve</a> operator.
- <P>
- <P>
- <a href=r38_0150.html#r38_0179>solve</a>returns its solutions in a list. The mul
- tiplicities of
- each solution are put in the corresponding locations of the list
- <em>root_multiplicities</em>.
- <P>
- <P>
- <P>
- <a name=r38_0018>
- <title>T</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>T</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>constant</b><P>
- <P>
-
- The constant <em>t</em> stands for the truth value true. It cannot be used
- as a scalar variable in a
- <a href=r38_0001.html#r38_0041>block</a>, as a looping variable in a
- <a href=r38_0001.html#r38_0047>for</a> statement or as an
- <a href=r38_0200.html#r38_0211>operator</a> name.
- <P>
- <P>
- <a name=r38_0019>
- <title>Variables</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>Variables</b><menu>
- <li><a href=r38_0001.html#r38_0005>assumptions variable</a><P>
- <li><a href=r38_0001.html#r38_0006>CARD\_NO variable</a><P>
- <li><a href=r38_0001.html#r38_0007>E constant</a><P>
- <li><a href=r38_0001.html#r38_0008>EVAL\_MODE variable</a><P>
- <li><a href=r38_0001.html#r38_0009>FORT\_WIDTH variable</a><P>
- <li><a href=r38_0001.html#r38_0010>HIGH\_POW variable</a><P>
- <li><a href=r38_0001.html#r38_0011>I constant</a><P>
- <li><a href=r38_0001.html#r38_0012>INFINITY constant</a><P>
- <li><a href=r38_0001.html#r38_0013>LOW\_POW variable</a><P>
- <li><a href=r38_0001.html#r38_0014>NIL constant</a><P>
- <li><a href=r38_0001.html#r38_0015>PI constant</a><P>
- <li><a href=r38_0001.html#r38_0016>requirements variable</a><P>
- <li><a href=r38_0001.html#r38_0017>ROOT\_MULTIPLICITIES variable</a><P>
- <li><a href=r38_0001.html#r38_0018>T constant</a><P>
- </menu>
- <a name=r38_0020>
- <title>semicolon</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>;</b> _ _ _ <b>SEMICOLON</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>command</b><P>
- <P>
-
- The semicolon is a statement delimiter, indicating results are to be printed
- when used in interactive mode.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- (x+1)**2;
- 2
- X + 2*X + 1
- df(x**2 + 1,x);
- 2*X
- </tt></pre><p>Entering a <em>Return</em> without a semicolon or dollar sign resu
- lts in a
- prompt on the following line. A semicolon or dollar sign can be
- added at this point to execute the statement. In interactive mode, a
- statement that is ended with a semicolon and <em>Return</em> has its results
- printed on the screen.
- <P>
- <P>
- Inside a group statement <em><<</em>...<em>>></em>
- or a <em>begin</em>...<em>end</em> block, a
- semicolon or dollar sign separates individual REDUCE statements. Since
- results are not printed from a block without a specific <em>return</em>
- statement, there is no difference between using the semicolon or dollar
- sign. In a group statement, the last value produced is the value
- returned by the group statement. Thus, if a semicolon or dollar sign is
- placed between the last statement and the ending brackets, the group
- statement returns the value 0 or nil, rather than the value of the
- last statement.
- <P>
- <P>
- <P>
- <a name=r38_0021>
- <title>dollar</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>$</b> _ _ _ <b>DOLLAR</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>command</b><P>
- <P>
-
- The dollar sign is a statement delimiter, indicating results are not to be
- printed when used in interactive mode.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- (x+1)**2$ </tt></pre><p>The workspace is set to x^2 + 2x + 1
- but nothing shows on the screen<p><pre><tt>
- ws;
- 2
- X + 2*X + 1
- </tt></pre><p>
- <P>
- <P>
- Entering a <em>Return</em> without a semicolon or dollar sign results in a
- prompt on the following line. A semicolon or dollar sign can
- be added at this point to execute the statement. In interactive mode, a
- statement that ends with a dollar sign <em>$</em> and a <em>Return</em> is
- executed, but the results not printed.
- <P>
- <P>
- Inside a
- <a href=r38_0001.html#r38_0038>group</a> statement <em><<</em>...<em>>
- ></em>
- or a <em>begin</em>...<em>end</em>
- <a href=r38_0001.html#r38_0041>block</a>, a
- semicolon or dollar sign separates individual REDUCE statements. Since
- results are not printed from a
- <a href=r38_0001.html#r38_0041>block</a> without a specific
- <a href=r38_0050.html#r38_0058>return</a><P>
- <P>
- statement, there is no difference between using the semicolon or dollar
- sign.
- <P>
- <P>
- In a group statement, the last value produced is the value returned by the
- group statement. Thus, if a semicolon or dollar sign is placed between the
- last statement and the ending brackets, the group statement returns the
- value 0 or nil, rather than the value of the last statement.
- <P>
- <P>
- <P>
- <P>
- <a name=r38_0022>
- <title>percent</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>%</b> _ _ _ <b>PERCENT</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>command</b><P>
- <P>
-
- The percent sign is used to precede comments; everything from a percent
- to the end of the line is ignored.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- df(x**3 + y,x);% This is a comment key{Return}
- 2
- 3*X
- int(3*x**2,x) %This is a comment; key{Return}
- </tt></pre><p>A prompt is given, waiting for the semicolon that was not
- detected in the comment<p><pre><tt></tt></pre><p>
- <P>
- <P>
- Statement delimiters <em>;</em> and <em>$</em> are not detected between a
- percent sign and the end of the line.
- <P>
- <P>
- <P>
- <a name=r38_0023>
- <title>dot</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>.</b> _ _ _ <b>DOT</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- <P>
- <P>
- The . (dot) infix binary operator adds a new item to the beginning of an
- existing
- <a href=r38_0300.html#r38_0302>list</a>. In high energy physics expressions,
- it can also be used
- to represent the scalar product of two Lorentz four-vectors.
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <item> <em>.</em> <list>
- <P>
- <P>
- <P>
- <item> can be any REDUCE scalar expression, including a list;
- <list> must be a
- <a href=r38_0300.html#r38_0302>list</a> to avoid producing an error message.
- The dot operator is right associative.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- liss := a . {};
- LISS := {A}
- liss := b . liss;
- LISS := {B,A}
- newliss := liss . liss;
- NEWLISS := {{B,A},B,A}
- firstlis := a . b . {c};
- FIRSTLIS := {A,B,C}
- secondlis := x . y . {z};
- SECONDLIS := {X,Y,Z}
- for i := 1:3 sum part(firstlis,i)*part(secondlis,i);
-
- A*X + B*Y + C*Z
- </tt></pre><p>
- <a name=r38_0024>
- <title>assign</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>:=</b> _ _ _ <b>ASSIGN</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- <P>
- <P>
- The <em>:=</em> is the assignment operator, assigning the value on the right-han
- d
- side to the identifier or other valid expression on the left-hand side.
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <restricted\_expression> <em>:=</em> <expression>
- <P>
- <P>
- <P>
- <restricted\_expression> is ordinarily a single identifier, though simple
- expressions may be used (see Comments below). <expression> is any
- valid REDUCE expression. If <expression> is a
- <a href=r38_0300.html#r38_0345>matrix</a>
- identifier, then
- <restricted\_expression> can be a matrix identifier (redimensioned if
- necessary) which has each element set to the corresponding elements
- of the identifier on the right-hand side.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- a := x**2 + 1;
- 2
- A := X + 1
- a;
- 2
- X + 1
- first := second := third;
- FIRST := SECOND := THIRD
- first;
- THIRD
- second;
- THIRD
- b := for i := 1:5 product i;
- B := 120
- b;
- 120
- w + (c := x + 3) + z;
- W + X + Z + 3
- c;
- X + 3
- y + b := c;
- Y + B := C
- y;
- - (B - C)
- </tt></pre><p>The assignment operator is right associative, as shown in the seco
- nd and
- third examples. A string of such assignments has all but the last
- item set to the value of the last item. Embedding an assignment statement
- in another expression has the side effect of making the assignment, as well
- as causing the given replacement in the expression.
- <P>
- <P>
- Assignments of values to expressions rather than simple identifiers (such as in
- the last example above) can also be done, subject to the following remarks:
- <P>
- <P>
- _ _ _ (i)
- If the left-hand side is an identifier, an operator, or a power, the
- substitution rule is added to the rule table.
- <P>
- <P>
- _ _ _ (ii)
- If the operators <em>- + /</em> appear on the left-hand side, all but the first
- term of the expression is moved to the right-hand side.
- <P>
- <P>
- _ _ _ (iii)
- If the operator <em>*</em> appears on the left-hand side, any constant terms are
-
- moved to the right-hand side, but the symbolic factors remain.
- <P>
- <P>
- Assignment is valid for
- <a href=r38_0150.html#r38_0188>array</a> elements, but not for entire arrays.
- The assignment operator can also be used to attach functionality to operators.
- <P>
- <P>
- A recursive construction such as <em>a := a + b</em> is allowed, but when
- <em>a</em> is referenced again, the process of resubstitution continues
- until the expression stack overflows (you get an error message).
- Recursive assignments can be done safely inside controlled loop
- expressions, such as
- <a href=r38_0001.html#r38_0047>for</a>... or
- <a href=r38_0050.html#r38_0056>repeat</a>...<em>until</em>.
- <P>
- <P>
- <P>
- <P>
- <a name=r38_0025>
- <title>equalsign</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>=</b> _ _ _ <b>EQUALSIGN</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- The <em>=</em> operator is a prefix or infix equality comparison operator.
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <em>=</em>(<expression><em>,</em><expression>)
- or
- <expression> <em>=</em> <expression>
- <P>
- <P>
- <P>
- <expression> can be any REDUCE scalar expression.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- a := 4;
- A := 4
- if =(a,10) then write "yes" else write "no";
-
- no
- b := c;
- B := C
- if b = c then write "yes" else write "no";
-
- yes
- on rounded;
- if 4.0 = 4 then write "yes" else write "no";
-
- yes
- </tt></pre><p>This logical equality operator can only be used inside a condition
- al
- statement, such as
- <a href=r38_0050.html#r38_0052>if</a>...<em>then</em>...<em>else</em>
- or
- <a href=r38_0050.html#r38_0056>repeat</a>...<em>until</em>. In other places the
- equal
- sign establishes an algebraic object of type
- <a href=r38_0001.html#r38_0045>equation</a>.
- <P>
- <P>
- <P>
- <P>
- <a name=r38_0026>
- <title>replace</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>=></b> _ _ _ <b>REPLACE</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- <P>
- <P>
- The <em>=></em> operator is a binary operator used in
- <a href=r38_0050.html#r38_0060>rule</a> lists to
- denote replacements.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- operator f;
- let f(x) => x^2;
- f(x);
- 2
- x
- </tt></pre><p>
- <a name=r38_0027>
- <title>plussign</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>+</b> _ _ _ <b>PLUSSIGN</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- The <em>+</em> operator is a prefix or infix n-ary addition operator.
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <expression> { <em>+</em><expression>}+
- <P>
- <P>
- or <em>+</em>(<expression> {,<expression>}+)
- <P>
- <P>
- <P>
- <expression> may be any valid REDUCE expression.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- x**4 + 4*x**2 + 17*x + 1;
- 4 2
- X + 4*X + 17*X + 1
- 14 + 15 + x;
- X + 29
- +(1,2,3,4,5);
- 15
- </tt></pre><p><em>+</em>is also valid as an addition operator for
- <a href=r38_0300.html#r38_0345>matrix</a> variables
- that are of the same dimensions and for
- <a href=r38_0001.html#r38_0045>equation</a>s.
- <P>
- <P>
- <P>
- <a name=r38_0028>
- <title>minussign</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>-</b> _ _ _ <b>MINUSSIGN</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- The <em>-</em> operator is a prefix or infix binary subtraction operator, as wel
- l
- as the unary minus operator.
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <expression> <em>-</em> <expression>
- or <em>-</em>(<expression>,<expression>)
- <P>
- <P>
- <P>
- <expression> may be any valid REDUCE expression.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- 15 - 4;
- 11
- x*(-5);
- - 5*X
- a - b - 15;
- A - B - 15
- -(a,4);
- A - 4
- </tt></pre><p>The subtraction operator is left associative, so that a - b - c is
- equivalent
- to (a - b) - c, as shown in the third example. The subtraction operator is
- also valid with
- <a href=r38_0300.html#r38_0345>matrix</a> expressions of the correct dimensions
- and with
- <a href=r38_0001.html#r38_0045>equation</a>s.
- <P>
- <P>
- <P>
- <a name=r38_0029>
- <title>asterisk</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>*</b> _ _ _ <b>ASTERISK</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- The <em>*</em> operator is a prefix or infix n-ary multiplication operator.
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <expression> { <em>*</em> <expression>}+
- <P>
- <P>
- or <em>*</em>(<expression> {,<expression>}+)
- <P>
- <P>
- <P>
- <expression> may be any valid REDUCE expression.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- 15*3;
- 45
- 24*x*yvalue*2;
- 48*X*YVALUE
- *(6,x);
- 6*X
- on rounded;
- 3*1.5*x*x*x;
- 3
- 4.5*X
- off rounded;
- 2x**2;
- 2
- 2*X
- </tt></pre><p>REDUCE assumes you are using an implicit multiplication operator w
- hen an
- identifier is preceded by a number, as shown in the last line above. Since
- no valid identifiers can begin with numbers, there is no ambiguity in
- making this assumption.
- <P>
- <P>
- The multiplication operator is also valid with
- <a href=r38_0300.html#r38_0345>matrix</a> expressions
- of the
- proper dimensions: matrices A and B
- can be multiplied if
- A is n x m and B is
- m x p. Matrices and
- <a href=r38_0001.html#r38_0045>equation</a>s can also be
- multiplied by scalars: the
- result is as if each element was multiplied by the scalar.
- <P>
- <P>
- <P>
- <a name=r38_0030>
- <title>slash</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>/</b> _ _ _ <b>SLASH</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- The <em>/</em> operator is a prefix or infix binary division operator or
- prefix unary
- <a href=r38_0100.html#r38_0101>recip</a>rocal operator.
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <expression><em>/</em><expression> or
- <em>/</em><expression>
- <P>
- <P>
- or <em>/</em>(<expression>,<expression>)
- <P>
- <P>
- <P>
- <expression> may be any valid REDUCE expression.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- 20/5;
- 4
- 100/6;
- 50
- --
- 3
- 16/2/x;
- 8
- -
- X
- /b;
- 1
- -
- B
- /(y,5);
- Y
- -
- 5
- on rounded;
- 35/4;
- 8.75
- /20;
- 0.05
- </tt></pre><p>The division operator is left associative, so that <em>a/b/c</em>
- is equivalent
- to <em>(a/b)/c</em>. The division operator is also valid with square
- <a href=r38_0300.html#r38_0345>matrix</a> expressions of the same dimensions: Wi
- th A and
- B both n x n matrices and B
- invertible, A/B is
- given by A*B^-1.
- Division of a matrix by a scalar is defined, with the results being the
- division of each element of the matrix by the scalar. Division of a
- scalar by a matrix is defined if the matrix is invertible, and has the
- effect of multiplying the scalar by the inverse of the matrix. When
- <em>/</em> is used as a reciprocal operator for a matrix, the inverse of
- the matrix is returned if it exists.
- <P>
- <P>
- <P>
- <a name=r38_0031>
- <title>power</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>**</b> _ _ _ <b>POWER</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- The <em>**</em> operator is a prefix or infix binary exponentiation operator.
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <expression> <em>**</em><expression>
- or <em>**</em>(<expression>,<expression>)
- <P>
- <P>
- <P>
- <expression> may be any valid REDUCE expression.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- x**15;
- 15
- X
- x**y**z;
- Y*Z
- X
- x**(y**z);
- Z
- Y
- X
- **(y,4);
- 4
- Y
- on rounded;
- 2**pi;
- 8.82497782708
- </tt></pre><p>The exponentiation operator is left associative, so that <em>a**b*
- *c</em> is
- equivalent to <em>(a**b)**c</em>, as shown in the second example. Note
- that this is not <em>a**(b**c)</em>, which would be right associative.
- <P>
- <P>
- When
- <a href=r38_0300.html#r38_0308>nat</a> is on (the default), REDUCE output produc
- es raised
- exponents, as shown. The symbol <em>^</em>, which is the upper-case 6 on
- most keyboards, may be used in the place of <em>**</em>.
- <P>
- <P>
- A square
- <a href=r38_0300.html#r38_0345>matrix</a> may also be raised to positive and neg
- ative powers
- with the exponentiation operator (negative powers require the matrix to be
- invertible). Scalar expressions and
- <a href=r38_0001.html#r38_0045>equation</a>s may be raised to
- fractional and floating-point powers.
- <P>
- <P>
- <P>
- <a name=r38_0032>
- <title>caret</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>^</b> _ _ _ <b>CARET</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- The <em>^</em> operator is a prefix or infix binary exponentiation operator.
- It is equivalent to
- <a href=r38_0001.html#r38_0031>power</a> or **.
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <expression> <em>^</em><expression>
- or <em>^</em>(<expression>,<expression>)
- <P>
- <P>
- <P>
- <expression> may be any valid REDUCE expression.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- x^15;
- 15
- X
- x^y^z;
- Y*Z
- X
- x^(y^z);
- Z
- Y
- X
- ^(y,4);
- 4
- Y
- on rounded;
- 2^pi;
- 8.82497782708
- </tt></pre><p>The exponentiation operator is left associative, so that <em>a^b^c
- </em> is
- equivalent to <em>(a^b)^c</em>, as shown in the second example. Note
- that this is <not> <em>a^(b^c)</em>, which would be right associative.
- <P>
- <P>
- When
- <a href=r38_0300.html#r38_0308>nat</a> is on (the default), REDUCE output produc
- es raised
- exponents, as shown.
- <P>
- <P>
- A square
- <a href=r38_0300.html#r38_0345>matrix</a> may also be raised to positive
- and negative powers with
- the exponentiation operator (negative powers require the matrix to be
- invertible). Scalar expressions and
- <a href=r38_0001.html#r38_0045>equation</a>s
- may be raised to fractional and floating-point powers.
- <P>
- <P>
- <P>
- <a name=r38_0033>
- <title>geqsign</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>>=</b> _ _ _ <b>GEQSIGN</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- <em>>=</em> is an infix binary comparison operator, which returns true if
- its first argument is greater than or equal to its second argument.
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <expression> <em>>=</em> <expression>
- <P>
- <P>
- <P>
- <expression> must evaluate to an integer or floating-point number.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- if (3 >= 2) then yes;
- yes
- a := 15;
- A := 15
- if a >= 20 then big else small;
-
- small
- </tt></pre><p>The binary comparison operators can only be used for comparisons b
- etween
- numbers or variables that evaluate to numbers. The truth values returned
- by such a comparison can only be used inside programming constructs, such
- as
- <a href=r38_0050.html#r38_0052>if</a>...<em>then</em>...<em>else</em>
- or
- <a href=r38_0050.html#r38_0056>repeat</a>...<em>until</em> or
- <a href=r38_0200.html#r38_0228>while</a>...<em>do</em>.
- <P>
- <P>
- <P>
- <a name=r38_0034>
- <title>greater</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>></b> _ _ _ <b>GREATER</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- The <em>></em> is an infix binary comparison operator that returns
- true if its first argument is strictly greater than its second.
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <expression> <em>></em> <expression>
- <P>
- <P>
- <P>
- <expression> must evaluate to a number, e.g., integer, rational or
- floating point number.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- on rounded;
- if 3.0 > 3 then write "different" else write "same";
- same
- off rounded;
- a := 20;
- A := 20
- if a > 20 then write "bigger" else write "not bigger";
- not bigger
- </tt></pre><p>The binary comparison operators can only be used for comparisons b
- etween
- numbers or variables that evaluate to numbers. The truth values returned
- by such a comparison can only be used inside programming constructs, such
- as
- <a href=r38_0050.html#r38_0052>if</a>...<em>then</em>...<em>else</em> or
- <a href=r38_0050.html#r38_0056>repeat</a>...<em>until</em> or
- <a href=r38_0200.html#r38_0228>while</a>...<em>do</em>.
- <P>
- <P>
- <P>
- <a name=r38_0035>
- <title>leqsign</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b><=</b> _ _ _ <b>LEQSIGN</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- <em><=</em> is an infix binary comparison operator that returns
- true if its first argument is less than or equal to its second argument.
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <expression> <em><=</em> <expression>
- <P>
- <P>
- <P>
- <expression> must evaluate to a number, e.g., integer, rational or
- floating point number.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- a := 10;
- A := 10
- if a <= 10 then true;
- true
- </tt></pre><p>The binary comparison operators can only be used for comparisons b
- etween
- numbers or variables that evaluate to numbers. The truth values returned
- by such a comparison can only be used inside programming constructs, such
- as
- <a href=r38_0050.html#r38_0052>if</a>...<em>then</em>...<em>else</em> or
- <a href=r38_0050.html#r38_0056>repeat</a>...<em>until</em> or
- <a href=r38_0200.html#r38_0228>while</a>...<em>do</em>.
- <P>
- <P>
- <P>
- <a name=r38_0036>
- <title>less</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b><</b> _ _ _ <b>LESS</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- <em><</em> is an infix binary logical comparison operator that
- returns true if its first argument is strictly less than its second
- argument.
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <expression> <em><</em> <expression>
- <P>
- <P>
- <P>
- <expression> must evaluate to a number, e.g., integer, rational or
- floating point number.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- f := -3;
- F := -3
- if f < -3 then write "yes" else write "no";
- no
- </tt></pre><p>The binary comparison operators can only be used for comparisons b
- etween
- numbers or variables that evaluate to numbers. The truth values returned
- by such a comparison can only be used inside programming constructs, such
- as
- <a href=r38_0050.html#r38_0052>if</a>...<em>then</em>...<em>else</em>
- or
- <a href=r38_0050.html#r38_0056>repeat</a>...<em>until</em> or
- <a href=r38_0200.html#r38_0228>while</a>...<em>do</em>.
- <P>
- <P>
- <P>
- <a name=r38_0037>
- <title>tilde</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>~</b> _ _ _ <b>TILDE</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- The <em>~</em> is used as a unary prefix operator in the left-hand
- sides of
- <a href=r38_0050.html#r38_0060>rule</a>s to mark
- <a href=r38_0050.html#r38_0061>free variable</a>s. A double tilde
- marks an optional
- <a href=r38_0050.html#r38_0061>free variable</a>.
- <P>
- <P>
- <a name=r38_0038>
- <title>group</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b><<</b> _ _ _ <b>GROUP</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>command</b><P>
- <P>
-
- The <em><<</em>...<em>>></em> command is a group statement,
- used to group statements
- together where REDUCE expects a single statement.
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <em><<</em><statement>{; <statement> <em>or</em>
- <statement>}* <em>>></em>
- <P>
- <P>
- <P>
- <statement> may be any valid REDUCE statement or expression.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- a := 2;
- A := 2
- if a < 5 then <<b := a + 10; write b>>;
- 12
- <<d := c/15; f := d + 3; f**2>>;
-
- 2
- C + 90*C + 202
- ----------------
- 225
- </tt></pre><p>The value returned from a group statement is the value of the last
-
- individual statement executed inside it. Note that when a semicolon is
- placed between the last statement and the closing brackets, 0 or
- nil is returned. Group statements are often used in the
- consequence portions of
- <a href=r38_0050.html#r38_0052>if</a>...<em>then</em>,
- <a href=r38_0050.html#r38_0056>repeat</a>...<em>until</em>, and
- <a href=r38_0200.html#r38_0228>while</a>...<em>do</em>
- clauses. They may also be used in interactive
- operation to execute several statements at one time. Statements inside
- the group statement are separated by semicolons or dollar signs.
- <P>
- <P>
- <P>
- <P>
- <a name=r38_0039>
- <title>AND</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>AND</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- The <em>and</em> binary logical operator returns true if both of its
- arguments are true.
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <logical\_expression> <em>and</em> <logical\_expression>
- <P>
- <P>
- <P>
- <logical\_expression> must evaluate to true or nil.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- a := 12;
- A := 12
- if numberp a and a < 15 then write a**2 else write "no";
-
- 144
- clear a;
- if numberp a and a < 15 then write a**2 else write "no";
-
- no
- </tt></pre><p>Logical operators can only be used inside conditional statements,
- such as
- <a href=r38_0200.html#r38_0228>while</a>...<em>do</em> or
- <a href=r38_0050.html#r38_0052>if</a>...<em>then</em>...<em>else</em>. <em>and
- </em> examines each of
- its arguments in order, and quits, returning nil, on finding an
- argument that is not true. An error results if it is used in other
- contexts.
- <P>
- <P>
- <em>and</em>is left associative: <em>x and y and z</em> is equivalent to
- <em>(x and y) and z</em>.
- <P>
- <P>
- <P>
- <a name=r38_0040>
- <title>BEGIN</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>BEGIN</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>command</b><P>
- <P>
-
- <em>begin</em> is used to start a
- <a href=r38_0001.html#r38_0041>block</a> statement, which is closed with
- <em>end</em>.
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <em>begin</em><statement>{<em>;</em> <statement>}* <em>end</em>
- <P>
- <P>
- <P>
- <statement> is any valid REDUCE statement.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- begin for i := 1:3 do write i end;
- 1
- 2
- 3
- begin scalar n;n:=1;b:=for i:=1:4 product(x-i);return n end;
-
- 1
- b;
- 4 3 2
- X - 10*X + 35*X - 50*X + 24
- </tt></pre><p>A <em>begin</em>...<em>end</em> block can do actions (such as <em>
- write</em>), but
- does not
- return a value unless instructed to by a
- <a href=r38_0050.html#r38_0058>return</a> statement, which must
- be the last statement executed in the block. It is unnecessary to insert
- a semicolon before the <em>end</em>.
- <P>
- <P>
- Local variables, if any, are declared in the first statement immediately
- after <em>begin</em>, and may be defined as <em>scalar, integer,</em> or
- <em>real</em>.
- <a href=r38_0150.html#r38_0188>array</a> variables declared
- within a <em>begin</em>...<em>end</em> block
- are global in every case, and
- <a href=r38_0150.html#r38_0199>let</a> statements have global
- effects. A
- <a href=r38_0150.html#r38_0199>let</a> statement involving a formal parameter af
- fects
- the calling parameter that corresponds to it.
- <a href=r38_0150.html#r38_0199>let</a> statements
- involving local variables make global assignments, overwriting outside
- variables by the same name or creating them if they do not exist. You
- can use this feature to affect global variables from procedures, but be
- careful that you do not do it inadvertently.
- <P>
- <P>
- <P>
- <P>
- <a name=r38_0041>
- <title>block</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>BLOCK</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>command</b><P>
- <P>
-
- A <em>block</em> is a sequence of statements enclosed by
- commands
- <a href=r38_0001.html#r38_0040>begin</a> and
- <a href=r38_0001.html#r38_0044>end</a>.
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <em>begin</em><statement>{<em>;</em> <statement>}* <em>end</em>
- <P>
- <P>
- <P>
- For more details see
- <a href=r38_0001.html#r38_0040>begin</a>.
- <P>
- <P>
- <a name=r38_0042>
- <title>COMMENT</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>COMMENT</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>command</b><P>
- <P>
-
- Beginning with the word <em>comment</em>, all text until the next statement
- terminator (<em>;</em> or <em>$</em>) is ignored.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- x := a**2 comment--a is the velocity of the particle;;
-
- 2
- X := A
- </tt></pre><p>Note that the first semicolon ends the comment and the second one
- terminates the original REDUCE statement.
- <P>
- <P>
- Multiple-line comments are often needed in interactive files. The
- <em>comment</em> command allows a normal-looking text to accompany the
- REDUCE statements in the file.
- <P>
- <P>
- <P>
- <a name=r38_0043>
- <title>CONS</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>CONS</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- The <em>cons</em> operator adds a new element to the beginning of a
- <a href=r38_0300.html#r38_0302>list</a>. Its
- operation is identical to the symbol
- <a href=r38_0001.html#r38_0023>dot</a> (dot). It can be used
- infix or prefix.
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <em>cons</em>(<item>,<list>) or <item> <em>cons</em> <list
- >
- <P>
- <P>
- <P>
- <item> can be any REDUCE scalar expression, including a list; <list>
-
- must be a list.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- liss := cons(a,{b});
- {A,B}
- liss := c cons liss;
- {C,A,B}
- newliss := for each y in liss collect cons(y,list x);
-
- NEWLISS := {{C,X},{A,X},{B,X}}
- for each y in newliss sum (first y)*(second y);
-
- X*(A + B + C)
- </tt></pre><p>If you want to use <em>cons</em> to put together two elements into
- a new list,
- you must make the second one into a list with curly brackets or the <em>list
- </em>
- command. You can also start with an empty list created by <em>{}</em>.
- <P>
- <P>
- The <em>cons</em> operator is right associative: <em>a cons b cons c</em> is val
- id
- if <em>c</em> is a list; <em>b</em> need not be a list. The list produced is
- <em>{a,b,c}</em>.
- <P>
- <P>
- <P>
- <P>
- <a name=r38_0044>
- <title>END</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>END</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>command</b><P>
- <P>
-
- The command <em>end</em> has two main uses:
- <P>
- <P>
- _ _ _ (i)
- as the ending of a
- <a href=r38_0001.html#r38_0040>begin</a>...<em>end</em>
- <a href=r38_0001.html#r38_0041>block</a>; and
- <P>
- _ _ _ (ii)
- to end input from a file.
- <P>
- <P>
- In a <em>begin</em>...<em>end</em>
- <a href=r38_0001.html#r38_0041>block</a>, there need not be a delimiter
- (<em>;</em> or <em>$</em>) before the <em>end</em>, though there must be one
- after it, or a right bracket matching an earlier left bracket.
- <P>
- <P>
- Files to be read into REDUCE should end with <em>end;</em>, which must be
- preceded by a semicolon (usually the last character of the previous line).
- The additional semicolon avoids problems with mistakes in the files. If
- you have suspended file operation by answering <em>n</em> to a <em>pause</em>
- command, you are still, technically speaking, ``in" the file. Use
- <em>end</em> to exit the file.
- <P>
- <P>
- An <em>end</em> at the top level of a program is ignored.
- <P>
- <P>
- <P>
- <a name=r38_0045>
- <title>EQUATION</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>EQUATION</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>type</b><P>
- <P>
-
- <P>
- <P>
- An <em>equation</em> is an expression where two algebraic expressions
- are connected by the (infix) operator
- <a href=r38_0100.html#r38_0110>equal</a> or by <em>=</em>.
- For access to the components of an <em>equation</em> the operators
- <a href=r38_0150.html#r38_0158>lhs</a>,
- <a href=r38_0150.html#r38_0175>rhs</a> or
- <a href=r38_0150.html#r38_0169>part</a> can be used. The
- evaluation of the left-hand side of an <em>equation</em> is controlled
- by the switch
- <a href=r38_0250.html#r38_0283>evallhseqp</a>, while the right-hand side is
- evaluated unconditionally. When an <em>equation</em> is part of a
- logical expression, e.g. in a
- <a href=r38_0050.html#r38_0052>if</a> or
- <a href=r38_0200.html#r38_0228>while</a> statement,
- the equation is evaluated by subtracting both sides can comparing
- the result with zero.
- <P>
- <P>
- Equations occur in many contexts, e.g. as arguments of the
- <a href=r38_0150.html#r38_0182>sub</a>
- operator and in the arguments and the results
- of the operator
- <a href=r38_0150.html#r38_0179>solve</a>. An equation can be member of a
- <a href=r38_0300.html#r38_0302>list</a>
- and you may assign an equation to a variable. Elementary arithmetic is supported
-
- for equations: if
- <a href=r38_0250.html#r38_0283>evallhseqp</a> is on, you may add and subtract
- equations, and you can combine an equation with a scalar expression by
- addition, subtraction, multiplication, division and raise an equation
- to a power.
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- on evallhseqp;
- u:=x+y=1$
- v:=2x-y=0$
- 2*u-v;
- - 3*y=-2
- ws/3;
- 2
- y=--
- 3
- </tt></pre><p><P>
- <P>
- Important: the equation must occur in the leftmost term of such an expression.
- For other operations, e.g. taking function values of both sides, use the
- <a href=r38_0150.html#r38_0163>map</a> operator.
- <P>
- <P>
- <a name=r38_0046>
- <title>FIRST</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>FIRST</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- <P>
- <P>
- The <em>first</em> operator returns the first element of a
- <a href=r38_0300.html#r38_0302>list</a>.
- <P> <H3>
- syntax: </H3>
- <P>
- <P>
- <em>first</em>(<list>) or <em>first</em> <list>
- <P>
- <P>
- <P>
- <list> must be a non-empty list to avoid an error message.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- alist := {a,b,c,d};
- ALIST := {A,B,C,D}
- first alist;
- A
- blist := {x,y,{ww,aa,qq},z};
- BLIST := {X,Y,{WW,AA,QQ},Z}
- first third blist;
- WW
- </tt></pre><p>
- <a name=r38_0047>
- <title>FOR</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>FOR</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>command</b><P>
- <P>
-
- <P>
- <P>
- The <em>for</em> command is used for iterative loops. There are many
- possible forms it can take.
- <P>
- <P>
- <p><pre><tt>
- /
- / |STEP <number> UNTIL|
- |<var>:=<number>| |<number>|
- FOR| | : | |<action> <exprn>
- | / |
- |EACH <var> IN <list> |
- /
- where <action> ::= DO|PRODUCT|SUM|COLLECT|JOIN.
- </tt></pre><p><var> can be any valid REDUCE identifier except <em>t</em> o
- r
- <em>nil</em>, <inc>, <start> and <stop> can be any expression
- that evaluates to a positive or negative integer. <list> must be a
- valid
- <a href=r38_0300.html#r38_0302>list</a> structure.
- The action taken must be one of the actions shown
- above, each of which is followed by a single REDUCE expression, statement
- or a
- <a href=r38_0001.html#r38_0038>group</a> (<em><<</em>...<em>>></em>)
- or
- <a href=r38_0001.html#r38_0041>block</a>
- (
- <a href=r38_0001.html#r38_0040>begin</a>...
- <a href=r38_0001.html#r38_0044>end</a>) statement.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- for i := 1:10 sum i;
-
- 55
- for a := -2 step 3 until 6 product a;
-
- -8
- a := 3;
- A := 3
- for iter := 4:a do write iter;
- m := 0;
- M := 0
- for s := 10 step -1 until 3 do <<d := 10*s;m := m + d>>;
- m;
- 520
- for each x in {q,r,s} sum x**2;
- 2 2 2
- Q + R + S
- for i := 1:4 collect 1/i;
-
- 1 1 1
- {1,-,-,-}
- 2 3 4
- for i := 1:3 join list solve(x**2 + i*x + 1,x);
-
- SQRT(3)*I + 1
- {{X= --------------,
- 2
- SQRT(3)*I - 1
- X= --------------}
- 2
- {X=-1},
- SQRT(5) + 3 SQRT(5) - 3
- {X= - -----------,X=-----------}}
- 2 2
- </tt></pre><p>The behavior of each of the five action words follows:
- <P>
- <P>
- <p><pre><tt>
- Action Word Behavior
- Keyword Argument Type Action
- do statement, command, group Evaluates its argument once
- or block for each iteration of the loop,
- not saving results
- collect expression, statement, Evaluates its argument once for
- command, group, block, list each iteration of the loop,
- storing the results in a list
- which is returned by the for
- statement when done
- join list or an operator which Evaluates its argument once for
- produces a list each iteration of the loop,
- appending the elements in each
- individual result list onto the
- overall result list
- product expression, statement, Evaluates its argument once for
- command, group or block each iteration of the loop,
- multiplying the results together
- and returning the overall product
- sum expression, statement, Evaluates its argument once for
- command, group or block each iteration of the loop,
- adding the results together and
- returning the overall sum
- </tt></pre><p>For number-driven <em>for</em> statements, if the ending limit is
- smaller
- than the beginning limit (larger in the case of negative steps) the action
- statement is not executed at all. The iterative variable is local to the
- <em>for</em> statement, and does not affect the value of an identifier with
- the same name. For list-driven <em>for</em> statements, if the list is
- empty, the action statement is not executed, but no error occurs.
- <P>
- <P>
- You can use nested <em>for</em> statements, with the inner <em>for</em>
- statement after the action keyword. You must make sure that your inner
- statement returns an expression that the outer statement can handle.
- <P>
- <P>
- <P>
- <a name=r38_0048>
- <title>FOREACH</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>FOREACH</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>command</b><P>
- <P>
-
- <P>
- <P>
- <em>foreach</em>is a synonym for the <em>for each</em> variant of the
- <a href=r38_0001.html#r38_0047>for</a> construct. It is designed to iterate down
- a list, and an
- error will occur if a list is not used. The use of <em>for each</em> is
- preferred to <em>foreach</em>.
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <em>foreach</em><variable> in <list> <action> <expression
- >
- <P>
- <P>
- where <action> ::= <em>do | product | sum | collect | join</em>
- <P>
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- foreach x in {q,r,s} sum x**2;
- 2 2 2
- Q + R + S
- </tt></pre><p>
- <a name=r38_0049>
- <title>GEQ</title></a>
- <p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
- E"></p>
- <b><a href=r38_idx.html>INDEX</a></b><p><p>
- <b>GEQ</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- The <em>geq</em> operator is a binary infix or prefix logical operator. It
- returns true if its first argument is greater than or equal to its second
- argument. As an infix operator it is identical with <em>>=</em>.
- <P> <H3>
- syntax: </H3>
- <P>
- <P>
- <em>geq</em>(<expression>,<expression>) or <expression>
- <em>geq</em> <expression>
- <P>
- <P>
- <P>
- <expression> can be any valid REDUCE expression that evaluates to a
- number.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- a := 20;
- A := 20
- if geq(a,25) then write "big" else write "small";
-
- small
- if a geq 20 then write "big" else write "small";
-
- big
- if (a geq 18) then write "big" else write "small";
-
- big
- </tt></pre><p>Logical operators can only be used in conditional statements such
- as
- <P>
- <P>
- <a href=r38_0050.html#r38_0052>if</a>...<em>then</em>...<em>else</em> or
- <a href=r38_0050.html#r38_0056>repeat</a>...<em>until</em>.
- <P>
- <P>
- <P>
|