X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginsh%2Fginsh.1.in;h=e8c24a5040bb29a61c83c856fa3553bd25edc682;hp=7857f662788093f3b57f5fd68316eaf786ef7a62;hb=d7eee2dd8de4149ff805fd69641316418450275b;hpb=383d5eb3b0f0506810d9105a268f939125bfc347
diff --git a/ginsh/ginsh.1.in b/ginsh/ginsh.1.in
index 7857f662..e8c24a50 100644
--- a/ginsh/ginsh.1.in
+++ b/ginsh/ginsh.1.in
@@ -109,6 +109,13 @@ There is also the special
symbol that controls the numeric precision of calculations with inexact numbers.
Assigning an integer value to digits will change the precision to the given
number of decimal places.
+.SS WILDCARDS
+The has(), match() and subs() functions accept wildcards as placeholders for
+expressions. These have the syntax
+.RS
+.BI $ number
+.RE
+for example $0, $1 etc.
.SS LAST PRINTED EXPRESSIONS
ginsh provides the three special symbols
.RS
@@ -184,22 +191,20 @@ Lists are used by the
.B subs
and
.B lsolve
-functions. A list consists of an opening square bracket
+functions. A list consists of an opening curly brace
+.RB ( { ),
+a (possibly empty) comma-separated sequence of expressions, and a closing curly
+brace
+.RB ( } ).
+.SS MATRICES
+A matrix consists of an opening square bracket
.RB ( [ ),
-a (possibly empty) comma-separated sequence of expressions, and a closing square
-bracket
+a non-empty comma-separated sequence of matrix rows, and a closing square bracket
+.RB ( ] ).
+Each matrix row consists of an opening square bracket
+.RB ( [ ),
+a non-empty comma-separated sequence of expressions, and a closing square bracket
.RB ( ] ).
-.SS MATRICES
-A matrix consists of an opening double square bracket
-.RB ( [[ ),
-a non-empty comma-separated sequence of matrix rows, and a closing double square
-bracket
-.RB ( ]] ).
-Each matrix row consists of an opening double square bracket
-.RB ( [[ ),
-a non-empty comma-separated sequence of expressions, and a closing double square
-bracket
-.RB ( ]] ).
If the rows of a matrix are not of the same length, the width of the matrix
becomes that of the longest row and shorter rows are filled up at the end
with elements of value zero.
@@ -229,16 +234,22 @@ detail here. Please refer to the GiNaC documentation.
.BI charpoly( matrix ", " symbol )
\- characteristic polynomial of a matrix
.br
-.BI coeff( expression ", " symbol ", " number )
-\- extracts coefficient of symbol^number from a polynomial
+.BI coeff( expression ", " object ", " number )
+\- extracts coefficient of object^number from a polynomial
.br
-.BI collect( expression ", " symbol )
-\- collects coefficients of like powers
+.BI collect( expression ", " object-or-list )
+\- collects coefficients of like powers (result in recursive form)
+.br
+.BI collect_distributed( expression ", " list )
+\- collects coefficients of like powers (result in distributed form)
.br
.BI content( expression ", " symbol )
\- content part of a polynomial
.br
-.BI degree( expression ", " symbol )
+.BI decomp_rational( expression ", " symbol )
+\- decompose rational function into polynomial and proper rational function
+.br
+.BI degree( expression ", " object )
\- degree of a polynomial
.br
.BI denom( expression )
@@ -262,6 +273,9 @@ detail here. Please refer to the GiNaC documentation.
.BI evalf( "expression [" ", " level] )
\- evaluates an expression to a floating point number
.br
+.BI evalm( expression )
+\- evaluates sums, products and integer powers of matrices
+.br
.BI expand( expression )
\- expands an expression
.br
@@ -269,7 +283,7 @@ detail here. Please refer to the GiNaC documentation.
\- greatest common divisor
.br
.BI has( expression ", " expression )
-\- returns "1" if the first expression contains the second as a subexpression, "0" otherwise
+\- returns "1" if the first expression contains the second (which may contain wildcards) as a subexpression, "0" otherwise
.br
.BI inverse( matrix )
\- inverse of a matrix
@@ -280,15 +294,18 @@ detail here. Please refer to the GiNaC documentation.
.BI lcm( expression ", " expression )
\- least common multiple
.br
-.BI lcoeff( expression ", " symbol )
+.BI lcoeff( expression ", " object )
\- leading coefficient of a polynomial
.br
-.BI ldegree( expression ", " symbol )
+.BI ldegree( expression ", " object )
\- low degree of a polynomial
.br
.BI lsolve( equation-list ", " symbol-list )
\- solve system of linear equations
.br
+.BI match( expression ", " pattern )
+\- check whether expression matches a pattern; returns a list of wildcard substitutions or "FAIL" if there is no match
+.br
.BI nops( expression )
\- number of operands in expression
.br
@@ -298,6 +315,9 @@ detail here. Please refer to the GiNaC documentation.
.BI numer( expression )
\- numerator of a rational function
.br
+.BI numer_denom( expression )
+\- numerator and denumerator of a rational function as a list
+.br
.BI op( expression ", " number )
\- extract operand from expression
.br
@@ -319,7 +339,7 @@ detail here. Please refer to the GiNaC documentation.
.BI series( expression ", " relation-or-symbol ", " order )
\- series expansion
.br
-.BI sqrfree( expression ", " symbol )
+.BI sqrfree( "expression [" ", " symbol-list] )
\- square-free factorization of a polynomial
.br
.BI sqrt( expression )
@@ -328,9 +348,9 @@ detail here. Please refer to the GiNaC documentation.
.BI subs( expression ", " relation-or-list )
.br
.BI subs( expression ", " look-for-list ", " replace-by-list )
-\- substitute subexpressions
+\- substitute subexpressions (you may use wildcards)
.br
-.BI tcoeff( expression ", " symbol )
+.BI tcoeff( expression ", " object )
\- trailing coefficient of a polynomial
.br
.BI time( expression )
@@ -401,11 +421,11 @@ from within ginsh without having to quit.
.SH EXAMPLES
.nf
> a = x^2\-x\-2;
-\-x+x^2\-2
+\-2\-x+x^2
> b = (x+1)^2;
(x+1)^2
> s = a/b;
-(x+1)^(\-2)*(\-x+x^2\-2)
+(x+1)^(\-2)*(\-2\-x+x^2)
> diff(s, x);
(2*x\-1)*(x+1)^(\-2)\-2*(x+1)^(\-3)*(\-x+x^2\-2)
> normal(s);
@@ -417,17 +437,19 @@ from within ginsh without having to quit.
> Digits = 40;
40
> evalf(s);
-0.999999999999999999999995821133292704384960990679L0
+0.999999999999999999999995821133292704384960990679
> unassign('x');
x
> s;
(x+1)^(\-2)*(\-x+x^2\-2)
-> lsolve([3*x+5*y == 7], [x, y]);
-[x==\-5/3*y+7/3,y==y]
-> lsolve([3*x+5*y == 7, \-2*x+10*y == \-5], [x, y]);
-[x==19/8,y==\-1/40]
-> M = [[ [[a, b]], [[c, d]] ]];
-[[ [[\-x+x^2\-2,(x+1)^2]], [[c,d]] ]]
+> series(sin(x),x==0,6);
+1*x+(\-1/6)*x^3+1/120*x^5+Order(x^6)
+> lsolve({3*x+5*y == 7}, {x, y});
+{x==\-5/3*y+7/3,y==y}
+> lsolve({3*x+5*y == 7, \-2*x+10*y == \-5}, {x, y});
+{x==19/8,y==\-1/40}
+> M = [ [a, b], [c, d] ];
+[[\-x+x^2\-2,(x+1)^2],[c,d]]
> determinant(M);
\-2*d\-2*x*c\-x^2*c\-x*d+x^2*d\-c
> collect(", x);