File:  [CENS] / python / pyGiNaC / test / print.tst
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Sun Mar 11 23:07:20 2001 UTC (16 years, 8 months ago) by pearu
Branches: MAIN
CVS tags: HEAD
Wrapped e?vector, expair, exlist

#
# $Id: print.tst,v 1.1 2001-03-11 23:07:20 pearu Exp $
# Pearu Peterson

_startup = __import__('__startup__')
module = __import__('GiNaC._ginac',globals(),locals(),['_ginac'])

#-----------------------------------------------------
# Test methods: print_, printraw, printtree, printcsrc
#-----------------------------------------------------

basic().print_(0)		:: [basicobject]
basic().printraw()		:: [basicobject]
basic(symbol("a")).printraw()	:: [basicobject]
basic().printtree(2).strip().split(',')[0]	:: type=basic
','.join(basic().printtree(2).strip().split(',')[2:])	:: flags=0,nops=0
','.join(basic(symbol()).printtree(2).strip().split(',')[2:])	:: flags=6,nops=0
basic().printcsrc(0,0) :: 

ex().print_(0)		:: 0
ex().printraw()		:: ex(numeric(0))
ex().printtree(0)[:12]		:: 0(numeric):
ex().printcsrc(0,"foo").strip() :: float foo=0.000000e+00;
ex().printcsrc(1,"foo").strip() :: double foo=0.000000e+00;
ex().printcsrc(2,"foo").strip() :: cl_N foo=cln::cl_F("0");
ex().printcsrc(4,"foo").strip() :: foo=0.000000e+00;

ex(symbol("a")).print_(0)		:: a
ex(symbol("a")).printraw().split('hash')[0] :: ex(symbol(name=a,serial=5,#hash=1075473008,flags=7))
ex(symbol("a")).printtree(0).split(',')[0] :: a(symbol):serial=6#,hash=1075473008(0x401a6a70),flags=7
ex(symbol("a")).printcsrc(0,"foo").strip() :: float foo=a;
ex(symbol("a")).printcsrc(4,"foo").strip() :: foo=a;

numeric("3").print_(0)		:: 3
numeric("3.4").print_(0)	:: 3.4
numeric("3.4444444444444444444444444444444444").print_(0) :: 3.4444444444444444445
numeric("3.123456789012345678901234567890E-23").print_(0) :: 3.123456789012345679E-23
numeric("3").printraw()		:: numeric(3)
numeric("-3.4").printraw()		:: numeric(-3.4L0)
numeric("3").printcsrc(0,0) :: 3.000000e+00
numeric("3.7").printcsrc(0,0) :: 3.700000e+00
numeric("3.123456789012").printcsrc(1,0) :: 3.123457e+00
numeric("3.123456789012").printcsrc(2,0) :: cln::cl_F("3.123456789012")
numeric("3.12345678901234567890123456").printcsrc(2,0) :: cln::cl_F("3.1234567890123456789")

symbol("a").print_(0)		:: a
symbol("a").printraw().split('hash')[0]		:: symbol(name=a,serial=16,#hash=1075473008,flags=6)
symbol("a").printtree(0).split('hash')[0] :: a(symbol):serial=17,#hash=1075473008(0x401a6a70),flags=6
symbol("a").printcsrc(0,0) :: a
symbol("a").printcsrc(0,1) :: a
symbol("a").printcsrc(1,0) :: a

constant("bar",numeric("4")).print_(0) :: bar
constant("bar",numeric("4")).printraw() :: constant(bar)
constant("bar",numeric("4")).printtree(0).split('hash')[0] :: bar,type=constant,#hash=3(0x3),flags=2
constant("bar",numeric("4")).printcsrc(0,0) :: bar

lst(ex()).print_(0)	:: [0]
lst(ex(),ex()).print_(0)	:: [0,0]
lst(ex(),ex(symbol("a"))).print_(0)	:: [0,a]

lst(ex()).printraw()	:: lst(numeric(0),)
lst(ex(),ex(symbol("a"))).printraw().split('hash')[0]	:: lst(numeric(0),symbol(name=a,serial=22,#hash=1075569412,flags=7),)
lst(ex()).printtree(0).split('hash')[0]	:: type=lst,#hash=3(0x3),flags=0,nops=1\n0(numeric):hash=1079838420(0x405d06d4),flags=7\n=====\n
lst(ex()).printcsrc(0,0)	:: 

exprseq(ex()).print_(0)	:: (0)
exprseq(ex(),ex()).print_(0)	:: (0,0)
exprseq(ex(),ex(),ex(),ex(),ex(),ex(),ex(),ex(),ex()).print_(0)	:: (0,0,0,0,0,0,0,0,0)
exprseq(ex(),ex(symbol("a"))).print_(0)	:: (0,a)

exprseq(ex()).printraw()	:: exprseq(numeric(0),)
exprseq(ex(),ex()).printraw()	:: exprseq(numeric(0),numeric(0),)
exprseq(ex()).printtree(0).split('hash')[0] :: type=exprseq,#hash=1344966046(0x502a8d9e),flags=0,nops=1\n0(numeric):hash=1079957204(0x405ed6d4),flags=7\n=====\n
exprseq(ex()).printcsrc(0,0)  ::

function(0).print_(0) :: lgamma()
function(10).print_(0) :: cos()
function(10,ex()).print_(0) :: cos(0)
function(10,ex(),ex()).print_(0) :: cos(0,0)
function(20).print_(0) :: acosh()
function(29).print_(0) :: Order()
function(30,ex(symbol("x"))).print_(0) :: Derivative(x)

function(10).printraw() :: function(name=cos)
function(10,ex()).printraw() :: function(name=cos,0)
function(10).printtree(0).split('hash')[0] :: function cos,#hash=1(0x1),flags=0,nops=0\n=====\n
function(10).printcsrc(0,0) :: cos()
function(10).printcsrc(2,0) :: cos()


ncmul(ex(),ex()).print_(0)	:: 0%0
ncmul(ex(),ex(),ex()).print_(0)	:: 0%0%0
ncmul(ex(),ex(symbol("c"))).print_(0)	:: 0%c
ncmul(ex(symbol("a")),ex(symbol("c"))).print_(0) :: a%c
ncmul(ex(symbol("a")),ex()).print_(0) :: a%0
ncmul(ex(numeric('2')),ex(numeric('7'))).print_(0) :: 2 % 7

ncmul(ex(),ex()).printraw().split('hash')[0]	:: %(numeric(0),numeric(0),,#hash=4294967295,flags=0)
ncmul(ex(),ex()).printtree(0).split('hash')[0]	:: type=ncmul,#hash=4294967295(0xffffffff),flags=0,nops=2\n0(numeric):hash=1080153812(0x4061d6d4),flags=7\n0(numeric):hash=1080153812(0x4061d6d4),flags=7\n=====\n
ncmul(ex(),ex()).printcsrc(0,0) :: ncmul(0.000000e+00,0.000000e+00)
ncmul(ex(),ex()).printcsrc(1,0) :: ncmul(0.000000e+00,0.000000e+00)
ncmul(ex(),ex()).printcsrc(2,0) :: ncmul(0.000000e+00,0.000000e+00)


indexed(ex()).print_(0) :: 0
indexed(ex(symbol("i"))).print_(0) :: i
indexed(ex(symbol("i")),ex(symbol("j"))).print_(0) :: ij
indexed(ex()).printraw().split('hash')[0] :: indexed(ex(numeric(0)),indices=,#hash=1,flags=0)
indexed(ex(),ex()).printraw().split('hash')[0] :: indexed(ex(numeric(0)),indices=ex(numeric(0)),#hash=1,flags=0)
indexed(ex()).printtree(0).split('hash')[0] :: indexed,0indices,#hash=1,flags=0\n
indexed(ex(),ex()).printtree(0).split('hash')[0] :: indexed,1indices,#hash=1,flags=0\n
indexed(ex()).printcsrc(0,0) :: 


expairseq(ex(),ex()).print_(0) :SEGFAULT: 
expairseq(ex(),ex()).printraw() :: expairseq()
expairseq(ex(),ex()).printtree(0).split('hash')[0] :: type=expairseq,#hash=1(0x1),flags=0,nops=0\n=====\n
expairseq(ex(),ex()).printcsrc(0,0) :: 

mul(ex(),ex()).print_(0) :: 0*
mul(ex(),ex(numeric("3"))).print_(0) :: 0*
mul(ex(numeric("2")),ex(numeric("3"))).print_(0) :: 6*
mul(ex(symbol("a")),ex(numeric("3"))).print_(0) :: 3*a
mul(ex(symbol("a")),ex(numeric("3")),ex()).print_(0) :: 0*a
mul(ex(symbol("a")),ex(numeric("3")),ex(symbol("b"))).print_(0) :: 3*a*b

mul(ex(),ex()).printraw().split('=')[0] :: *(,hash#=1,flags=0)
mul(ex(symbol("a")),ex(numeric("5"))).printraw().split(',')[0] :: *((symbol(name=a#,serial=31,hash=1075823000,flags=7),numeric(1)),,hash=1,flags=0)
mul(ex(symbol("a")),ex(numeric("5"))).print_(0) :: 5*a
mul(ex(symbol("a")),ex(numeric("5"))).printtree(0).split('hash')[0] :: type=mul,#hash=0(0x0),flags=0,nops=2\na(symbol):serial=33,hash=1344966046(0x502a8d9e),flags=7\n1(numeric):hash=2147483713(0x80000041),flags=15\n-----\noverall_coeff\n5(numeric):hash=2147483731(0x80000053),flags=15\n=====\n
mul(ex(symbol("a")),ex(numeric("5"))).printcsrc(0,0) :: 5.000000e+00*a
mul(ex(symbol("a")),ex(numeric("5"))).printcsrc(1,0) :: 5.000000e+00*a
mul(ex(symbol("a")),ex(numeric("5"))).printcsrc(2,0) :: cln::cl_F("5.0")*a


add(ex(),ex()).print_(0) :: 
add(ex(),ex(numeric("3"))).print_(0) :: 3
add(ex(numeric("2")),ex(numeric("3"))).print_(0) :: 5
add(ex(symbol("a")),ex(numeric("3"))).print_(0) :: 3+a
add(ex(symbol("a")),ex(symbol("b"))).print_(0) :: b+a

add(ex(),ex()).printraw().split('=')[0] :: +(,hash#=1,flags=0)
add(ex(),ex()).printtree(0).split('hash')[0] :: type=add,#hash=1(0x1),flags=0,nops=0\n=====\n
add(ex(symbol("a")),ex(numeric("5"))).printcsrc(0,0) :: a+5.000000e+00
add(ex(symbol("a")),ex(numeric("5"))).printcsrc(1,0) :: a+5.000000e+00
add(ex(symbol("a")),ex(numeric("5"))).printcsrc(2,0) :: a+cln::cl_F("5.0")

matrix(0,2).print_(0)	:SEGFAULT: 
matrix(1,2).print_(0)	:: [[[[0,0]]]]
matrix(2,1).print_(0)	:: [[[[0]],[[0]]]]
matrix(1,1).print_(0)	:: [[[[0]]]]
matrix(2,2).print_(0)	:: [[[[0,0]],[[0,0]]]]
matrix(1,3).print_(0)	:: [[[[0,0,0]]]]

matrix(1,2).printraw()	:: matrix(1,2,(0,0))
matrix(1,3).printraw()	:: matrix(1,3,(0,0,0))
matrix(1,1).printraw()	:: matrix(1,1,(0))
matrix(3,2).printraw()	:SEGFAULT: 

matrix(1,2).printtree(0).split('hash')[0] :: type=matrix,#hash=1(0x1),flags=0,nops=2\n0(numeric):hash=1079854804(0x405d46d4),flags=7\n0(numeric):hash=1079854804(0x405d46d4),flags=7\n
matrix(2,1).printcsrc(0,0) :: 

power(ex(),numeric("3")).print_(0)  :: 0^3
power(ex(numeric("-7")),numeric("3")).print_(0)  :: (-7)^3

power(ex(),ex()).printraw().split('hash')[0] :: power(ex(numeric(0)),ex(numeric(0)),#hash=1344966046,flags=0)

power(ex(),ex()).printtree(0).split('hash')[0] :: power,#hash=1344966046(0x502a8d9e),flags=0\n0(numeric):hash=1079879380(0x405da6d4),flags=7\n0(numeric):hash=1079879380(0x405da6d4),flags=7\n

power(ex(),ex()).printcsrc(0,0) :: pow(0.000000e+00,0.000000e+00)
power(ex(),ex(numeric("3.4"))).printcsrc(2,0) :: expt(cln::cl_F("0"),cln::cl_F("3.4"))

idx(ex(),ex(numeric("1"))).print_(0) :: .0
idx(ex(symbol("a")),ex(numeric("1"))).print_(0) :: .a
idx(ex(symbol("a")),ex(numeric("2"))).print_(0) :: .a
idx(ex(symbol("a")),ex(symbol("i"))).print_(0) :: .a

idx(ex(),ex(numeric("1"))).printraw().split('hash')[0] :: idx(ex(numeric(0)),dim=ex(numeric(1)),#hash=1344966046,flags=0)

idx(ex(),ex(numeric("1"))).printtree(0).split('hash')[0] :: type=idx0(numeric):#hash=2147483648(0x80000000),flags=15\n,hash=4294967295(0xffffffff),flags=0\n

idx(ex(),ex(numeric("1"))).printcsrc(0,0) :: 

varidx(ex(),ex(numeric("1")),0).print_(0) :: ~0
varidx(ex(),ex(symbol("a")),0).print_(0) :: ~0
varidx(ex(symbol("a")),ex(symbol("i")),0).print_(0) :: ~a
varidx(ex(),ex(numeric("1")),1).print_(0) :: .0
varidx(ex(),ex(symbol("a")),1).print_(0) :: .0
varidx(ex(symbol("a")),ex(symbol("i")),1).print_(0) :: .a

varidx(ex(),ex(numeric("1")),0).printraw().split('hash')[0] :: varidx(ex(numeric(0)),dim=ex(numeric(1)),#hash=4294967295,flags=0)
varidx(ex(),ex(numeric("1")),1).printraw().split('hash')[0] :: varidx(ex(numeric(0)),dim=ex(numeric(1)),#hash=4294967295,flags=0)

varidx(ex(),ex(numeric("1")),0).printtree(0).split('hash')[0] :: type=varidx0(numeric):#hash=2147483648(0x80000000),flags=15\n,hash=1344966046(0x502a8d9e),flags=0\n
varidx(ex(),ex(numeric("1")),1).printtree(0).split('hash')[0] :: type=varidx0(numeric):#hash=2147483648(0x80000000),flags=15\n,hash=339874446(0x1442128e),flags=0\n

varidx(ex(),ex(numeric("1")),0).printcsrc(0,0) ::

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>