# Taking derivative takes forever and the output with Root and pound sign

I'm taking derivative under assumptions on parameters and it is taking forever. Here is my code:

Assuming[0 < r < 1/2 && 0 < s && 0 < d < 1 && 0 < c < 1 && q > 1 && 2 d < s &&r s > d,
FullSimplify@Reduce[D[-((c (1 - 2 r + 2 q r) (d^4 - 2 d^2 r s^2 + 2 d^2 r^2 s^2))/(4 (-1 + r)^2 r^2 s^4)), r] == 0, r]]


I've been running it for last 24 hours and it is still running.

: So, following cvgmt's comment to this post, I used Simplify as follows:

Simplify[Reduce[D[-((c (1 - 2 r + 2 q r) (d^4 - 2 d^2 r s^2 + 2 d^2 r^2 s^2))/(4 (-1 + r)^2 r^2 s^4)), r] == 0, r], 0 < r < 1/2 && 0 < s && 0 < d < 1 && 0 < c < 1 && q > 1 && 2 d < s &&r s > d]


And the output looks weird as follows:

How do you interpret this result?

• Use Simplify. Commented Oct 3, 2023 at 14:26
• @cvgmt, thanks! Following your comment, I got some result which includes Root and pound sign, which I included in the edit of the post. Can you please help on how to interpret it?
– ppp
Commented Oct 3, 2023 at 14:37
• Read the documentation for Root Commented Oct 3, 2023 at 15:04
• For the #1, read about pure functions Root[f,k] gives the k-th root of the polynomial f. So for example Root[#1^2 - #1 - 1 &, 2] gives the golden ratio. If you want a radical expression expression instead of a Root, you can call ToRadicals on you root objects
– ydd
Commented Oct 3, 2023 at 15:06

Your problem effectively boils down to finding the roots of a polynomial, and for polynomials of order 4, Mathematica will not usually display them in terms of radicals (and for polynomials of order 5 or higher, no general solution in terms of radicals exists).

Instead, it uses Root objects, where Root[{poly, i}] gives you the $$i$$th root of $$poly$$.

However, $$poly$$ will be represented as a pure function, where the # character represents a "slot" which is filled in when the function is applied, and & tells Mathematica where the function ends. We can see this like so:

f = a*#^2 + b*# + c &;
f[x]
(* c + b x + a x^2 *)


If you plug this familiar polynomial into Root, Mathematica will evaluate it to radicals immediately:

Root[f, 1]
(* -(b/(2 a)) - 1/2 Sqrt[(b^2 - 4 a c)/a^2] *)


For a fourth order polynomial like the one you found, you need ToRadicals to get it expanded out. Trying it here is a good way to see why Mathematica doesn't do it that way by default:

ToRadicals[Root[-d^2 + (3 d^2 - d^2 q + s^2) #1 + (-3 d^2 + 3 d^2 q -
3 s^2) #1^2 + (4 s^2 - 2 q s^2) #1^3 + (-2 s^2 +
2 q s^2) #1^4 &, 1]]
(* an expression that is several pages long *)