Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: D under Sum

  • To: mathgroup at smc.vnet.net
  • Subject: [mg128392] [mg128392] Re: D under Sum
  • From: Nicolas Venuti <nicolas at virtualdynamics.fr>
  • Date: Fri, 12 Oct 2012 00:00:47 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <20121011060947.F240268D8@smc.vnet.net> <CAEtRDSfNzXGyiVviRexw_zgkxVB=JDAAECkUCH6HjR-mr0cNMg@mail.gmail.com>

Thank you Bob

Unfortunatly it does not work for :

D[p i + holdSum[p*i, {i, 1, n}], p]

or any expression that include (recursively) holdSum

Le 11 oct. 2012 =E0 14:26, Bob Hanlon a =E9crit :

> It is recommended that user-defined functions always start with a
> lower case letter to avoid any potential naming conflicts with current
> or future built-in functions.
>
> Use UpValues
>
> holdSum /: D[
>   holdSum[expr_, iter_?VectorQ],
>   x_Symbol] :=
>  holdSum[D[expr, x], iter];
>
> holdSum /: ReleaseHold[holdSum[arg__]] :=
>  Sum[arg];
>
> D[holdSum[p*i, {i, 1, n}], p]
>
> holdSum[i, {i, 1, n}]
>
> % // ReleaseHold
>
> (1/2)*n*(1 + n)
>
>
> Bob Hanlon
>
>
> On Thu, Oct 11, 2012 at 2:09 AM, Nicolas Venuti
> <nicolas at virtualdynamics.fr> wrote:
>> Hello
>>
>> I want the derivation D to be applied under the Sum sign,
>> I have a function HoldSum that do not evaluate but is similar to Sum in form
>>
>> In[3]:= D[HoldSum[p*i, {i, 1, n}], p]
>>
>> I get the output :
>>
>> Out[3]=i*HoldSum^(1, {0, 0, 0})[i p, {i, 1, n}]
>>
>> but I would want that D be applied under the Sum sign like done by hand here :
>>
>> In[5]:= HoldSum[D[p i, i], {i, 1, n}]
>>
>> Out[5]= HoldSum[p, {i, 1, n}]
>>
>> Obviously I want D to work for any expression containing HoldSum (even on nested HoldSum expression)
>>
>> Does anybody knows how to do that ?
>>
>> Best regards
>>
>> Nicolas
>>







  • References:
    • D under Sum
      • From: Nicolas Venuti <nicolas@virtualdynamics.fr>
  • Prev by Date: Re: D under Sum
  • Next by Date: Re: maximization with array of constraints
  • Previous by thread: Re: D under Sum
  • Next by thread: Re: D under Sum