Derivative of cumulative sum function












1












$begingroup$


A cumulative sum is a sequence of partial sums:



Applying a cumulative sum to ${a, b, c, d}$ gives ${a, a+b, a+b+c, a+b+c+d}$.



A more formal notation, the cumulative sum function takes an $N$-dimensional vector and produces another $N$-dimensional vector:



$C(a) : begin{bmatrix}a_1 \ vdots \a_Nend{bmatrix} xrightarrow{} begin{bmatrix}C_1 \vdots\C_Nend{bmatrix}$



For example:



$begin{bmatrix}1\2\4\5end{bmatrix} xrightarrow{} begin{bmatrix}1 \3\7\12\end{bmatrix}$



The per-element formula is:



$C_N = sum_{j=1}^N a_j$



Calculating the partial derivatives with respect to $a_i$ when $i = j$ and $i ne j$:



$i = j$:



$frac{partial( sum_{j=1}^N a_j)}{partial a_i} = sum_{j=1}^N 1$



and $i ne j$:



$frac{partial( sum_{j=1}^N a_j)}{partial a_i} = sum_{j=1}^N 0$



Does this look correct?










share|cite|improve this question











$endgroup$








  • 1




    $begingroup$
    Welcome the Mathematics Stack Exchange community! Great question! A quick tour of the site will help you get the most of your time here.
    $endgroup$
    – dantopa
    Jan 11 at 6:08
















1












$begingroup$


A cumulative sum is a sequence of partial sums:



Applying a cumulative sum to ${a, b, c, d}$ gives ${a, a+b, a+b+c, a+b+c+d}$.



A more formal notation, the cumulative sum function takes an $N$-dimensional vector and produces another $N$-dimensional vector:



$C(a) : begin{bmatrix}a_1 \ vdots \a_Nend{bmatrix} xrightarrow{} begin{bmatrix}C_1 \vdots\C_Nend{bmatrix}$



For example:



$begin{bmatrix}1\2\4\5end{bmatrix} xrightarrow{} begin{bmatrix}1 \3\7\12\end{bmatrix}$



The per-element formula is:



$C_N = sum_{j=1}^N a_j$



Calculating the partial derivatives with respect to $a_i$ when $i = j$ and $i ne j$:



$i = j$:



$frac{partial( sum_{j=1}^N a_j)}{partial a_i} = sum_{j=1}^N 1$



and $i ne j$:



$frac{partial( sum_{j=1}^N a_j)}{partial a_i} = sum_{j=1}^N 0$



Does this look correct?










share|cite|improve this question











$endgroup$








  • 1




    $begingroup$
    Welcome the Mathematics Stack Exchange community! Great question! A quick tour of the site will help you get the most of your time here.
    $endgroup$
    – dantopa
    Jan 11 at 6:08














1












1








1





$begingroup$


A cumulative sum is a sequence of partial sums:



Applying a cumulative sum to ${a, b, c, d}$ gives ${a, a+b, a+b+c, a+b+c+d}$.



A more formal notation, the cumulative sum function takes an $N$-dimensional vector and produces another $N$-dimensional vector:



$C(a) : begin{bmatrix}a_1 \ vdots \a_Nend{bmatrix} xrightarrow{} begin{bmatrix}C_1 \vdots\C_Nend{bmatrix}$



For example:



$begin{bmatrix}1\2\4\5end{bmatrix} xrightarrow{} begin{bmatrix}1 \3\7\12\end{bmatrix}$



The per-element formula is:



$C_N = sum_{j=1}^N a_j$



Calculating the partial derivatives with respect to $a_i$ when $i = j$ and $i ne j$:



$i = j$:



$frac{partial( sum_{j=1}^N a_j)}{partial a_i} = sum_{j=1}^N 1$



and $i ne j$:



$frac{partial( sum_{j=1}^N a_j)}{partial a_i} = sum_{j=1}^N 0$



Does this look correct?










share|cite|improve this question











$endgroup$




A cumulative sum is a sequence of partial sums:



Applying a cumulative sum to ${a, b, c, d}$ gives ${a, a+b, a+b+c, a+b+c+d}$.



A more formal notation, the cumulative sum function takes an $N$-dimensional vector and produces another $N$-dimensional vector:



$C(a) : begin{bmatrix}a_1 \ vdots \a_Nend{bmatrix} xrightarrow{} begin{bmatrix}C_1 \vdots\C_Nend{bmatrix}$



For example:



$begin{bmatrix}1\2\4\5end{bmatrix} xrightarrow{} begin{bmatrix}1 \3\7\12\end{bmatrix}$



The per-element formula is:



$C_N = sum_{j=1}^N a_j$



Calculating the partial derivatives with respect to $a_i$ when $i = j$ and $i ne j$:



$i = j$:



$frac{partial( sum_{j=1}^N a_j)}{partial a_i} = sum_{j=1}^N 1$



and $i ne j$:



$frac{partial( sum_{j=1}^N a_j)}{partial a_i} = sum_{j=1}^N 0$



Does this look correct?







calculus differential






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Jan 11 at 6:11









Lee

330111




330111










asked Jan 11 at 6:04









user3564870user3564870

61




61








  • 1




    $begingroup$
    Welcome the Mathematics Stack Exchange community! Great question! A quick tour of the site will help you get the most of your time here.
    $endgroup$
    – dantopa
    Jan 11 at 6:08














  • 1




    $begingroup$
    Welcome the Mathematics Stack Exchange community! Great question! A quick tour of the site will help you get the most of your time here.
    $endgroup$
    – dantopa
    Jan 11 at 6:08








1




1




$begingroup$
Welcome the Mathematics Stack Exchange community! Great question! A quick tour of the site will help you get the most of your time here.
$endgroup$
– dantopa
Jan 11 at 6:08




$begingroup$
Welcome the Mathematics Stack Exchange community! Great question! A quick tour of the site will help you get the most of your time here.
$endgroup$
– dantopa
Jan 11 at 6:08










1 Answer
1






active

oldest

votes


















0












$begingroup$

$frac{partial C_N}{partial a_i}=frac{partial C_N}{partial a_j}=1$ if $C_N=a_1+cdots+a_N$ and $i,jin{1,2,cdots N}$ for both $i=j$ and $ineq j$.



$frac{partial C_N}{partial a_i}=0$ if $inotin{1,2,cdots,N}$






share|cite|improve this answer









$endgroup$













  • $begingroup$
    Thanks Lee. I'm not so sure of it being 1 in all cases. Say $g_i$ = $a_j$, then the derivative of $g_i$ with respect to $a_j$ is 1 only if i = j, because that's the only time $g_i$ has $a_j$ in it. By the way, I'm modeling this after a similar derivation of the softmax function found at: eli.thegreenplace.net/2016/…
    $endgroup$
    – user3564870
    Jan 11 at 15:58











Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3069517%2fderivative-of-cumulative-sum-function%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0












$begingroup$

$frac{partial C_N}{partial a_i}=frac{partial C_N}{partial a_j}=1$ if $C_N=a_1+cdots+a_N$ and $i,jin{1,2,cdots N}$ for both $i=j$ and $ineq j$.



$frac{partial C_N}{partial a_i}=0$ if $inotin{1,2,cdots,N}$






share|cite|improve this answer









$endgroup$













  • $begingroup$
    Thanks Lee. I'm not so sure of it being 1 in all cases. Say $g_i$ = $a_j$, then the derivative of $g_i$ with respect to $a_j$ is 1 only if i = j, because that's the only time $g_i$ has $a_j$ in it. By the way, I'm modeling this after a similar derivation of the softmax function found at: eli.thegreenplace.net/2016/…
    $endgroup$
    – user3564870
    Jan 11 at 15:58
















0












$begingroup$

$frac{partial C_N}{partial a_i}=frac{partial C_N}{partial a_j}=1$ if $C_N=a_1+cdots+a_N$ and $i,jin{1,2,cdots N}$ for both $i=j$ and $ineq j$.



$frac{partial C_N}{partial a_i}=0$ if $inotin{1,2,cdots,N}$






share|cite|improve this answer









$endgroup$













  • $begingroup$
    Thanks Lee. I'm not so sure of it being 1 in all cases. Say $g_i$ = $a_j$, then the derivative of $g_i$ with respect to $a_j$ is 1 only if i = j, because that's the only time $g_i$ has $a_j$ in it. By the way, I'm modeling this after a similar derivation of the softmax function found at: eli.thegreenplace.net/2016/…
    $endgroup$
    – user3564870
    Jan 11 at 15:58














0












0








0





$begingroup$

$frac{partial C_N}{partial a_i}=frac{partial C_N}{partial a_j}=1$ if $C_N=a_1+cdots+a_N$ and $i,jin{1,2,cdots N}$ for both $i=j$ and $ineq j$.



$frac{partial C_N}{partial a_i}=0$ if $inotin{1,2,cdots,N}$






share|cite|improve this answer









$endgroup$



$frac{partial C_N}{partial a_i}=frac{partial C_N}{partial a_j}=1$ if $C_N=a_1+cdots+a_N$ and $i,jin{1,2,cdots N}$ for both $i=j$ and $ineq j$.



$frac{partial C_N}{partial a_i}=0$ if $inotin{1,2,cdots,N}$







share|cite|improve this answer












share|cite|improve this answer



share|cite|improve this answer










answered Jan 11 at 6:21









LeeLee

330111




330111












  • $begingroup$
    Thanks Lee. I'm not so sure of it being 1 in all cases. Say $g_i$ = $a_j$, then the derivative of $g_i$ with respect to $a_j$ is 1 only if i = j, because that's the only time $g_i$ has $a_j$ in it. By the way, I'm modeling this after a similar derivation of the softmax function found at: eli.thegreenplace.net/2016/…
    $endgroup$
    – user3564870
    Jan 11 at 15:58


















  • $begingroup$
    Thanks Lee. I'm not so sure of it being 1 in all cases. Say $g_i$ = $a_j$, then the derivative of $g_i$ with respect to $a_j$ is 1 only if i = j, because that's the only time $g_i$ has $a_j$ in it. By the way, I'm modeling this after a similar derivation of the softmax function found at: eli.thegreenplace.net/2016/…
    $endgroup$
    – user3564870
    Jan 11 at 15:58
















$begingroup$
Thanks Lee. I'm not so sure of it being 1 in all cases. Say $g_i$ = $a_j$, then the derivative of $g_i$ with respect to $a_j$ is 1 only if i = j, because that's the only time $g_i$ has $a_j$ in it. By the way, I'm modeling this after a similar derivation of the softmax function found at: eli.thegreenplace.net/2016/…
$endgroup$
– user3564870
Jan 11 at 15:58




$begingroup$
Thanks Lee. I'm not so sure of it being 1 in all cases. Say $g_i$ = $a_j$, then the derivative of $g_i$ with respect to $a_j$ is 1 only if i = j, because that's the only time $g_i$ has $a_j$ in it. By the way, I'm modeling this after a similar derivation of the softmax function found at: eli.thegreenplace.net/2016/…
$endgroup$
– user3564870
Jan 11 at 15:58


















draft saved

draft discarded




















































Thanks for contributing an answer to Mathematics Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3069517%2fderivative-of-cumulative-sum-function%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Mario Kart Wii

The Binding of Isaac: Rebirth/Afterbirth

What does “Dominus providebit” mean?