Differentiation help [closed]

I am new in Mathematica. I want to differentiate

f[x_, y_, z_] =
Sqrt[(x + y) (1 – x – y) (x + z) (1 – x – z)] [x/((x + y) (x + z)) – y/ ((x + y) (1 – x – z)) – z/ ((1 – x – y) (x + z)) + (1 – x – y – z)/ ((1 – x – y) (1 – x – z))]

with respect to x, y and z. so I wrote the command

D[f[x, y, z], x] and D[f[x, y, z], y] and D[f[x, y, z], z].

Can anyone please tell me is this correct?

Another thing is all the derivatives are giving same answer. Why? And what does pattern means in the answer ?

=================

=================

3 Answers
3

=================

Square brackets in Mma are used only to specify function arguments.Your function is equivalent to the following (by using FullSimplify[ ])

f[x_, y_, z_] := -((x (-1 + x + y) + (x + y) z)/
Sqrt[(-1 + x + y) (x + y) (-1 + x + z) (x + z)])

and then

{D[f[x, y, z], x] , D[f[x, y, z], y] , D[f[x, y, z], z]}

  

 

If in fact one wants the gradient: D[f[x, y, z], {{x, y, z}}]
– J. M.♦
Aug 31 ’15 at 6:50

  

 

@Guesswhoitis. I wasn’t really sure …
– Dr. belisarius
Aug 31 ’15 at 6:52

  

 

In any case Grad[f[x, y, z], {x, y, z}] does the same
– Dr. belisarius
Aug 31 ’15 at 6:53

Besides getting the syntax as discussed by belisarius, FullSimplify will be very helpful to you in this case.

f[x_, y_, z_] :=
Sqrt[(x + y) (1 – x – y) (x + z) (1 – x – z)] *
(x/((x + y) (x + z)) – y/((x + y) (1 – x – z)) – z/((1 – x – y) (x + z)) +
(1 – x – y – z)/((1 – x – y) (1 – x – z)))

D[f[x, y, z], x] // FullSimplify

((-1 + 2*x + y + z)*(y*z*(-2 + y + z) + x^2*(y + z) + x*(-1 + y + z)*(y + z))) /
(2*((-1 + x + y)*(x + y)*(-1 + x + z)*(x + z))^(3/2))

D[f[x, y, z], y] // FullSimplify

((-1 + x + z)*(x + z)*((-x)*(-1 + x + y) + (x + y)*z)) /
(2*((-1 + x + y)*(x + y)*(-1 + x + z)*(x + z))^(3/2))

D[f[x, y, z], z] // FullSimplify

((-1 + x + y)*(x + y)*(-x^2 + x*(1 + y – z) + y*z)) /
(2*((-1 + x + y)*(x + y)*(-1 + x + z)*(x + z))^(3/2))

Using the corrected function:

f[x_, y_, z_] :=
Sqrt[(x + y) (1 – x – y) (x + z) (1 – x – z)] (x/((x + y) (x + z)) –
y/((x + y) (1 – x – z)) –
z/((1 – x – y) (x + z)) + (1 – x – y –
z)/((1 – x – y) (1 – x – z)))

to illustrate some other ways illustrating other forms or functions:

od = FullSimplify[
Derivative[##][f][x, y, z] & @@@ {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}]
grad = FullSimplify[Grad[f[x, y, z], {x, y, z}]]
totder = Collect[Dt[f[x, y, z]], {Dt[x], Dt[y], Dt[z]}];
td = FullSimplify[Coefficient[totder, {Dt[x], Dt[y], Dt[z]}]]

all yield:

{((-1 + 2 x + y + z) (y z (-2 + y + z) + x^2 (y + z) +
x (-1 + y + z) (y + z)))/( 2 ((-1 + x + y) (x + y) (-1 + x + z) (x + z))^( 3/2)), ((-1 + x + z) (x + z) (-x (-1 + x + y) + (x + y)
z))/( 2 ((-1 + x + y) (x + y) (-1 + x + z) (x + z))^( 3/2)), ((-1 +
x + y) (x + y) (-x^2 + x (1 + y – z) + y z))/( 2 ((-1 + x + y) (x +
y) (-1 + x + z) (x + z))^(3/2))}

od is just another to use Derivative function.

grad uses Gradient of scalar function

Dt provides total derivative and the other machinations just get the partial derivatives