ginsh symbols example
Christian Bauer
cbauer at ThEP.Physik.Uni-Mainz.DE
Fri Oct 8 16:42:05 CEST 1999
Hi!
Just a (short?) example on how symbols now behave in ginsh after the
latest modifications to GiNaC and ginsh:
ghost:~/projects/ginsh$ ./ginsh
ginsh - GiNaC Interactive Shell V0.3
Copyright (C) 1999 Johannes Gutenberg Universitaet Mainz, Germany
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details.
> expand((a+b)^2); expand(('a'+'b')^2);
a^2+b^2+2*b*a
a^2+b^2+2*b*a
> a=2; b=-3;
2
-3
> expand((a+b)^2); expand(('a'+'b')^2);
1
a^2+b^2+2*b*a
> x=a+b; y='a'+'b';
-1
b+a
> x; 'x'; y; 'y';
-1
x
-1
y
> print(x); print('x'); print(y); print('y');
-1 (numeric): hash=2147483649 (0x80000001), flags=11
x (symbol): serial=8, hash=10 (0xa), flags=3
-1 (numeric): hash=2147483649 (0x80000001), flags=11
y (symbol): serial=13, hash=10 (0xa), flags=3
> eval(x); eval('x'); eval(x,1); eval('x',1);
-1
-1
-1
-1
> eval(y); eval('y'); eval(y,1); eval('y',1);
-1
-1
-1
a+b
> expand(x^2); expand('x'^2);
1
x^2
> expand(y^2); expand('y'^2);
1
y^2
> unassign('a'); unassign('b');
a
b
> x; 'x'; y; 'y';
-1
x
a+b
y
> print(x); print('x'); print(y); print('y');
-1 (numeric): hash=2147483649 (0x80000001), flags=11
x (symbol): serial=8, hash=10 (0xa), flags=3
type=3add, hash=0 (0x0), flags=3, nops=2
a (symbol): serial=2, hash=376325877 (0x166e46f5), flags=11
1 (numeric): hash=2147483649 (0x80000001), flags=11
-----
b (symbol): serial=5, hash=659577159 (0x27505947), flags=11
1 (numeric): hash=2147483649 (0x80000001), flags=11
=====
y (symbol): serial=13, hash=10 (0xa), flags=3
> eval(x); eval('x'); eval(x,1); eval('x',1);
-1
-1
-1
-1
> eval(y); eval('y'); eval(y,1); eval('y',1);
a+b
a+b
a+b
a+b
> expand(x^2); expand('x'^2);
1
x^2
> expand(y^2); expand('y'^2);
a^2+b^2+2*b*a
y^2
> quit
Bye,
Christian
--
/ Coding on PowerPC and proud of it
\/ http://www.uni-mainz.de/~bauec002/
More information about the GiNaC-devel
mailing list