From P.Gawthrop at eng.gla.ac.uk Mon May 5 17:57:57 2003 From: P.Gawthrop at eng.gla.ac.uk (Peter Gawthrop) Date: Mon, 05 May 2003 16:57:57 +0100 (BST) Subject: Ginsh: ?? does not list all functions Message-ID: <20030505.165757.59463201.P.Gawthrop@eng.gla.ac.uk> I am using the ginac-tools package in the debian testing distribution. Ginsh does not list print_latex or print_csrc in response to ??. This is important to me as I use this feature to generate wrapper function for use with Octave (www.octave.org). Ginsh gives the following: peterg at tiree:peterg$ ginsh ginsh - GiNaC Interactive Shell (GiNaC V1.1.0) __, _______ Copyright (C) 1999-2003 Johannes Gutenberg University Mainz, (__) * | Germany. This is free software with ABSOLUTELY NO WARRANTY. ._) i N a C | You are welcome to redistribute it under certain conditions. <-------------' For details type `warranty;'. Type ?? for a list of help topics. > ?? Available help topics: Li2, Li3, Order, acos, acosh, asin, asinh, atan, atan2, atanh, beta, binomial, charpoly, coeff, collect, collect_common_factors, collect_distributed, content, cos, cosh, decomp_rational, degree, denom, determinant, diag, diff, divide, eval, evalf, evalm, exp, expand, factorial, find, gcd, has, inverse, is, lcm, lcoeff, ldegree, lgamma, log, lsolve, map, match, nops, normal, numer, numer_denom, op, operators, power, prem, primpart, psi, quo, rem, series, sin, sinh, sprem, sqrfree, sqrt, subs, tan, tanh, tcoeff, tgamma, time, trace, transpose, unassign, unit, zeta To get help for a certain topic, type ?topic > ?print_latex parse error, unexpected T_PRINTLATEX, expecting T_SYMBOL or T_TIME or '?' at print_latex > print_latex((y+z)^(-2)); \frac{1}{{(z+y)}^{2}} > Peter. -------------------------------------------------------------------- | Prof. Peter J Gawthrop | Tel: +44 141 330 4960/2528 | | Centre for Systems and Control & | Fax: +44 141 330 4343 | | Dept. of Mechanical Engineering | Room: James Watt 653 | | University of Glasgow | Email: P.Gawthrop at eng.gla.ac.uk | | GLASGOW G12 8QQ, Scotland, UK | URL: www.mech.gla.ac.uk/~peterg | -------------------------------------------------------------------- From Christian.Bauer at Uni-Mainz.DE Tue May 6 15:52:30 2003 From: Christian.Bauer at Uni-Mainz.DE (Christian Bauer) Date: Tue, 6 May 2003 15:52:30 +0200 Subject: Ginsh: ?? does not list all functions In-Reply-To: <20030505.165757.59463201.P.Gawthrop@eng.gla.ac.uk> References: <20030505.165757.59463201.P.Gawthrop@eng.gla.ac.uk> Message-ID: <20030506135230.GH1387@thep.physik.uni-mainz.de> Hi! On Mon, May 05, 2003 at 04:57:57PM +0100, Peter Gawthrop wrote: > Ginsh does not list print_latex or print_csrc in response to ??. Same for print() and iprint(). This is now fixed in CVS. Thanks for noticing it. Bye, Christian -- / Coding on PowerPC and proud of it \/ http://www.uni-mainz.de/~bauec002/ From kreckel at thep.physik.uni-mainz.de Wed May 21 01:09:44 2003 From: kreckel at thep.physik.uni-mainz.de (Richard B. Kreckel) Date: Wed, 21 May 2003 01:09:44 +0200 (CEST) Subject: Bug in diff In-Reply-To: <20030310125755.GB4873@kamapuaa.simula.no> Message-ID: Hi, On Mon, 10 Mar 2003, Ola Skavhaug wrote: > I think I've encountered a bug in GiNaC-1.0.13 (on a Debian Linux machine) > In ginsh: > > > diff(sqrt((-sin((x)))^(2.0)),x); > (1.0+5.0165576136843360246E-20*I)*sin(x)*cos(x)*((-sin(x))^(2.0))^(-1/2) > > The answer should be: > sin(x)*cos(x)*((-sin(x))^(2.0))^(-1/2) > > I have not tried to figure out why this happens (perhaps an uninitialized > variable?) > I've compiled ginac by myself, using cln-1.1.5 (gcc 3.2 compiler) I haven't any idea why you think this is due to an uninitialized variable, but, well, it isn't a bug, strictly speaking. Such behavior is to be expected when dealing with floating points. You should use an integer exponent. In your example (or the slightly simpler diff(sqrt((-x)^(2.)),x)), some stages after power::diff() a mul::combine_overall_coeff(ex, ex) happens, and therin numeric::power() is being called, which in turn calls cln::expt(-1,1.0). That is not guaranteed to be equal -1 by CLTL. However, I do think that we should be somewhat more careful trying to check for unit exponents, but for another reason: When numeric::power_dyn() returns a reference, it can return a pointer to an *existing* object instead of creating a new one on the heap. This will account for some more comparisons by pointer later on and hence be a performance win. For reasons of symmetry, the same check should be done in numeric::power(). I have committed such a patch to the 1.1 and the 1.2 branches. But surprises are still gonna happen with floating point examples unless we start using BCD which I'm sure you don't want. ;-) Cheers -richy. -- Richard B. Kreckel