I have a list of rules to the values of the derivatives of a generic (real valued, 3 variables) function, for example: df/dxdydz(0,0,0)-> 0.7. I would like to be able to generically reference this derivatives as in: give me the value for the function differentiated twice at the first argument, once at the second argument and none at the third argument. How can I do this? Ideally, I would be able to just assign the value given by the rules to the derivatives itself, but I cant seem to work around on that. Thanks.
$\begingroup$
$\endgroup$
2
-
1$\begingroup$ Could you give an example list of rules as a Mathematica code? $\endgroup$– ybeltukovCommented Jan 17, 2015 at 18:16
-
$\begingroup$ {(g^(0,0,1))[-1.79324,0,0]->0.,(g^(0,1,0))[-1.79324,0,0]->0.841743,(h^(0,0,1))[-1.79324,0,0]->0.,(h^(0,1,0))[-1.79324,0,0]->1.39703,(h^(1,0,0))[-1.79324,0,0]->0.419109,(g^(1,0,0))[-1.79324,0,0]->0.252523,(g^(0,0,2))[-1.79324,0,0]->-0.192144,(h^(0,0,2))[-1.79324,0,0]->0.482044,(g^(0,1,1))[-1.79324,0,0]->0.,(h^(0,1,1))[-1.79324,0,0]->0.,(g^(0,2,0))[-1.79324,0,0]->-0.0568662,(h^(0,2,0))[-1.79324,0,0]->-0.077802,(g^(1,0,1))[-1.79324,0,0]->0.,(h^(1,0,1))[-1.79324,0,0]->0.,(g^(1,1,0))[-1.79324,0,0]->-0.0170599,(h^(1,1,0))[-1.79324,0,0]->-0.0233406 $\endgroup$– user191919Commented Jan 17, 2015 at 19:29
Add a comment
|
1 Answer
$\begingroup$
$\endgroup$
2
If all you want is to define the derivatives at certain points, then you can simply do it as follows:
Derivative[0, 0, 1][g][-1.79324, 0, 0] = 0
(* ==> 0 *)
Derivative[0, 1, 0][g][-1.79324, 0, 0] = 0.841743
(* ==> 0.841743 *)
Here I'm testing the assignments in a different notation:
D[g[x, y, z], z] /. Thread[{x, y, z} -> {-1.79324, 0, 0}]
(* ==> 0 *)
D[g[x, y, z], y] /. Thread[{x, y, z} -> {-1.79324, 0, 0}]
(* ==> 0.841743 *)
-
$\begingroup$ Hi thanks for the answer. What if I had such a list of generic derivative, but would all of them to be evaluated at a particular point. For example: {D[f[x,y],x],D[f[x,y],y]}, but I would like: {D[f[x,y],x][0,0],D[f[x,y],y][0,0]}. Is there anyway I can append the [0,0] to every element of the initial list? $\endgroup$ Commented Jan 29, 2015 at 16:16
-
$\begingroup$ Yes, e.g. like this:
{D[f[x, y], x], D[f[x, y], y]} /. Thread[{x, y} -> {0, 0}]
. Or alsoThrough[Through[{Derivative[1,0],Derivative[0,1]}[f]][x,y]]
. $\endgroup$– JensCommented Jan 29, 2015 at 17:36