I am trying to take partial derivative of sum: $$Cv_m=\sum_{i=1}^{Ns}Cv_i \frac{\rho_i}{\rho_m},$$ where $Cv_i$ are constants. I want to take derivative $$\partial{Cv_m}/\partial\rho_i=Cv_i /\rho_m$$

D[Sum[Subscript[Cv, i]*Subscript[rhoY, i]/rhom, {i, 1, 
    Ns}], Subscript[rhoY, i]]

I expected $Cv_i/\rho_m$, but it gives me $\sum_{i=1}^{Ns}Cv_i/\rho_m$

How get rid of sum symbol?

  • $\begingroup$ Try avoiding subscripts for a start, see if it simplifies things at all. $\endgroup$ – MarcoB Jun 3 '18 at 17:46
  • $\begingroup$ I chose it because Wolfram "considers" that it is an argument and it gives me 0. For example: Dt[rhoY[i]/rhom] gives me $-\frac{\text{rhoY}(i) Dt[\text{rhom}]}{\text{rhom}^2}$ instead $\frac{Dt[\text{rhoY[i]}]}{rhom}-\frac{\text{rhoY}(i) Dt[\text{rhom}]}{\text{rhom}^2}$ $\endgroup$ – Евгений Львович Шараборин Jun 4 '18 at 6:44

Have a closer look, the output of the following contains a KroneckerDelta:

a = D[Sum[Cv[i]*ρ[i]/ρ[m], {i, 1, Ns}], ρ[j]]

$$\sum _{i=1}^{\text{Ns}} \frac{\text{Cv}(i) \delta _{i,j}}{\rho (m)}$$

so the result is correct.

You can get rid of the sum with

Assuming[j \[Element] Integers && 1 <= j <= Ns, Simplify[a]]

$$\frac{\text{Cv}(j)}{\rho (m)}$$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.