summation() should probably have a conds argument similar to
integrate() that lets you disable the piecewise.

You can always manually extract it from the expression:

>>> sympy.summation(sympy.S('z^k / k'), sympy.S('(k, 1, oo)')).args[0].args[0]
-log(1 - z)

Ideally refine() would let you do this, but it doesn't seem to work yet.

Aaron Meurer

On Tue, Aug 18, 2020 at 7:44 AM [email protected]
<[email protected]> wrote:
>
> I'll try to clarify. Putting software aside momentarily, in pure math, for z 
> real or complex with abs(z) < 1, for k from 1 to infinity, the following 
> power-series summations hold:
>
> -log(1-x) = sum (z^k / k)
> log(1-x) = sum(-1 * z^k / k)
> log(1+x) = sum(-1 * z^k * (-1)^k / k)
>
> Maple and Mathematica can both do those, using their sum functions. (I'm not 
> 100% confident in their handling of edge cases like z=-1 and z=+1, but my 
> testing their has been haphazard.)
>
> I keep changing my story about Maxima, as I learn more about it. Yesterday I 
> said Maxima cannot do those sums. Last night I learned Maxima can do them, 
> via its "simplify_sum" feature, whose documentation is hidden in an obscure 
> Chapter 84. Maxima manual's "Summation" chapter includes no mention of 
> "simplify_sum". (I'm curious how many decades this Maxima documentation-bug 
> has persisted without anyone simply moving "simplify_sum" to the chapter on 
> sums. All 55 years of Maxima's history?)
>
> Sympy can sum those into Piecewise expressions:
>
> >>> sympy.summation(sympy.S('z^k / k'), sympy.S('(k, 1, oo)'))
> Piecewise((-log(1 - z), (z >= -1) & (z < 1)), (Sum(z**k/k, (k, 1, oo)), True))
> >>>
>
> The catch is, there's no way to ask Sympy "what's that Piecewise expression 
> assuming abs(z) < 1"? Neither old nor new Sympy assumptions can express that 
> query.
>
> I see two issues: Lack of functionality and room for 
> documentation-improvement. I haven't designed and implemented my own 
> assumptions-system, so I can't speak to its difficulty. Maxima's been worked 
> on by countless geniuses for 55 years and still has an admittedly weak 
> assumptions system; so maybe assumptions are especially hard for 
> CAS-designers.
>
> The second issue is documentation. I have spent many months in many CAS's 
> trying to sum the power series of log(1+x). I could have accomplished the 
> same in a day is the CAS's had been documented better.
>
>
> On Monday, August 17, 2020 at 11:00:47 PM UTC-7 [email protected] wrote:
>>
>> David,
>>
>> I'm not on this project, but I think it would save the devs time if you 
>> would specify the sum you are referring to.
>>
>> -- Kind Regards,
>> Christian
>>
>> On Mon, Aug 17, 2020, 3:32 PM first last <[email protected]> wrote:
>>>
>>> P.S. Maxima and Axiom are also unable to do this sum. Mathematica and Maple 
>>> are able to do it.
>>>
>>> On Monday, August 17, 2020 at 3:30:26 PM UTC-7, first last wrote:
>>>>
>>>> I'll take the response as, there's no way to get Sympy to do this sum.
>>>>
>>>> On Friday, August 14, 2020 at 4:17:20 PM UTC-7, David Bailey wrote:
>>>>>
>>>>> Dear group,
>>>>>
>>>>> Am I correct that the write-up about assumptions found here relates to 
>>>>> the old-style assumptions:
>>>>>
>>>>> https://docs.sympy.org/latest/modules/assumptions/assume.html
>>>>>
>>>>> Is there any documentation relating to the new assumptions?
>>>>>
>>>>> It would be really helpful if the documentation for old or new 
>>>>> assumptions indicated which type it related to.
>>>>>
>>>>> David
>>>
>>> --
>>> 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 view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/sympy/bbdc2130-172b-4d04-a542-95321e3de4d1o%40googlegroups.com.
>
> --
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/sympy/c9f81be1-4dec-4bb4-8079-af1f044d0ab3n%40googlegroups.com.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6LohTbmM5LcksV%3Dr-FivNzpwLYLLVR41f4LrL4LHzjygg%40mail.gmail.com.

Reply via email to