0
$\begingroup$

I have the following function:

f:=x^3+yz+z^2x;

I need to compute the first derivative in x, y , and z in the 6 following points:

  %/.{x->1,y->3,z->0}                            
  %/.{x->0,y->1,z->2}                            
  %/.{x->0,y->0,z->6}                           
  %/.{x->7,y->6,z->8}                            
  %/.{x->7,y->7,z->9}                              
  %/.{x->6,y->9,z->3} 
$\endgroup$
  • $\begingroup$ In your function definition you need a space in order to indicate multiplication. "yz" is a symbol. You should have typed "y z" or "y*z". $\endgroup$ – Jack LaVigne Oct 5 '15 at 14:30
5
$\begingroup$

I believe this is a duplicate. I just note that Grad can provide all the partial derivatives in one step. I just post this not to encourage all multiple rule lists but to limit typing:

rep = {{x -> 1, y -> 3, z -> 0},
   {x -> 0, y -> 1, z -> 2},
   {x -> 0, y -> 0, z -> 6},
   {x -> 7, y -> 6, z -> 8},
   {x -> 7, y -> 7, z -> 9},
   {x -> 6, y -> 9, z -> 3}};
f := x^3 + y z + z^2 x;

So,

TableForm[(Grad[f, {x, y, z}] /. #) & /@ rep, 
 TableHeadings -> {#[[All, 2]] & /@ 
    rep, {"\!\(\*SubscriptBox[\(f\), \(x\)]\)", 
    "\!\(\*SubscriptBox[\(f\), \(y\)]\)", 
    "\!\(\*SubscriptBox[\(f\), \(z\)]\)"}}]

enter image description here

$\endgroup$
5
$\begingroup$

another way:

f = x^3 + y z + z^2 x;
grad[x_, y_, z_] = Grad[f, {x, y, z}];
mat = {{1, 3, 0}, {0, 1, 2}, {0, 0, 6}, {7, 6, 8}, {7, 7, 9}, {6, 9,3}};
grad[##] & @@@ mat
{{3, 0, 3}, {4, 2, 1}, {36, 6, 0}, {211, 8, 118}, {228, 9, 133}, {117,3, 45}}
$\endgroup$
4
$\begingroup$

You could try using

f[x_, y_, z_] := x^3 + y*z + z^2*x

Derivative[1, 0, 0][f][x, y, z]

%/.{x->1,y->3,z->0}   

Derivative[0, 1, 0][f][x, y, z]

Derivative[0, 0, 1][f][x, y, z]
$\endgroup$
  • 1
    $\begingroup$ This is the way to go. In fact, the replacement is not even necessary. Just do: Derivative[1, 0, 0][f][1,3,0], etc... $\endgroup$ – QuantumDot Oct 5 '15 at 11:41

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.