After startup, ginsh displays a prompt signifying that it is ready to
accept your input. All C++ statements are valid as input, extended by
GiNaC's numeric or symbolic expressions. E.g.
-.BR fibonacci(24)/1104;
+.BR fibonacci(24)/1104;
returns a GiNaC object of class
.BR ex,
, which in this case represents the numeric 42. Symbols are declared by
.RB ( ; )
is encountered.
+.SS SPECIAL COMMANDS
+.IP "\fB.cint\fR"
+Switch to cint interactive mode.
+.IP "\fB.function\fR"
-.SS FUNCTION DEFINITIONS
-GiNaC-cint must be put into a special mode in order to define a
-function. This is done with the command
-.RB .function .
-After that any function definition in valid C++ syntax may be typed
-in. It becomes immediatly available for usage.
+Allow a function definition in interactive mode. GiNaC-cint must be
+put into a special mode in order to define a function. After that any
+function definition in valid C++ syntax may be typed in. It becomes
+immediatly available for usage.
+
+.IP "\fBquit;\fR"
+Exit from GiNaC-Cint. Same as
+.BR "exit;" ,
+.BR "bye;" ,
+.BR ".q" ,
+.BR ".quit" ,
+.BR ".exit " or
+.BR ".bye" .
+
+.IP "\fBOut\fP\fInum\fP"
+Returns the expression whose output was marked
+.BR "\fBOut\fP\fInum\fP"
+as a handle.
+
+.IP "\fBLAST\fP, \fBLLAST, \fP\fBLLLAST\fP"
+Return the last, second last and third last expression,
+respectively.
.SH EXAMPLES
.nf
GiNaC> ex b = pow(x+1,2);
GiNaC> ex s = a/b;
GiNaC> s.diff(x);
-out1 -2*(1+x)^(-3)*(-2-x+x^2)+(-1+2*x)*(1+x)^(-2)
+Out1 = -2*(1+x)^(-3)*(-2-x+x^2)+(-1+2*x)*(1+x)^(-2)
GiNaC> s.normal();
-out2 (-2+x)*(1+x)^(-1)
+Out2 = (-2+x)*(1+x)^(-1)
+GiNaC> for (int i=2; i<20; i+=2) {
+ > cout << "B(" << i << ")==" << bernoulli(i) << endl;
+ > }
+B(2)==1/6
+B(4)==-1/30
+B(6)==1/42
+B(8)==-1/30
+B(10)==5/66
+B(12)==-691/2730
+B(14)==7/6
+B(16)==-3617/510
+B(18)==43867/798
GiNaC> .function
next expression can be a function definition
GiNaC> ex EulerNumber(unsigned n)
> {
- > symbol x;
- > ex generator = pow(cosh(x),-1);
- > return generator.diff(x,n).subs(x==0);
+ > symbol xi;
+ > const ex generator = pow(cosh(xi),-1);
+ > return generator.diff(xi,n).subs(xi==0);
> }
creating file /tmp/ginac26197caa
GiNaC> EulerNumber(42);
-out3 -10364622733519612119397957304745185976310201
+Out3 = -10364622733519612119397957304745185976310201
+GiNaC> ex f = expand((x*y*z-1)*(x*y*z+3));
+GiNaC> ex g = expand((x*y*z-1)*(x*y*z-3));
+GiNaC> cout << "The GCD of " << f << " and " << g << endl
+ > << " is " << gcd(f, g) << endl
+ > << " so " << f/g << endl
+ > << " is " << normal(f/g) << endl;
+The GCD of -3+2*x*z*y+x^2*z^2*y^2 and 3-4*x*z*y+x^2*z^2*y^2
+ is -1+x*z*y
+ so (-3+2*x*z*y+x^2*z^2*y^2)*(3-4*x*z*y+x^2*z^2*y^2)^(-1)
+ is (-3+x*z*y)^(-1)*(3+x*z*y)
GiNaC> quit;
.fi
.SH AUTHOR
.TP
-The GiNaC Group:
+The GiNaC Group
.br
Christian Bauer <Christian.Bauer@uni-mainz.de>
.br
Alexander Frink <Alexander.Frink@uni-mainz.de>
.br
Richard Kreckel <Richard.Kreckel@uni-mainz.de>
+.TP
+Agilent Technologies Japan
+.br
+Masaharu Goto <MXJ02154@niftyserve.or.jp>
.SH SEE ALSO
GiNaC Tutorial \- An open framework for symbolic computation within the
C++ programming language