123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700 |
- <a name=r38_0100>
- <title>RAD2DMS</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>RAD2DMS</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <em>rad2dms</em>(<expression>)
- <P>
- <P>
- <P>
- In
- <a href=r38_0300.html#r38_0330>rounded</a> mode, if <expression> is a real
- number, the
- operator <em>rad2dms</em> will interpret it as radians, and convert it to a
- list containing the equivalent degrees, minutes and seconds. In all other
- cases, an expression in terms of the original operator is returned.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- rad2dms 1;
- RAD2DMS(1)
- on rounded;
- ws;
- {57,17,44.8062470964}
- rad2dms a;
- RAD2DMS(A)
- </tt></pre><p>
- <a name=r38_0101>
- <title>RECIP</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>RECIP</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- <em>recip</em> is the alphabetical name for the division operator <em>/</em>
- or
- <a href=r38_0001.html#r38_0030>slash</a> used as a unary operator. The use of
- <em>/</em> is preferred.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- recip a;
- 1
- -
- A
- recip 2;
- 1
- --
- 2
- </tt></pre><p>
- <a name=r38_0102>
- <title>REMAINDER</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>REMAINDER</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- <P>
- <P>
- The <em>remainder</em> operator returns the remainder after its first
- argument is divided by its second argument.
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <em>remainder</em>(<expression>,<expression>)
- <P>
- <P>
- <P>
- <expression> can be any valid REDUCE polynomial, and is not limited
- to numeric values.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- remainder(13,6);
- 1
- remainder(x**2 + 3*x + 2,x+1);
- 0
- remainder(x**3 + 12*x + 4,x**2 + 1);
- 11*X + 4
- remainder(sin(2*x),x*y);
- SIN(2*X)
- </tt></pre><p>In the default case, remainders are calculated over the integers.
- If you
- need the remainder with respect to another domain, it must be declared
- explicitly.
- <P>
- <P>
- If the first argument to <em>remainder</em> contains a denominator not equal to
- 1, an error occurs.
- <P>
- <P>
- <P>
- <a name=r38_0103>
- <title>ROUND</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>ROUND</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <em>round</em>(<expression>)
- <P>
- <P>
- <P>
- If its argument has a numerical value, <em>round</em> rounds it to the
- nearest integer. For non-numeric arguments, the value is an expression in
- the original operator.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- round 3.4;
- 3
- round 3.5;
- 4
- round a;
- ROUND(A)
- </tt></pre><p>
- <a name=r38_0104>
- <title>SETMOD</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>SETMOD</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>command</b><P>
- <P>
-
- <P>
- <P>
- The <em>setmod</em> command sets the modulus value for subsequent
- <a href=r38_0300.html#r38_0305>modular</a>
- arithmetic.
- <P> <H3>
- syntax: </H3>
- <P>
- <P>
- <em>setmod</em><integer>
- <P>
- <P>
- <P>
- <integer> must be positive, and greater than 1. It need not be a prime
- number.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- setmod 6;
- 1
- on modular;
- 16;
- 4
- x^2 + 5x + 7;
- 2
- X + 5*X + 1
- x/3;
- X
- -
- 3
- setmod 2;
- 6
- (x+1)^4;
- 4
- X + 1
- x/3;
- X
- </tt></pre><p><em>setmod</em>returns the previous modulus, or 1 if none has been
- set
- before. <em>setmod</em> only has effect when
- <a href=r38_0300.html#r38_0305>modular</a> is on.
- <P>
- <P>
- Modular operations are done only on numbers such as coefficients of
- polynomials, not on the exponents. The modulus need not be prime.
- Attempts to divide by a power of the modulus produces an error message, since th
- e
- operation is equivalent to dividing by 0. However, dividing by a factor
- of a non-prime modulus does not produce an error message.
- <P>
- <P>
- <P>
- <a name=r38_0105>
- <title>SIGN</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>SIGN</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <em>sign</em><expression>
- <P>
- <P>
- <P>
- <em>sign</em>tries to evaluate the sign of its argument. If this
- is possible <em>sign</em> returns one of 1, 0 or -1. Otherwise, the result
- is the original form or a simplified variant.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- sign(-5)
- -1
- sign(-a^2*b)
- -SIGN(B)
- </tt></pre><p>Even powers of formal expressions are assumed to be positive only
- as long
- as the switch
- <a href=r38_0250.html#r38_0274>complex</a> is off.
- <P>
- <P>
- <P>
- <a name=r38_0106>
- <title>SQRT</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>SQRT</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- <P>
- <P>
- The <em>sqrt</em> operator returns the square root of its argument.
- <P> <H3>
- syntax: </H3>
- <P>
- <P>
- <em>sqrt</em>(<expression>)
- <P>
- <P>
- <P>
- <expression> can be any REDUCE scalar expression.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- sqrt(16*a^3);
- 4*SQRT(A)*A
- sqrt(17);
- SQRT(17)
- on rounded;
- sqrt(17);
- 4.12310562562
- off rounded;
- sqrt(a*b*c^5*d^3*27);
- 2
- 3*SQRT(D)*SQRT(C)*SQRT(B)*SQRT(A)*SQRT(3)*C *D
- </tt></pre><p><em>sqrt</em>checks its argument for squared factors and removes t
- hem.
- <P>
- <P>
- Numeric values for square roots that are not exact integers are given only
- when
- <a href=r38_0300.html#r38_0330>rounded</a> is on.
- <P>
- <P>
- Please note that <em>sqrt(a**2)</em> is given as <em>a</em>, which may be
- incorrect if <em>a</em> eventually has a negative value. If you are
- programming a calculation in which this is a concern, you can turn on the
- <a href=r38_0300.html#r38_0317>precise</a> switch, which causes the absolute val
- ue of the square root
- to be returned.
- <P>
- <P>
- <P>
- <a name=r38_0107>
- <title>TIMES</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>TIMES</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- The <em>times</em> operator is an infix or prefix n-ary multiplication
- operator. It is identical to <em>*</em>.
- <P> <H3>
- syntax: </H3>
- <P>
- <P>
- <expression> <em>times</em> <expression> {<em>times</em> <express
- ion>}*
- <P>
- <P>
- or <em>times</em>(<expression>,<expression> {,<expression>}*)
- <P>
- <P>
- <P>
- <expression> can be any valid REDUCE scalar or matrix expression.
- Matrix expressions must be of the correct dimensions. Compatible scalar
- and matrix expressions can be mixed.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- var1 times var2;
- VAR1*VAR2
- times(6,5);
- 30
- matrix aa,bb;
- aa := mat((1),(2),(x))$
- bb := mat((0,3,1))$
- aa times bb times 5;
- [0 15 5 ]
- [ ]
- [0 30 10 ]
- [ ]
- [0 15*X 5*X]
- </tt></pre><p>
- <a name=r38_0108>
- <title>Arithmetic Operations</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>Arithmetic Operations</b><menu>
- <li><a href=r38_0050.html#r38_0069>ARITHMETIC\_OPERATIONS introduction</a><P>
- <li><a href=r38_0050.html#r38_0070>ABS operator</a><P>
- <li><a href=r38_0050.html#r38_0071>ADJPREC switch</a><P>
- <li><a href=r38_0050.html#r38_0072>ARG operator</a><P>
- <li><a href=r38_0050.html#r38_0073>CEILING operator</a><P>
- <li><a href=r38_0050.html#r38_0074>CHOOSE operator</a><P>
- <li><a href=r38_0050.html#r38_0075>DEG2DMS operator</a><P>
- <li><a href=r38_0050.html#r38_0076>DEG2RAD operator</a><P>
- <li><a href=r38_0050.html#r38_0077>DIFFERENCE operator</a><P>
- <li><a href=r38_0050.html#r38_0078>DILOG operator</a><P>
- <li><a href=r38_0050.html#r38_0079>DMS2DEG operator</a><P>
- <li><a href=r38_0050.html#r38_0080>DMS2RAD operator</a><P>
- <li><a href=r38_0050.html#r38_0081>FACTORIAL operator</a><P>
- <li><a href=r38_0050.html#r38_0082>FIX operator</a><P>
- <li><a href=r38_0050.html#r38_0083>FIXP operator</a><P>
- <li><a href=r38_0050.html#r38_0084>FLOOR operator</a><P>
- <li><a href=r38_0050.html#r38_0085>EXPT operator</a><P>
- <li><a href=r38_0050.html#r38_0086>GCD operator</a><P>
- <li><a href=r38_0050.html#r38_0087>LN operator</a><P>
- <li><a href=r38_0050.html#r38_0088>LOG operator</a><P>
- <li><a href=r38_0050.html#r38_0089>LOGB operator</a><P>
- <li><a href=r38_0050.html#r38_0090>MAX operator</a><P>
- <li><a href=r38_0050.html#r38_0091>MIN operator</a><P>
- <li><a href=r38_0050.html#r38_0092>MINUS operator</a><P>
- <li><a href=r38_0050.html#r38_0093>NEXTPRIME operator</a><P>
- <li><a href=r38_0050.html#r38_0094>NOCONVERT switch</a><P>
- <li><a href=r38_0050.html#r38_0095>NORM operator</a><P>
- <li><a href=r38_0050.html#r38_0096>PERM operator</a><P>
- <li><a href=r38_0050.html#r38_0097>PLUS operator</a><P>
- <li><a href=r38_0050.html#r38_0098>QUOTIENT operator</a><P>
- <li><a href=r38_0050.html#r38_0099>RAD2DEG operator</a><P>
- <li><a href=r38_0100.html#r38_0100>RAD2DMS operator</a><P>
- <li><a href=r38_0100.html#r38_0101>RECIP operator</a><P>
- <li><a href=r38_0100.html#r38_0102>REMAINDER operator</a><P>
- <li><a href=r38_0100.html#r38_0103>ROUND operator</a><P>
- <li><a href=r38_0100.html#r38_0104>SETMOD command</a><P>
- <li><a href=r38_0100.html#r38_0105>SIGN operator</a><P>
- <li><a href=r38_0100.html#r38_0106>SQRT operator</a><P>
- <li><a href=r38_0100.html#r38_0107>TIMES operator</a><P>
- </menu>
- <a name=r38_0109>
- <title>boolean_value</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>BOOLEAN VALUE</b><P>
- <P>
-
- There are no extra symbols for the truth values true
- and false. Instead,
- <a href=r38_0001.html#r38_0014>nil</a> and the number zero
- are interpreted as truth value false in algebraic
- programs (see
- <a href=r38_0001.html#r38_0014>false</a>), while any different
- value is considered as true (see
- <a href=r38_0100.html#r38_0122>true</a>).
- <P>
- <P>
- <a name=r38_0110>
- <title>EQUAL</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>EQUAL</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- <P>
- <P>
- The operator <em>equal</em> is an infix binary comparison
- operator. It is identical with <em>=</em>. It returns
- <a href=r38_0100.html#r38_0122>true</a> if its two
- arguments are equal.
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <expression> <em>equal</em> <expression>
- <P>
- <P>
- <P>
- Equality is given between floating point numbers and integers that have
- the same value.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- on rounded;
- a := 4;
- A := 4
- b := 4.0;
- B := 4.0
- if a equal b then write "true" else write "false";
-
- true
- if a equal 5 then write "true" else write "false";
-
- false
- if a equal sqrt(16) then write "true" else write "false";
-
- true
- </tt></pre><p>Comparison operators can only be used as conditions in conditional
- commands
- such as <em>if</em>...<em>then</em> and <em>repeat</em>...<em>until</em>.
- <equal> can also be used as a prefix operator. However, this use
- is not encouraged.
- <P>
- <P>
- <P>
- <a name=r38_0111>
- <title>EVENP</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>EVENP</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- The <em>evenp</em> logical operator returns
- <a href=r38_0100.html#r38_0122>true</a> if its argument is an
- even integer, and
- <a href=r38_0001.html#r38_0014>nil</a> if its argument is an odd integer. An err
- or
- message is returned if its argument is not an integer.
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <em>evenp</em>(<integer>) or <em>evenp</em> <integer>
- <P>
- <P>
- <P>
- <integer> must evaluate to an integer.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- aa := 1782;
- AA := 1782
- if evenp aa then yes else no;
- YES
- if evenp(-3) then yes else no;
- NO
- </tt></pre><p>Although you would not ordinarily enter an expression such as the
- last
- example above, note that the negative term must be enclosed in parentheses
- to be correctly parsed. The <em>evenp</em> operator can only be used in
- conditional statements such as <em>if</em>...<em>then</em>...<em>else</em>
- or <em>while</em>...<em>do</em>.
- <P>
- <P>
- <P>
- <a name=r38_0112>
- <title>false</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>FALSE</b><P>
- <P>
-
- The symbol
- <a href=r38_0001.html#r38_0014>nil</a> and the number zero are considered
- as
- <a href=r38_0100.html#r38_0109>boolean value</a> false if used in a place where
- a boolean value is required. Most builtin operators return
- <a href=r38_0001.html#r38_0014>nil</a> as false value. Algebraic programs use be
- tter zero.
- Note that <em>nil</em> is not printed when returned as result to
- a top level evaluation.
- <P>
- <P>
- <a name=r38_0113>
- <title>FREEOF</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>FREEOF</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- The <em>freeof</em> logical operator returns
- <a href=r38_0100.html#r38_0122>true</a> if its first argument does
- not contain its second argument anywhere in its structure.
- <P> <H3>
- syntax: </H3>
- <P>
- <P>
- <em>freeof</em>(<expression>,<kernel>) or
- <expression> <em>freeof</em> <kernel>
- <P>
- <P>
- <P>
- <expression> can be any valid scalar REDUCE expression, <kernel> mus
- t
- be a kernel expression (see <em>kernel</em>).
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- a := x + sin(y)**2 + log sin z;
-
- 2
- A := LOG(SIN(Z)) + SIN(Y) + X
- if freeof(a,sin(y)) then write "free" else write "not free";
-
- not free
- if freeof(a,sin(x)) then write "free" else write "not free";
-
- free
- if a freeof sin z then write "free" else write "not free";
-
- not free
- </tt></pre><p>Logical operators can only be used in conditional expressions such
- as
- <P>
- <P>
- <em>if</em>...<em>then</em> or <em>while</em>...<em>do</em>.
- <P>
- <P>
- <P>
- <a name=r38_0114>
- <title>LEQ</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>LEQ</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- The <em>leq</em> operator is a binary infix or prefix logical operator. It
- returns
- <a href=r38_0100.html#r38_0122>true</a> if its first argument is less than or eq
- ual to its second
- argument. As an infix operator it is identical with <em><=</em>.
- <P> <H3>
- syntax: </H3>
- <P>
- <P>
- <em>leq</em>(<expression>,<expression>) or <expression>
- <em>leq</em> <expression>
- <P>
- <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 := 15;
- A := 15
- if leq(a,25) then write "yes" else write "no";
-
- yes
- if leq(a,15) then write "yes" else write "no";
-
- yes
- if leq(a,5) then write "yes" else write "no";
-
- no
- </tt></pre><p>Logical operators can only be used in conditional statements such
- as
- <P>
- <P>
- <em>if</em>...<em>then</em>...<em>else</em> or <em>while</em>...<em>do</em>.
- <P>
- <P>
- <P>
- <a name=r38_0115>
- <title>LESSP</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>LESSP</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- The <em>lessp</em> operator is a binary infix or prefix logical operator. It
- returns
- <a href=r38_0100.html#r38_0122>true</a> if its first argument is strictly less t
- han its second
- argument. As an infix operator it is identical with <em><</em>.
- <P> <H3>
- syntax: </H3>
- <P>
- <P>
- <em>lessp</em>(<expression>,<expression>)
- or <expression> <em>lessp</em> <expression>
- <P>
- <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 := 15;
- A := 15
- if lessp(a,25) then write "yes" else write "no";
-
- yes
- if lessp(a,15) then write "yes" else write "no";
-
- no
- if lessp(a,5) then write "yes" else write "no";
-
- no
- </tt></pre><p>Logical operators can only be used in conditional statements such
- as
- <P>
- <P>
- <em>if</em>...<em>then</em>...<em>else</em> or <em>while</em>...<em>do</em>.
- <P>
- <P>
- <P>
- <a name=r38_0116>
- <title>MEMBER</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>MEMBER</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <expression> <em>member</em> <list>
- <P>
- <P>
- <P>
- <em>member</em>is an infix binary comparison operator that evaluates to
- <a href=r38_0100.html#r38_0122>true</a> if <expression> is
- <a href=r38_0100.html#r38_0110>equal</a> to a member of
- the
- <a href=r38_0050.html#r38_0053>list</a> <list>.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- if a member {a,b} then 1 else 0;
- 1
- if 1 member(1,2,3) then a else b;
- a
- if 1 member(1.0,2) then a else b;
- b
- </tt></pre><p>Logical operators can only be used in conditional statements such
- as
- <P>
- <P>
- <em>if</em>...<em>then</em>...<em>else</em> or <em>while</em>...<em>do</em>.
- <member> can also be used as a prefix operator. However, this use
- is not encouraged. Finally,
- <a href=r38_0100.html#r38_0110>equal</a> (<em>=</em>) is used for the test
- within the list, so expressions must be of the same type to match.
- <P>
- <P>
- <P>
- <a name=r38_0117>
- <title>NEQ</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>NEQ</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- The operator <em>neq</em> is an infix binary comparison
- operator. It returns
- <a href=r38_0100.html#r38_0122>true</a> if its two
- arguments are not
- <a href=r38_0100.html#r38_0110>equal</a>.
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <expression> <em>neq</em> <expression>
- <P>
- <P>
- <P>
- An inequality is satisfied between floating point numbers and integers
- that have the same value.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- on rounded;
- a := 4;
- A := 4
- b := 4.0;
- B := 4.0
- if a neq b then write "true" else write "false";
-
- false
- if a neq 5 then write "true" else write "false";
-
- true
- </tt></pre><p>Comparison operators can only be used as conditions in conditional
- commands
- such as <em>if</em>...<em>then</em> and <em>repeat</em>...<em>until</em>.
- <neq> can also be used as a prefix operator. However, this use
- is not encouraged.
- <P>
- <P>
- <P>
- <a name=r38_0118>
- <title>NOT</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>NOT</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- The <em>not</em> operator returns
- <a href=r38_0100.html#r38_0122>true</a> if its argument evaluates to
- <a href=r38_0001.html#r38_0014>nil</a>, and <em>nil</em> if its argument is <em>
- true</em>.
- <P> <H3>
- syntax: </H3>
- <P>
- <P>
- <em>not</em>(<logical expression>)
- <P>
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- if not numberp(a) then write "indeterminate" else write a;
-
- indeterminate;
- a := 10;
- A := 10
- if not numberp(a) then write "indeterminate" else write a;
-
- 10
- if not(numberp(a) and a < 0) then write "positive number";
-
- positive number
- </tt></pre><p>Logical operators can only be used in conditional statements such
- as
- <P>
- <P>
- <em>if</em>...<em>then</em>...<em>else</em> or <em>while</em>...<em>do</em>.
- <P>
- <P>
- <P>
- <a name=r38_0119>
- <title>NUMBERP</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>NUMBERP</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- The <em>numberp</em> operator returns
- <a href=r38_0100.html#r38_0122>true</a> if its argument is a number,
- and
- <a href=r38_0001.html#r38_0014>nil</a> otherwise.
- <P> <H3>
- syntax: </H3>
- <P>
- <P>
- <em>numberp</em>(<expression>) or <em>numberp</em> <expression>
- <P>
- <P>
- <P>
- <expression> can be any REDUCE scalar expression.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- cc := 15.3;
- CC := 15.3
- if numberp(cc) then write "number" else write "nonnumber";
- number
- if numberp(cb) then write "number" else write "nonnumber";
- nonnumber
- </tt></pre><p>Logical operators can only be used in conditional expressions, suc
- h as
- <P>
- <P>
- <em>if</em>...<em>then</em>...<em>else</em> and <em>while</em>...<em>do</em>.
- <P>
- <P>
- <P>
- <a name=r38_0120>
- <title>ORDP</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>ORDP</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- <P>
- <P>
- The <em>ordp</em> logical operator returns
- <a href=r38_0100.html#r38_0122>true</a> if its first argument is
- ordered ahead of its second argument in canonical internal ordering, or is
- identical to it.
- <P> <H3>
- syntax: </H3>
- <P>
- <P>
- <em>ordp</em>(<expression1>,<expression2>)
- <P>
- <P>
- <P>
- <P>
- <expression1> and <expression2> can be any valid REDUCE scalar
- expression.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- if ordp(x**2 + 1,x**3 + 3) then write "yes" else write "no";
-
- no
- if ordp(101,100) then write "yes" else write "no";
-
- yes
- if ordp(x,x) then write "yes" else write "no";
-
- yes
- </tt></pre><p>Logical operators can only be used in conditional expressions, suc
- h as
- <P>
- <P>
- <em>if</em>...<em>then</em>...<em>else</em> and <em>while</em>...<em>do</em>.
- <P>
- <P>
- <P>
- <a name=r38_0121>
- <title>PRIMEP</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>PRIMEP</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <em>primep</em>(<expression>) or <em>primep</em> <simple\_expression
- >
- <P>
- <P>
- <P>
- If <expression> evaluates to a integer, <em>primep</em> returns
- <a href=r38_0100.html#r38_0122>true</a> <P>
- <P>
- if <expression> is a prime number (i.e., a number other than 0 and
- plus or minus 1 which is only exactly divisible by itself or a unit)
- and
- <a href=r38_0001.html#r38_0014>nil</a> otherwise.
- If <expression> does not have an integer value, a type error occurs.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- if primep 3 then write "yes" else write "no";
- YES
- if primep a then 1;
- ***** A invalid as integer
- </tt></pre><p>
- <a name=r38_0122>
- <title>TRUE</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>TRUE</b><P>
- <P>
-
- <P>
- <P>
- Any value of the boolean part of a logical expression which is neither
- <a href=r38_0001.html#r38_0014>nil</a> nor <em>0</em> is considered as <em>true
- </em>. Most
- builtin test and compare functions return
- <a href=r38_0001.html#r38_0018>t</a> for <em>true</em>
- and
- <a href=r38_0001.html#r38_0014>nil</a> for <em>false</em>.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- if member(3,{1,2,3}) then 1 else -1;
- 1
- if floor(1.7) then 1 else -1;
- 1
- if floor(0.7) then 1 else -1;
- -1
- </tt></pre><p>
- <a name=r38_0123>
- <title>Boolean Operators</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>Boolean Operators</b><menu>
- <li><a href=r38_0100.html#r38_0109>boolean value concept</a><P>
- <li><a href=r38_0100.html#r38_0110>EQUAL operator</a><P>
- <li><a href=r38_0100.html#r38_0111>EVENP operator</a><P>
- <li><a href=r38_0100.html#r38_0122>false concept</a><P>
- <li><a href=r38_0100.html#r38_0113>FREEOF operator</a><P>
- <li><a href=r38_0100.html#r38_0114>LEQ operator</a><P>
- <li><a href=r38_0100.html#r38_0115>LESSP operator</a><P>
- <li><a href=r38_0100.html#r38_0116>MEMBER operator</a><P>
- <li><a href=r38_0100.html#r38_0117>NEQ operator</a><P>
- <li><a href=r38_0100.html#r38_0118>NOT operator</a><P>
- <li><a href=r38_0100.html#r38_0119>NUMBERP operator</a><P>
- <li><a href=r38_0100.html#r38_0120>ORDP operator</a><P>
- <li><a href=r38_0100.html#r38_0121>PRIMEP operator</a><P>
- <li><a href=r38_0100.html#r38_0122>TRUE concept</a><P>
- </menu>
- <a name=r38_0124>
- <title>BYE</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>BYE</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>command</b><P>
- <P>
-
- The <em>bye</em> command ends the REDUCE session, returning control to the
- program (e.g., the operating system) that called REDUCE. When you are at
- the top level, the <em>bye</em> command exits REDUCE. <em>quit</em> is a
- synonym for <em>bye</em>.
- <P>
- <P>
- <a name=r38_0125>
- <title>CONT</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>CONT</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>command</b><P>
- <P>
-
- The command <em>cont</em> returns control to an interactive file after a
- <a href=r38_0100.html#r38_0128>pause</a> command that has been answered with
- <em>n</em>.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt></tt></pre><p>Suppose you are in the middle of an interactive file.
- <p><pre><tt>
-
- factorize(x**2 + 17*x + 60);
-
- {{X + 12,1},{X + 5,1}}
- pause;
- Cont? (Y or N)
- n
- saveas results;
- factor1 := first results;
- FACTOR1 := {X + 12,1}
- factor2 := second results;
- FACTOR2 := {X + 5,1}
- cont; </tt></pre><p> the file resumes<p><pre><tt>
- </tt></pre><p>
- <P>
- <P>
- A
- <a href=r38_0100.html#r38_0128>pause</a> allows you to enter your own REDUCE com
- mands, change
- switch values, inquire about results, or other such activities. When you
- wish to resume operation of the interactive file, use <em>cont</em>.
- <P>
- <P>
- <P>
- <P>
- <a name=r38_0126>
- <title>DISPLAY</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>DISPLAY</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>command</b><P>
- <P>
-
- <P>
- <P>
- When given a numeric argument <n>, <em>display</em> prints the <n>
- most recent input statements, identified by prompt numbers. If an empty
- pair of parentheses is given, or if <n> is greater than the current
- number of statements, all the input statements since the beginning of
- the session are printed.
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <em>display</em>(<n>) or <em>display</em>()
- <P>
- <P>
- <P>
- <n> should be a positive integer. However, if it is a real number, the
- truncated integer value is used, and if a non-numeric argument is used, all
- the input statements are printed.
- <P>
- <P>
- The statements are displayed in upper case, with lines split at semicolons or
- dollar signs, as they are in editing. If long files have been input during
- the session, the <em>display</em> command is slow to format these for
- printing.
- <P>
- <P>
- <P>
- <a name=r38_0127>
- <title>LOAD_PACKAGE</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>LOAD\_PACKAGE</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>command</b><P>
- <P>
-
- <P>
- <P>
- The <em>load_package</em> command is used to load REDUCE packages, such as
- <em>gentran</em> that are not automatically loaded by the system.
- <P> <H3>
- syntax: </H3>
- <P>
- <P>
- <em>load_package "</em><package\_name><em>"</em>
- <P>
- <P>
- <P>
- A package is only loaded once; subsequent calls of <em>load_package</em>
- for the same package name are ignored.
- <P>
- <P>
- <a name=r38_0128>
- <title>PAUSE</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>PAUSE</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>command</b><P>
- <P>
-
- <P>
- <P>
- The <em>pause</em> command, given in an interactive file, stops operation and
- asks if you want to continue or not.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt></tt></pre><p>An interactive file is running, and at some point you
- see the
- question<p><pre><tt>
- Cont? (Y or N)
- </tt></pre><p>If you type<p><pre><tt>
- ykey{Return}
- </tt></pre><p>the file continues to run until the next pause or the end.<p><pre>
- <tt>
- </tt></pre><p>If you type <p><pre><tt>
- nkey{Return}
- </tt></pre><p>you will get a numbered REDUCE prompt, and be allowed to
- enter and execute any REDUCE statements. If you later wish to continue with
- the file, type<p><pre><tt>
- cont;
- </tt></pre><p>and the file resumes.<p><pre><tt></tt></pre><p>
- <P>
- <P>
- To use <em>pause</em> in your own interactive files, type
- <P>
- <P>
- <em>pause;</em>in the file wherever you want it.
- <P>
- <P>
- <em>pause</em>does not allow you to continue without typing either <em>y</em>
- or <em>n</em>. Its use is to slow down scrolling of interactive files, or to
- let you change parameters or switch settings for the calculations.
- <P>
- <P>
- If you have stopped an interactive file at a <em>pause,</em> and do not wish to
- resume the file, type <em>end;</em>. This does not end the REDUCE session, but
- stops input from the file. A second <em>end;</em> ends the REDUCE session.
- However, if you have pauses from more than one file stacked up, an <em>end;</em>
-
- brings you back to the top level, not the file directly above.
- <P>
- <P>
- A <em>pause</em> typed from the terminal has no effect.
- <P>
- <P>
- <P>
- <a name=r38_0129>
- <title>QUIT</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>QUIT</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>command</b><P>
- <P>
-
- The <em>quit</em> command ends the REDUCE session, returning control to the
- program (e.g., the operating system) that called REDUCE. When you are at
- the top level, the <em>quit</em> command exits REDUCE.
- <a href=r38_0100.html#r38_0124>bye</a> is a
- synonym for <em>quit</em>.
- <P>
- <P>
- <a name=r38_0130>
- <title>RECLAIM</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>RECLAIM</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- <P>
- <P>
- REDUCE's memory is in a storage structure called a heap. As REDUCE
- statements execute, chunks of memory are used up. When these chunks are no
- longer needed, they remain idle. When the memory is almost full,
- the system executes a garbage collection, reclaiming space that is no
- longer needed, and putting all the free space at one end. Depending on
- the size of the image REDUCE is using,
- garbage collection needs to be done more or less often. A
- larger image means fewer but longer garbage collections.
- Regardless of memory size,
- if you ask REDUCE to do something ridiculous, like <em>factorial(2000)</em>, it
- may
- garbage collect many times.
- <P>
- <P>
- <P>
- <a name=r38_0131>
- <title>REDERR</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>REDERR</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>command</b><P>
- <P>
-
- <P>
- <P>
- The <em>rederr</em> command allows you to print an error message from inside
- a
- <a href=r38_0050.html#r38_0055>procedure</a> or a
- <a href=r38_0001.html#r38_0041>block</a> statement.
- The calculation is gracefully terminated.
- <P> <H3>
- syntax: </H3>
- <P>
- <P>
- <em>rederr</em><message>
- <P>
- <P>
- <P>
- <message> is an error message, usually inside double quotation marks
- (a
- <a href=r38_0001.html#r38_0003>string</a>).
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- procedure fac(n);
- if not (fixp(n) and n>=0)
- then rederr "Choose nonneg. integer only"
- else for i := 0:n-1 product i+1;
-
- fac
- fac a;
- ***** Choose nonneg. integer only
- fac 5;
- 120
- </tt></pre><p>The above procedure finds the factorial of its argument.
- If n is not a positive integer or 0, an error message is returned.
- <P>
- <P>
- If your procedure is executed in a file, the usual error message is
- printed, followed by <em>Cont? (Y or N)</em>, just as any other error does from
- a file. Although the procedure is gracefully terminated, any switch settings or
- variable assignments you made before the error occurred are not undone. If you
- need to clean up such items before exiting, use a group statement, with the
- <em>rederr</em> command as its last statement.
- <P>
- <P>
- <P>
- <a name=r38_0132>
- <title>RETRY</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>RETRY</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>command</b><P>
- <P>
-
- <P>
- <P>
- The <em>retry</em> command allows you to retry the latest statement that resulte
- d
- in an error message.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- matrix a;
- det a;
- ***** Matrix A not set
- a := mat((1,2),(3,4));
- A(1,1) := 1
- A(1,2) := 2
- A(2,1) := 3
- A(2,2) := 4
- retry;
- -2
- </tt></pre><p><em>retry</em>remembers only the most recent statement that result
- ed in an
- error message. It allows you to stop and fix something obvious, then
- continue on your way without retyping the original command.
- <P>
- <P>
- <P>
- <a name=r38_0133>
- <title>SAVEAS</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>SAVEAS</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>command</b><P>
- <P>
-
- The <em>saveas</em> command saves the current workspace under the name of its
- argument.
- <P> <H3>
- syntax: </H3>
- <P>
- <P>
- <em>saveas</em><identifier>
- <P>
- <P>
- <P>
- <identifier> can be any valid REDUCE identifier.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt></tt></pre><p>(The numbered prompts are shown below, unlike in most
- examples)<p><pre><tt>
- 1: solve(x^2-3);
- {x=sqrt(3),x= - sqrt(3)}
- 2: saveas rts(0)$
- 3: rts(0);
- {x=sqrt(3),x= - sqrt(3)}
- </tt></pre><p>
- <P>
- <P>
- <em>saveas</em>works only for the current workspace, the last algebraic
- expression produced by REDUCE. This allows you to save a result that you
- did not assign to an identifier when you originally typed the input.
- For access to previous output use
- <a href=r38_0150.html#r38_0184>ws</a>.
- <P>
- <P>
- <P>
- <a name=r38_0134>
- <title>SHOWTIME</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>SHOWTIME</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>command</b><P>
- <P>
-
- <P>
- <P>
- The <em>showtime</em> command prints the elapsed system time since the last
- call of this command or since the beginning of the session, if it has not
- been called before.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- showtime;
- Time: 1020 ms
- factorize(x^4 - 8x^4 + 8x^2 - 136x - 153);
-
- 2
- {X - 9,X + 17,X + 1}
- showtime;
- Time: 920 ms
- </tt></pre><p>The time printed is either the elapsed cpu time or the elapsed wal
- l clock
- time, depending on your system. <em>showtime</em> allows you to see the
- system time resources REDUCE uses in its calculations. Your time readings
- will of course vary from this example according to the system you use.
- <P>
- <P>
- <P>
- <a name=r38_0135>
- <title>WRITE</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>WRITE</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>command</b><P>
- <P>
-
- <P>
- <P>
- The <em>write</em> command explicitly writes its arguments to the output device
- (terminal or file).
- <P> <H3>
- syntax: </H3>
- <P>
- <P>
- <em>write</em><item>{,<item>}*
- <P>
- <P>
- <P>
- <item> can be an expression, an assignment or a
- <a href=r38_0001.html#r38_0003>string</a>
- enclosed in double quotation marks (<em>"</em>).
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- write a, sin x, "this is a string";
- ASIN(X)this is a string
- write a," ",sin x," this is a string";
- A SIN(X) this is a string
- if not numberp(a) then write "the symbol ",a;
-
- the symbol A
- array m(10);
- for i := 1:5 do write m(i) := 2*i;
- M(1) := 2
- M(2) := 4
- M(3) := 6
- M(4) := 8
- M(5) := 10
- m(4);
- 8
- </tt></pre><p>The items specified by a single <em>write</em> statement print on
- a single line
- unless they are too long. A printed line is always ended with a carriage
- return, so the next item printed starts a new line.
- <P>
- <P>
- When an assignment statement is printed, the assignment is also made. This
- allows you to get feedback on filling slots in an array with a
- <a href=r38_0001.html#r38_0047>for</a>
- statement, as shown in the last example above.
- <P>
- <P>
- <P>
- <a name=r38_0136>
- <title>General Commands</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>General Commands</b><menu>
- <li><a href=r38_0100.html#r38_0124>BYE command</a><P>
- <li><a href=r38_0100.html#r38_0125>CONT command</a><P>
- <li><a href=r38_0100.html#r38_0126>DISPLAY command</a><P>
- <li><a href=r38_0100.html#r38_0127>LOAD\_PACKAGE command</a><P>
- <li><a href=r38_0100.html#r38_0128>PAUSE command</a><P>
- <li><a href=r38_0100.html#r38_0129>QUIT command</a><P>
- <li><a href=r38_0100.html#r38_0130>RECLAIM operator</a><P>
- <li><a href=r38_0100.html#r38_0131>REDERR command</a><P>
- <li><a href=r38_0100.html#r38_0132>RETRY command</a><P>
- <li><a href=r38_0100.html#r38_0133>SAVEAS command</a><P>
- <li><a href=r38_0100.html#r38_0134>SHOWTIME command</a><P>
- <li><a href=r38_0100.html#r38_0135>WRITE command</a><P>
- </menu>
- <a name=r38_0137>
- <title>APPEND</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>APPEND</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- <P>
- <P>
- The <em>append</em> operator constructs a new
- <a href=r38_0050.html#r38_0053>list</a>
- from the elements of its two arguments (which must be lists).
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <em>append</em>(<list>,<list>)
- <P>
- <P>
- <P>
- <list> must be a list, though it may be the empty list (<em>{}</em>).
- Any arguments beyond the first two are ignored.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- alist := {1,2,{a,b}};
- ALIST := {1,2,{A,B}}
- blist := {3,4,5,sin(y)};
- BLIST := {3,4,5,SIN(Y)}
- append(alist,blist);
- {1,2,{A,B},3,4,5,SIN(Y)}
- append(alist,{});
- {1,2,{A,B}}
- append(list z,blist);
- {Z,3,4,5,SIN(Y)}
- </tt></pre><p>The new list consists of the elements of the second list appended
- to the
- elements of the first list. You can <em>append</em> new elements to the
- beginning or end of an existing list by putting the new element in a
- list (use curly braces or the operator <em>list</em>). This is
- particularly helpful in an iterative loop.
- <P>
- <P>
- <P>
- <a name=r38_0138>
- <title>ARBINT</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>ARBINT</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- <P>
- <P>
- The operator <em>arbint</em> is used to express arbitrary integer parts
- of an expression, e.g. in the result of
- <a href=r38_0150.html#r38_0179>solve</a> when
- <a href=r38_0250.html#r38_0266>allbranch</a> is on.
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- solve(log(sin(x+3)),x);
- {X=2*ARBINT(1)*PI - ASIN(1) - 3,
- X=2*ARBINT(1)*PI + ASIN(1) + PI - 3}
- </tt></pre><p><P>
- <P>
- <a name=r38_0139>
- <title>ARBCOMPLEX</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>ARBCOMPLEX</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- <P>
- <P>
- The operator <em>arbcomplex</em> is used to express arbitrary scalar parts
- of an expression, e.g. in the result of
- <a href=r38_0150.html#r38_0179>solve</a> when
- the solution is parametric in one of the variable.
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- solve({x+3=y-2z,y-3x=0},{x,y,z});
- 2*ARBCOMPLEX(1) + 3
- {X=-------------------,
- 2
- 3*ARBCOMPLEX(1) + 3
- Y=-------------------,
- 2
- Z=ARBCOMPLEX(1)}
- </tt></pre><p><P>
- <P>
- <a name=r38_0140>
- <title>ARGLENGTH</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>ARGLENGTH</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- <P>
- <P>
- The operator <em>arglength</em> returns the number of arguments of the top-level
-
- operator in its argument.
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <em>arglength</em>(<expression>)
- <P>
- <P>
- <P>
- <expression> can be any valid REDUCE algebraic expression.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- arglength(a + b + c + d);
- 4
- arglength(a/b/c);
- 2
- arglength(log(sin(df(r**3*x,x))));
- 1
- </tt></pre><p>In the first example, <em>+</em> is an n-ary operator, so the numb
- er of terms
- is returned. In the second example, since <em>/</em> is a binary operator, the
- argument is actually (a/b)/c, so there are two terms at the top level. In
- the last example, no matter how deeply the operators are nested, there is
- still only one argument at the top level.
- <P>
- <P>
- <P>
- <a name=r38_0141>
- <title>COEFF</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>COEFF</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- <P>
- <P>
- The <em>coeff</em> operator returns the coefficients of the powers of the
- specified variable in the given expression, in a
- <a href=r38_0050.html#r38_0053>list</a>.
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <em>coeff</em>(<expression><em>,</em><variable>)
- <P>
- <P>
- <P>
- <expression> is expected to be a polynomial expression, not a rational
- expression. Rational expressions are accepted when the switch
- <a href=r38_0300.html#r38_0322>ratarg</a> is on. <variable> must be a kern
- el. The results are
- returned in a list.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- coeff((x+y)**3,x);
- 3 2
- {Y ,3*Y ,3*Y,1}
- coeff((x+2)**4 + sin(x),x);
- {SIN(X) + 16,32,24,8,1}
- high_pow;
- 4
- low_pow;
- 0
- ab := x**9 + sin(x)*x**7 + sqrt(y);
-
- 7 9
- AB := SQRT(Y) + SIN(X)*X + X
- coeff(ab,x);
- {SQRT(Y),0,0,0,0,0,0,SIN(X),0,1}
- </tt></pre><p>The variables
- <a href=r38_0001.html#r38_0010>high_pow</a> and
- <a href=r38_0001.html#r38_0013>low_pow</a> are set to the
- highest and lowest powers of the variable, respectively, appearing in the
- expression.
- <P>
- <P>
- The coefficients are put into a list, with the coefficient of the lowest
- (constant) term first. You can use the usual list access methods
- (<em>first</em>, <em>second</em>, <em>third</em>, <em>rest</em>, <em>length</em>
- , and
- <em>part</em>) to extract them. If a power does not appear in the
- expression, the corresponding element of the list is zero. Terms involving
- functions of the specified variable but not including powers of it (for
- example in the expression <em>x**4 + 3*x**2 + tan(x)</em>) are placed in the
- constant term.
- <P>
- <P>
- Since the <em>coeff</em> command deals with the expanded form of the expression,
-
- you may get unexpected results when
- <a href=r38_0250.html#r38_0284>exp</a> is off, or when
- <a href=r38_0250.html#r38_0287>factor</a> or
- <a href=r38_0250.html#r38_0296>ifactor</a> are on.
- <P>
- <P>
- If you want only a specific coefficient rather than all of them, use the
- <a href=r38_0100.html#r38_0142>coeffn</a> operator.
- <P>
- <P>
- <P>
- <P>
- <a name=r38_0142>
- <title>COEFFN</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>COEFFN</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- <P>
- <P>
- The <em>coeffn</em> operator takes three arguments: an expression, a kernel, and
-
- a non-negative integer. It returns the coefficient of the kernel to that
- integer power, appearing in the expression.
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <em>coeffn</em>(<expression>,<kernel>,<integer>)
- <P>
- <P>
- <P>
- <expression> must be a polynomial, unless
- <a href=r38_0300.html#r38_0322>ratarg</a> is on which
- allows rational expressions. <kernel> must be a kernel, and
- <integer> must be a non-negative integer.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- ff := x**7 + sin(y)*x**5 + y**4 + x + 7;
- 5 7 4
- FF := SIN(Y)*X + X + X + Y + 7
- coeffn(ff,x,5);
- SIN(Y)
- coeffn(ff,z,3);
- 0
- coeffn(ff,y,0);
- 5 7
- SIN(Y)*X + X + X + 7
- rr := 1/y**2+y**3+sin(y);
- 2 5
- SIN(Y)*Y + Y + 1
- RR := --------------------
- 2
- Y
- on ratarg;
- coeffn(rr,y,-2);
- ***** -2 invalid as COEFFN index
- coeffn(rr,y,5);
- 1
- ---
- 2
- Y
- </tt></pre><p>If the given power of the kernel does not appear in the expression
- ,
- <em>coeffn</em> returns 0. Negative powers are never detected, even if
- they appear in the expression and
- <a href=r38_0300.html#r38_0322>ratarg</a> are on. <em>coeffn</em>
- with an integer argument of 0 returns any terms in the expression that
- do not contain the given kernel.
- <P>
- <P>
- <P>
- <a name=r38_0143>
- <title>CONJ</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>CONJ</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <em>conj</em>(<expression>) or <em>conj</em> <simple\_expression>
- <P>
- <P>
- <P>
- This operator returns the complex conjugate of an expression, if that
- argument has an numerical value. A non-numerical argument is returned as
- an expression in the operators
- <a href=r38_0150.html#r38_0173>repart</a> and
- <a href=r38_0150.html#r38_0153>impart</a>.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- conj(1+i);
- 1-I
- conj(a+i*b);
- REPART(A) - REPART(B)*I - IMPART(A)*I - IMPART(B)
- </tt></pre><p>
- <a name=r38_0144>
- <title>CONTINUED_FRACTION</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>CONTINUED_FRACTION</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <em>continued_fraction</em>(<num>)
- or <em>continued_fraction</em>( <num>,<size>)
- <P>
- <P>
- <P>
- This operator approximates the real number <num>
- (
- <a href=r38_0300.html#r38_0323>rational</a> number,
- <a href=r38_0300.html#r38_0330>rounded</a> number)
- into a continued fraction. The result is a list of two elements: the
- first one is the rational value of the approximation, the second one
- is the list of terms of the continued fraction which represents the
- same value according to the definition <em>t0 +1/(t1 + 1/(t2 + ...))</em>.
- Precision: the second optional parameter <size> is an upper bound
- for the absolute value of the result denominator. If omitted, the
- approximation is performed up to the current system precision.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- continued_fraction pi;
-
- 1146408
- {-------,{3,7,15,1,292,1,1,1,2,1}}
- 364913
- continued_fraction(pi,100);
-
- 22
- {--,{3,7}}
- 7
- </tt></pre><p>
- <a name=r38_0145>
- <title>DECOMPOSE</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>DECOMPOSE</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- <P>
- <P>
- The <em>decompose</em> operator takes a multivariate polynomial as argument,
- and returns an expression and a
- <a href=r38_0050.html#r38_0053>list</a> of
- <a href=r38_0001.html#r38_0045>equation</a>s from which the
- original polynomial can be found by composition.
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <em>decompose</em>(<expression>) or <em>decompose</em>
- <simple\_expression>
- <P>
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- decompose(x^8-88*x^7+2924*x^6-43912*x^5+263431*x^4-
- 218900*x^3+65690*x^2-7700*x+234)
-
- 2 2 2
- U + 35*U + 234, U=V + 10*V, V=X - 22*X
- decompose(u^2+v^2+2u*v+1)
- 2
- W + 1, W=U + V
- </tt></pre><p>Unlike factorization, this decomposition is not unique. Further
- details can be found in V.S. Alagar, M.Tanh, <Fast Polynomial
- Decomposition>, Proc. EUROCAL 1985, pp 150-153 (Springer) and J. von zur
- Gathen, <Functional>
- <Decomposition of Polynomials: the Tame Case>, J.
- Symbolic Computation (1990) 9, 281-299.
- <P>
- <P>
- <P>
- <a name=r38_0146>
- <title>DEG</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>DEG</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- <P>
- <P>
- The operator <em>deg</em> returns the highest degree of its variable argument
- found in its expression argument.
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <em>deg</em>(<expression>,<kernel>)
- <P>
- <P>
- <P>
- <expression> is expected to be a polynomial expression, not a rational
- expression. Rational expressions are accepted when the switch
- <a href=r38_0300.html#r38_0322>ratarg</a> is on. <variable> must be a
- <a href=r38_0001.html#r38_0002>kernel</a>. The
- results are returned in a list.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- deg((x+y)**5,x);
- 5
- deg((a+b)*(c+2*d)**2,d);
- 2
- deg(x**2 + cos(y),sin(x));
- deg((x**2 + sin(x))**5,sin(x));
- 5
- </tt></pre><p>
- <a name=r38_0147>
- <title>DEN</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>DEN</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- <P>
- <P>
- The <em>den</em> operator returns the denominator of its argument.
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <em>den</em>(<expression>)
- <P>
- <P>
- <P>
- <expression> is ordinarily a rational expression, but may be any valid
- scalar REDUCE expression.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- a := x**3 + 3*x**2 + 12*x;
- 2
- A := X*(X + 3*X + 12)
- b := 4*x*y + x*sin(x);
- B := X*(SIN(X) + 4*Y)
- den(a/b);
- SIN(X) + 4*Y
- den(aa/4 + bb/5);
- 20
- den(100/6);
- 3
- den(sin(x));
- 1
- </tt></pre><p><em>den</em>returns the denominator of the expression after it has
- been
- simplified by REDUCE. As seen in the examples, this includes putting
- sums of rational expressions over a common denominator, and reducing
- common factors where possible. If the expression does not have any
- other denominator, 1 is returned.
- <P>
- <P>
- Switch settings, such as
- <a href=r38_0300.html#r38_0304>mcd</a> or
- <a href=r38_0300.html#r38_0323>rational</a>, have an
- effect on the denominator of an expression.
- <P>
- <P>
- <P>
- <a name=r38_0148>
- <title>DF</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>DF</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- <P>
- <P>
- The <em>df</em> operator finds partial derivatives with respect to one or
- more variables.
- <P>
- <P>
- <P> <H3>
- syntax: </H3>
- <em>df</em>(<expression><em>,</em><var>
- [<em>,</em><number>]
- {<em>,</em><var> [ <em>,</em><number>] } )
- <P>
- <P>
- <P>
- <expression> can be any valid REDUCE algebraic expression. <var>
- must be a
- <a href=r38_0001.html#r38_0002>kernel</a>, and is the differentiation variable.
- <number> must be a non-negative integer.
- <P>
- <P>
- <P> <H3>
- examples: </H3>
- <p><pre><tt>
- df(x**2,x);
- 2*X
- df(x**2*y + sin(y),y);
- 2
- COS(Y) + X
- df((x+y)**10,z);
- 0
- df(1/x**2,x,2);
- 6
- ---
- 4
- X
- df(x**4*y + sin(y),y,x,3);
- 24*X
- for all x let df(tan(x),x) = sec(x)**2;
- df(tan(3*x),x);
- 2
- 3*SEC(3*X)
- </tt></pre><p>An error message results if a non-kernel is entered as a different
- iation
- operator. If the optional number is omitted, it is assumed to be 1.
- See the declaration
- <a href=r38_0150.html#r38_0192>depend</a> to establish dependencies for implicit
-
- differentiation.
- <P>
- <P>
- You can define your own differentiation rules, expanding REDUCE's
- capabilities, using the
- <a href=r38_0150.html#r38_0199>let</a> command as shown in the last example
- above. Note that once you add your own rule for differentiating a
- function, it supersedes REDUCE's normal handling of that function for the
- duration of the REDUCE session. If you clear the rule
- (
- <a href=r38_0150.html#r38_0190>clearrules</a>), you don't get back
- to the previous rule.
- <P>
- <P>
- <P>
- <a name=r38_0149>
- <title>EXPAND_CASES</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>EXPAND\_CASES</b> _ _ _ _ _ _ _ _ _ _ _ _ <b>operator</b><P>
- <P>
-
- <P>
- <P>
- When a
- <a href=r38_0150.html#r38_0176>root_of</a> form in a result of
- <a href=r38_0150.html#r38_0179>solve</a>
- has been converted to a
- <a href=r38_0150.html#r38_0168>one_of</a> form, <em>expand_cases</em>
- can be used to convert this into form corresponding to the
- normal explicit results of
- <a href=r38_0150.html#r38_0179>solve</a>. See
- <a href=r38_0150.html#r38_0176>root_of</a>.
- <P>
- <P>
|