1 .TH ginaccint 1 "January, 2000" "GiNaC"
3 GiNaC-cint \- An interactive interface for GiNaC based on the Cint C/C++ interpreter
9 is an interactive frontend for the GiNaC symbolic computation
10 framework. It is a tool that lets you write interactive programs
11 (scripts) in C++ that directly make use of GiNaC's classes. Thus it
12 is a more complete replacement for traditional interactive computer
13 algebra systems than \fBginsh\fP(1) is. Programs may be composed as
14 scripts and later compiled with the native compiler and linked into
18 After startup, GiNaC-cint reads and executes the files given as
19 command line arguments. If any of these files contains a
21 command, GiNaC-cint exits at this point.
22 Otherwise it displays a prompt signifying that it is ready to
23 accept your input. All C++ statements are valid as input, extended by
24 GiNaC's numeric or symbolic expressions. E.g.
25 .BR fibonacci(24)/1104;
26 returns a GiNaC object of class
28 , which in this case represents the numeric 42. Symbols are declared by
31 GiNaC> symbol x("x"), y("y"), z;
33 which defines two named symbols and an anonymous one for later usage.
34 All GiNaC methods and functions are available as they would be coded
35 in C++. It is not necessary to explicitly invoke a print command as
36 the last expression is automatically printed:
38 GiNaC> pow(x+y,4).expand();
39 Out2 = x^4+4*x^3*y+6*x^2*y^2+4*x*y^3+y^4
41 Statements are generally closed either when a closing brace
43 matches the first opening brace
51 Switch to cint's interactive mode.
55 Allow a function definition in interactive mode. GiNaC-cint must be
56 put into a special mode in order to define a function. After that any
57 function definition in valid C++ syntax may be typed in. It becomes
58 immediatly available for usage.
62 List a short summary of available commands.
65 Exit from GiNaC-cint. Same as
73 .IP "\fB.read filename\fB"
75 Read a file from disk and execute it in GiNaC-cint
76 (recursive call is possible).
78 .IP "\fB.redirect [filename]\fB"
81 .BR "\fBOut\fP\fInum\fP"
84 alone redirects output to console).
88 Restart GiNaC-cint (does not re-read command line files).
90 .IP "\fB.save filename\fB"
92 Save the commands you have entered so far in a file.
97 .BR "\fBOut\fP\fInum\fP"
98 output (variables are still accessible).
100 .IP "\fB.> [filename]\fB"
103 .BR "\fB.redirect [filename]\fB"
106 .IP "\fBOut\fP\fInum\fP"
107 Returns the expression whose output was marked
108 .BR "\fBOut\fP\fInum\fP"
111 .IP "\fBLAST\fP, \fBLLAST, \fP\fBLLLAST\fP"
112 Return the last, second last and third last expression,
117 GiNaC> symbol x("x"), y("y"), z("z");
118 GiNaC> ex a = pow(x,2)-x-2;
119 GiNaC> ex b = pow(x+1,2);
122 Out1 = -2*(1+x)^(-3)*(-2-x+x^2)+(-1+2*x)*(1+x)^(-2)
124 Out2 = (-2+x)*(1+x)^(-1)
125 GiNaC> for (int i=2; i<20; i+=2) {
126 > cout << "B(" << i << ")==" << bernoulli(i) << endl;
138 next expression can be a function definition
139 GiNaC> ex EulerNumber(unsigned n)
142 > const ex generator = pow(cosh(xi),-1);
143 > return generator.diff(xi,n).subs(xi==0);
145 creating file /tmp/ginac26197caa
146 GiNaC> EulerNumber(42);
147 Out3 = -10364622733519612119397957304745185976310201
148 GiNaC> ex f = expand((x*y*z-1)*(x*y*z+3));
149 GiNaC> ex g = expand((x*y*z-1)*(x*y*z-3));
150 GiNaC> cout << "The GCD of " << f << " and " << g << endl
151 > << " is " << gcd(f, g) << endl
152 > << " so " << f/g << endl
153 > << " is " << normal(f/g) << endl;
154 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
156 so (-3+2*x*z*y+x^2*z^2*y^2)*(3-4*x*z*y+x^2*z^2*y^2)^(-1)
157 is (-3+x*z*y)^(-1)*(3+x*z*y)
162 Cint accepts most of K&R and ANSI C/C++ language construct but not
163 perfect. In fact, Cint is not aimed to be a 100% ANSI/ISO compliant
164 C/C++ language processor. It rather is a portable script language
165 environment which is close enough to the standard C++. See the file
167 in your Cint distribution. Please take the time to track down any bug
168 you encounter as far as possible and contact Masaharu Goto
169 <MXJ02154@niftyserve.or.jp> for Cint-related bugs and
170 <ginac-bugs@ginac.de> for any bugs in the GiNaC engine.
172 Only expressions (class
174 are typed out and available through
175 .BR "\fBOut\fP\fInum\fP"
178 after declaring them. This accounts for some funny behaviour, like
182 does, since this is not a naked number but an expression holding
183 that number. A warning message is printed in this case only for
190 Christian Bauer <Christian.Bauer@uni-mainz.de>
192 Alexander Frink <Alexander.Frink@uni-mainz.de>
194 Richard Kreckel <Richard.Kreckel@uni-mainz.de>
196 Agilent Technologies Japan
198 Masaharu Goto <MXJ02154@niftyserve.or.jp>
200 GiNaC Tutorial \- An open framework for symbolic computation within the
201 C++ programming language
203 CLN \- A Class Library for Numbers, Bruno Haible
208 Copyright \(co 1999-2000 Johannes Gutenberg Universit\(:at Mainz, Germany
210 This program is free software; you can redistribute it and/or modify
211 it under the terms of the GNU General Public License as published by
212 the Free Software Foundation; either version 2 of the License, or
213 (at your option) any later version.
215 This program is distributed in the hope that it will be useful,
216 but WITHOUT ANY WARRANTY; without even the implied warranty of
217 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
218 GNU General Public License for more details.
220 You should have received a copy of the GNU General Public License
221 along with this program; if not, write to the Free Software
222 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
224 Copyright \(co of Cint and associated tools are owned by Agilent
225 Technologies Japan Company and the author. Acknowledgement to the
226 author by e-mail is recommended at installation. Source code, binary
227 executable or library of Cint and associated tools can be used,
228 modified and distributed free of charge for any purpose provided that
229 the copyright notice appear in all copies and that both that copyright
230 notice and this permission notice appear in documentation.
231 Registration is requested, at this moment, for commercial use. Send
232 e-mail to the author <MXJ02154@niftyserve.or.jp>. The registration is