I'm attempting to differentiate an equation in the form

D[sqrt((2*(((a*b*c+Pi*d*e^2+Pi*f*g^2+h*i*j+Pi*k*l^2)/(a*b*c+Pi*d*e^2+Pi*f*g^2))-1)*m)/(n^2 - o^2)/p), a]

in order to do an error propagation analysis. So I need to differentiate it against a, against b, against c and so on.

All my values will be positive (they reflect physical dimensions of my design) and the value of n will always be greater than o.

Is there a way to define all my variables as real and positive before I differentiate? And to define n greater than o?

The best I've found is $Assumptions = _Symbol [Element] Reals but this only gets me part of the way.


2 Answers 2

assume = (And @@ 
     Thread[{a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p} > 0]) && n > o;

Note that when you state that a variable is positive then it is automatically also real. And for $Assumptions or Assuming to have an effect, you must use a function that takes the option Assumptions (e.g., Simplify).

Assuming[assume, Element[a, Reals] // Simplify]

(* True *)

expr = Assuming[assume, 
  D[Sqrt[(2*(((a*b*c + Pi*d*e^2 + Pi*f*g^2 + h*i*j + Pi*k*l^2)/(a*b*c + 
               Pi*d*e^2 + Pi*f*g^2)) - 1)*m)/(n^2 - o^2)/p], a] // Simplify]

enter image description here


This is making the assumption that a is Real and positive, and then it calculates the derivative. But the result is zero.

Assuming[ a \[Element] Reals && a > 0, 
 D[sqrt ((2*(((abc + Pide^2 + Pifg^2 + hij + Pikl^2)/(abc + Pide^2 + 
              Pifg^2)) - 1)*m)/(n^2 - o^2)/p), a]]

Hope it helps.

  • $\begingroup$ Thank you. I think your approach might work for me. I modified my equation to give the following....do you think this makes sense? Assuming[{a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p} \[Element] Reals && {a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p} > 0, D[((2*(((a*b*c + Pi*d*e^2 + Pi*f*g^2 + h*i*j + Pi*k*l^2)/(a*b*c + Pi*d*e^2 + Pi*f*g^2)) - 1)*m)/(n^2 - o^2)/p)^0.5, a]] $\endgroup$
    – DeltaJ
    Mar 16, 2018 at 12:07
  • $\begingroup$ Hi @DeltaJ I think it would do the trick. If not, then you can use the following. a [Element] Reals && a > 0 && b [Element] Reals && b > 0 and so on for the rest of the letters. Hope this helps. Cheers!!! $\endgroup$
    – kcr
    Mar 16, 2018 at 12:32
  • 1
    $\begingroup$ Appreciate it thank you ;-) $\endgroup$
    – DeltaJ
    Mar 16, 2018 at 13:33

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.