X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=cint%2Fginaccint.1;h=aef0b0a66c9b757b35822a6ecf763994dec423ad;hp=c74405ae827a6e89dd281b65264ed1bcab065f4e;hb=660dc3380d44928709d5ac47d3ad6e98bb7c30c2;hpb=956eeb82c513a723e864edefa857133282cf692b diff --git a/cint/ginaccint.1 b/cint/ginaccint.1 index c74405ae..aef0b0a6 100644 --- a/cint/ginaccint.1 +++ b/cint/ginaccint.1 @@ -6,17 +6,18 @@ GiNaC-cint \- An interactive interface for GiNaC based on the Cint C/C++ interpr .SH DESCRIPTION .B ginaccint is an interactive frontend for the GiNaC symbolic computation -framework. It is a tool that lets you write interactive programs in -C++ that directly make use of GiNaC's classes and thus a more complete -replacement for traditional interactive computer algebra systems than -\fBginsh\fP(1) is. Programs may be composed as scripts and later compiled -with the native compiler and linked into the system. +framework. It is a tool that lets you write interactive programs +(scripts) in C++ that directly make use of GiNaC's classes. Thus it +is a more complete replacement for traditional interactive computer +algebra systems than \fBginsh\fP(1) is. Programs may be composed as +scripts and later compiled with the native compiler and linked into +the system. .SH USAGE .SS INPUT FORMAT 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 @@ -25,14 +26,14 @@ statements as GiNaC> symbol x("x"), y("y"), z; .fi which defines two named symbols and an anonymous one for later usage. -All GiNaC methods and functions are available as they would be typed +All GiNaC methods and functions are available as they would be coded in C++. It is not necessary to explicitly invoke a print command as the last expression is automatically printed: .nf GiNaC> pow(x+y,4).expand(); -out2 = x^4+4*x^3*y+6*x^2*y^2+4*x*y^3+y^4 +Out2 = x^4+4*x^3*y+6*x^2*y^2+4*x*y^3+y^4 .fi -Statements are generally closed by either when a closing brace +Statements are generally closed either when a closing brace .RB ( } ) matches the first opening brace .RB ( { ) @@ -40,13 +41,33 @@ or a semicolon .RB ( ; ) is encountered. +.SS SPECIAL COMMANDS +.IP "\fB.cint\fR" +Switch to cint's 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 @@ -55,20 +76,42 @@ GiNaC> ex a = pow(x,2)-x-2; 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 @@ -83,15 +126,32 @@ you encounter as far as possible and contact Masaharu Goto for Cint-related bugs and for any bugs in the GiNaC engine. +Only expressions (class +.BR ex ) +are typed out and available through +.BR "\fBOut\fP\fInum\fP" +and +.BR LAST +after declaring them. This accounts for some funny behaviour, like +.BR fibonacci(7) +doesn't print, but +.BR fibonacci(7)*1 +does, since this is not a naked number but an expression holding +that number. + .SH AUTHOR .TP -The GiNaC Group: +The GiNaC Group .br Christian Bauer .br Alexander Frink .br Richard Kreckel +.TP +Agilent Technologies Japan +.br +Masaharu Goto .SH SEE ALSO GiNaC Tutorial \- An open framework for symbolic computation within the C++ programming language @@ -100,17 +160,6 @@ CLN \- A Class Library for Numbers, Bruno Haible .PP \fBginsh\fP(1) .SH COPYRIGHT -.SS CINT COPYRIGHT -Copyright \(co of Cint and associated tools are owned by Agilent -Technologies Japan Company and the author. Acknowledgement to the -author by e-mail is recommended at installation. Source code, binary -executable or library of Cint and associated tools can be used, -modified and distributed free of charge for any purpose provided that -the copyright notice appear in all copies and that both that copyright -notice and this permission notice appear in documentation. -Registration is requested, at this moment, for commercial use. Send -e-mail to the author . The registration is -free. .SS GINAC COPYRIGHT Copyright \(co 1999-2000 Johannes Gutenberg Universit\(:at Mainz, Germany @@ -127,3 +176,14 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +.SS CINT COPYRIGHT +Copyright \(co of Cint and associated tools are owned by Agilent +Technologies Japan Company and the author. Acknowledgement to the +author by e-mail is recommended at installation. Source code, binary +executable or library of Cint and associated tools can be used, +modified and distributed free of charge for any purpose provided that +the copyright notice appear in all copies and that both that copyright +notice and this permission notice appear in documentation. +Registration is requested, at this moment, for commercial use. Send +e-mail to the author . The registration is +free.