You can also just use the "manual" hint:

>>> integrate(1/((1-z)),z,manual=True)
-log(-z + 1)

On Friday, February 13, 2015 at 11:33:18 PM UTC-6, Aaron Meurer wrote:
>
> Just compute the definite integral, and evaluate at the limits manually. 
> That is, use integrate(1/(1-z), z). 
>
> However you're going to have problems because as Chris notes, log(1 - z) = 
> log(-1) + log(z - 1) is not always valid (I think it may be true if z < 1, 
> if I remember the rule correctly).  The issue is that for real values, the 
> integral of 1/x should be log(abs(x)) (this isn't true in the complex case, 
> which is why SymPy doesn't return that value). 
>
> I believe the result you get with the I*pi is mathematically correct. That 
> is, if you plug in any real value for z, you'll get the same result as from 
> -log(abs(z - 1)).
>
> Aaron Meurer
>
> On Fri, Feb 13, 2015 at 8:15 PM, Chris Smith <[email protected] 
> <javascript:>> wrote:
>
>> You can do a little manual simplification like this:
>>
>> >>> integrate(1/(1-z),(z,0,z))
>> -log(z - 1) + I*pi
>> >>> exp(_)
>> -1/(z - 1)
>> >>> 1/(-1/_/-1)  # the badger-face inversion :-)
>> 1/(-z + 1)
>> >>> log(_)
>> log(1/(-z + 1))
>>
>> But that can't simplify to -log(1-z) because that is not valid unless 1-z 
>> is positive.
>>
>> >>> expand_log(log(1/Dummy(positive=True)))
>> -log(_Dummy_85)
>> >>> expand_log(log(1/Dummy(nonnegative=True)))
>> log(1/_Dummy_86)
>> >>> expand_log(log(1/Dummy(negative=True)))
>> log(1/_Dummy_107)
>>
>>
>> On Friday, February 13, 2015 at 6:37:56 PM UTC-6, Ian Bell wrote:
>>>
>>> There was an embedded image, but clearly that didn't work.
>>>
>>> >> integrate(1/(1-z),(z,0,z))
>>>
>>> was the command.  I used a picture to show that you get an imaginary 
>>> term as part of the return value
>>>
>>> On Friday, February 13, 2015 at 4:11:54 PM UTC-7, Aaron Meurer wrote:
>>>>
>>>>
>>>>
>>>> On Fri, Feb 13, 2015 at 3:42 PM, Ian Bell <[email protected]> wrote:
>>>>
>>>>> I am trying to do an integration like this:
>>>>>
>>>>
>>>> Was there supposed to be something here? It's just showing up as empty 
>>>> space for me.
>>>>
>>>> Aaron Meurer
>>>>  
>>>>
>>>>>
>>>>>
>>>>>
>>>>> Ultimately the result I should be able to get is -log(1-z)
>>>>>
>>>>> Manual integration shows that you can integrate(1/(1-z),z) -> 
>>>>> -log(z-1), evaluation at the limits yields -log(z-1) - (-log(-1)) which 
>>>>> you 
>>>>> can simplify to -log(1-z).  How can I tell sympy to delay evaluation 
>>>>> until 
>>>>> after it has done the simplification?  I guess that it first does 
>>>>> log(-1), 
>>>>> which it isn't happy about...
>>>>>
>>>>> Ian
>>>>>
>>>>> -- 
>>>>> You received this message because you are subscribed to the Google 
>>>>> Groups "sympy" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>>> an email to [email protected].
>>>>> To post to this group, send email to [email protected].
>>>>> Visit this group at http://groups.google.com/group/sympy.
>>>>> To view this discussion on the web visit https://groups.google.com/d/
>>>>> msgid/sympy/fdbada4e-6ba0-4de5-835f-5121aaa022ce%40googlegroups.com 
>>>>> <https://groups.google.com/d/msgid/sympy/fdbada4e-6ba0-4de5-835f-5121aaa022ce%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "sympy" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected] <javascript:>
>> .
>> Visit this group at http://groups.google.com/group/sympy.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/sympy/95372b64-3f66-484b-b8c2-1efff0d3a87f%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/sympy/95372b64-3f66-484b-b8c2-1efff0d3a87f%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/9279f416-efa5-4cbe-b5bd-21894c1609c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to