It still does not work satisfactorily (admittedly I did not change anything since my last message, just collecting problem cases). I have created a new blog post describing in detail some of the problems:

http://nessgrh.wordpress.com/2011/07/13/a-question-of-the-argument%E2%80%94or-tricky-branch-cuts-revisited/

Any input is appreciated.

Thanks,
Tom

On 05.07.2011 22:39, Tom Bachmann wrote:
In more detail, somewhere in functions/elementary/complexes.py I would
add principal_branch(z) which represents z with its argument converted
to range (-pi, pi], and argument_period(z) which then satisfies z =
principal_branch(z)*exp(I*2*pi*argument_period(z)). Then e.g.
uppergamma._rewrite_as_unbranched could return an expression involving
these functions. The integration code would use a sequence of operations
as follows to compute the branch of the result:


I went ahead today and did this [1] [2]. Here is what it looks like, for
the example of incomplete gamma functions (the only other example I have
currently implemented is meijerg, and that is shown in the first commit
message):

In [1]: lowergamma(y, x).rewrite('unbranched')
Out[1]:
2⋅ⅈ⋅π⋅y⋅argument_period(branched_argument(x))
ℯ ⋅γ(y, principal_branch(x))

In [6]: lowergamma(-3, exp(I*x)).rewrite('unbranched')
Out[6]:
ⅈ⋅π⋅argument_period(re(x)) ⎛ ⎛ ⅈ⋅x⎞⎞
- ────────────────────────── + γ⎝-3, principal_branch⎝ℯ ⎠⎠

In [7]: _6.subs(x, pi)
Out[7]: γ(-3, -1)

In [8]: _6.subs(x, -pi)
Out[8]:
ⅈ⋅π
γ(-3, -1) + ───
3

Notice that "-1" refers to the point exp(I*pi) by the branching
conventions of sympy, *not* exp(-I*pi).

I'm fairly convinced this is sufficient for my needs. I thought about
something along the lines of Polar(abs, arg) as suggested by Frederik,
but I feared getting it to work with all the rest of sympy would take
long (and I feel I'm already doing too many things that take long ^^).
The way it currently is my changes are very unintrusive, but admittedly
somewhat hacky.

[1]
https://github.com/ness01/sympy/commit/3b11e900e5849f6a0227eb0a4c531075cac52a4f


[2]
https://github.com/ness01/sympy/commit/9ac48a0250df01701d79125c54d7f1afdec4aa07



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

Reply via email to