On Oct 17, 2008, at 2:37 AM, Ondrej Certik wrote:

>
> ---
> sympy/series/gruntz.py |   36 ++++++++++++++++++++++++++++++++++++
> 1 files changed, 36 insertions(+), 0 deletions(-)
>
> diff --git a/sympy/series/gruntz.py b/sympy/series/gruntz.py
> index e386f9f..eb9c2cc 100644
> --- a/sympy/series/gruntz.py
> +++ b/sympy/series/gruntz.py
> @@ -87,6 +87,42 @@ the bugs are usually in the series expansion  
> (i.e. in SymPy) or in rewrite.
>
> This code is almost exact rewrite of the Maple code inside the  
> Gruntz thesis.
>
> +Debugging
> +---------
> +
> +Because the gruntz algorithm is highly recursive, it's difficult to  
> figure out
> +what went wrong inside a debugger. Instead, turn on nice debug  
> prints by
> +applying the following patch:
> +
> +@@ -101,7 +108,7 @@ def debug(func):
> +     It will print a nice execution tree with arguments and results
> +     of all decorated functions.
> +     ""
> +-    if 1:
> ++    if 0:
> +         #normal mode - do nothing
> +         return func

wouldn't it be more elegant to have a variable settings.DEBUG  
somewhere (like django does) that turns
on / off global debugging messages ( or an argument for the function,  
like mymethod(args, debug=True) ?

I think the overhead for this should be minimal and it would be nice  
to turn on/off debug messages on all functions
just changing one line in a settings.py file.

>
> +
> +Then start isympy and type the failing limit. For example:
> +
> +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
> +
> +And check manually which line is wrong. Then go to the source code  
> and debug
> +this function to figure out the exact problem.
> +
> """
>
> from sympy.core import Basic, S, Add, Mul, Pow, Function, oo,  
> Symbol, \
> -- 
> 1.5.6.5
>
>
> >

--------------------
Fabian Seoane
http://fseoane.net






--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy-patches" group.
To post to this group, send email to sympy-patches@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sympy-patches?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to