On Mon, 22 Jun 2009 at 10:00PM -0600, Ondrej Certik wrote: > Sometimes if the code is very recursive, I use a hand made debugging > printing using decorators --- I decorate each function I want to debug > and it prints a nice tree like graph, so it's easy to check things, > e.g: > > SYMPY_DEBUG=True ./bin/isympy > > In [1]: limit(sin(x)/x, x, 0) > limitinf(_x*sin(1/_x), _x) = 1 > +-mrv_leadterm(_x*sin(1/_x), _x) = (1, 0) > | +-mrv(_x*sin(1/_x), _x) = set([_x]) > | | +-mrv(_x, _x) = set([_x]) > | | +-mrv(sin(1/_x), _x) = set([_x]) > | | +-mrv(1/_x, _x) = set([_x]) > | | +-mrv(_x, _x) = set([_x]) > | +-mrv_leadterm(exp(_x)*sin(exp(-_x)), _x, set([exp(_x)])) = (1, 0) > | +-rewrite(exp(_x)*sin(exp(-_x)), set([exp(_x)]), _x, _w) = > (1/_w*sin(_w), -_x) > | +-sign(_x, _x) = 1 > | +-mrv_leadterm(1, _x) = (1, 0) > +-sign(0, _x) = 0 > +-limitinf(1, _x) = 1
Please share this code! I often am writing deeply recursive code and it's so easy to get confused. I'd love to have the indentation correspond to the call depth. Dan -- --- Dan Drake <dr...@kaist.edu> ----- KAIST Department of Mathematical Sciences ------- http://mathsci.kaist.ac.kr/~drake
signature.asc
Description: Digital signature