1
$\begingroup$

I simplify my real problem as follows:

I define a rule function as

Clear[rule]; 
rule[i_] := tt -> i;

the real rule function is not this simple.

I define a matrix function as

Clear[hh];
hh[x_, y_, i_] := {{tt, x}, {y, 1}}/. rule[i];

I want to define a function hhpar that will differentiate hh with respect to x, so I write

Clear[hhpar];
hhpar[x_, y_, i_] := D[hh[x, y, i], x];

This doesn't work and I know why. But I still can't figure out a way to write a proper hhpar. How would I do that?

$\endgroup$
  • 6
    $\begingroup$ Derivative[1, 0, 0][hh][x, y, i] is equivalent to D[hh[x, y, i], x], but now you don't have to write x explicitly, so it avoids the problem. $\endgroup$ – Szabolcs Jul 6 '14 at 2:33
  • $\begingroup$ @Szabolcs Wow! So quick! Thank you very much! This works, and I thought I known the reason, but it terms out that I actually didn't know the true reason is x at that time. $\endgroup$ – matheorem Jul 6 '14 at 3:11
2
$\begingroup$

For the sake of an answer:

Derivative[1, 0, 0][hh][x, y, i] is equivalent to D[hh[x, y, i], x], but now you don't have to write x explicitly, so it avoids the problem. – Szabolcs Jul 6 '14 at 2:33

$\endgroup$

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.