maxima-commits

 [Maxima-commits] CVS: maxima/doc/info Expressions.texi,1.38,1.39 From: Robert Dodier - 2005-07-29 06:16:22 ```Update of /cvsroot/maxima/maxima/doc/info In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22590 Modified Files: Expressions.texi Log Message: Revised description of op. Added examples to carg, constantp, and op. Index: Expressions.texi =================================================================== RCS file: /cvsroot/maxima/maxima/doc/info/Expressions.texi,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- Expressions.texi 16 Jun 2005 17:05:29 -0000 1.38 +++ Expressions.texi 29 Jul 2005 06:16:13 -0000 1.39 @@ -491,8 +491,9 @@ @deffn {Function} carg (@var{z}) Returns the complex argument of @var{z}. -The complex argument is an angle @code{theta} in @code{[-%pi, %pi]} +The complex argument is an angle @code{theta} in @code{(-%pi, %pi]} such that @code{r exp (theta %i) = @var{z}} where @code{r} is the magnitude of @var{z}. +@c ACTUALLY carg DOESN'T ALWAYS RETURN A VALUE IN (-%pi, %pi]; SEE SF BUG REPORT # 816166 @code{carg} is a computational function, not a simplifying function. @@ -506,7 +507,36 @@ See also @code{abs} (complex magnitude), @code{polarform}, @code{rectform}, @code{realpart}, and @code{imagpart}. -@... NEED EXAMPLES HERE +Examples: + +@c ===beg=== +@c carg (1); +@c carg (1 + %i); +@c carg (exp (%i)); +@c carg (exp (%pi * %i)); +@c carg (exp (3/2 * %pi * %i)); +@c carg (17 * exp (2 * %i)); +@c ===end=== + +@example +(%i1) carg (1); +(%o1) 0 +(%i2) carg (1 + %i); + %pi +(%o2) --- + 4 +(%i3) carg (exp (%i)); +(%o3) 1 +(%i4) carg (exp (%pi * %i)); +(%o4) %pi +(%i5) carg (exp (3/2 * %pi * %i)); + %pi +(%o5) - --- + 2 +(%i6) carg (17 * exp (2 * %i)); +(%o6) 2 +@end example + @end deffn @c NEEDS EXPANSION, CLARIFICATION, AND EXAMPLES @@ -529,7 +559,22 @@ variables bound to a constant or declared constant by @code{declare}, or functions whose arguments are constant. -@... NEED EXAMPLES HERE +@code{constantp} evaluates its arguments. + +Examples: + +@c ===beg=== +@c constantp (7 * sin(2)); +@c constantp (%pi * sin(%e)); +@c constantp (exp (x)); +@c declare (x, constant); +@c constantp (exp (x)); +@c constantp (foo (x) + bar (%e) + baz (2)); +@c ===end=== + +@example +@end example + @end deffn @c NEEDS EXPANSION, CLARIFICATION, AND EXAMPLES @@ -1193,8 +1238,59 @@ @c NEEDS WORK @deffn {Function} op (@var{expr}) -Returns the operator of the expression, and functions the same way as -@...{part (expr, 0)}. It observes the setting of the @code{inpart} flag. +Returns the main operator of the expression @var{expr}. +@code{op (@var{expr})} is equivalent to @code{part (@var{expr}, 0)}. + +@code{op} returns a string if the main operator is +a built-in or user-defined +prefix, binary or n-ary infix, postfix, matchfix, or nofix operator. +Otherwise @code{op} returns a symbol. + +@code{op} observes the value of the global flag @code{inflag}. + +@code{op} evaluates it argument. + +See also @code{args}. + +Examples: + +@c ===beg=== +@c ?stringdisp: true\$ +@c op (a * b * c); +@c op (a * b + c); +@c op ('sin (a + b)); +@c op (a!); +@c op (-a); +@c op ([a, b, c]); +@c op ('(if a > b then c else d)); +@c op ('foo (a)); +@c prefix (foo); +@c op (foo a); +@c ===end=== + +@example +(%i1) ?stringdisp: true\$ +(%i2) op (a * b * c); +(%o2) "*" +(%i3) op (a * b + c); +(%o3) "+" +(%i4) op ('sin (a + b)); +(%o4) sin +(%i5) op (a!); +(%o5) "!" +(%i6) op (-a); +(%o6) "-" +(%i7) op ([a, b, c]); +(%o7) "[" +(%i8) op ('(if a > b then c else d)); +(%o8) "if" +(%i9) op ('foo (a)); +(%o9) foo +(%i10) prefix (foo); +(%o10) "foo" +(%i11) op (foo a); +(%o11) "foo" +@end example @end deffn ```