-1

Maybe this is very basic, but I'm not getting it. I've googled around and searched here for an answer but I can't find it. I need to set D[h[r], r] equal to zero, so that when this is evaluated it shows that it's zero. I've tried doing:

Block[D[h[r], r], 0]

or even just

D[h[r], r] = 0

but this returns "tag is protected". Thank you for your help

Ian
  • 1,285
  • 10
  • 17
ful1meta1
  • 1
  • 2

1 Answers1

3

You can specify upvalues for any symbol. Try defining one on h as follows:

h /: D[h[r_], r_] := 0
UpValues[h]

As a result

D[h[x], x]==0
(* True *)
Ian
  • 1,285
  • 10
  • 17
  • I tried this, but instead I used: $$h_{rr}[r,\theta,\phi]$$ for h instead. I got the error "Argument at position 1 is expected to be a symbol. >>" h is some function which will need to approximated later on in the code. One way I can make the entire output an approximation is by cutting off this derivative – ful1meta1 Jul 20 '15 at 01:43
  • 1
    No one can help with your error unless you give us the actual Mathematica expression that produced it. – Ian Jul 20 '15 at 01:45
  • Okay. I tried it this way: h11 /: D[h11, r] := 0 UpValues[h11] This returns TagSetDelayed::tagnf: Tag h11 not found>> – ful1meta1 Jul 20 '15 at 01:55
  • 2
    I'm a bit stumped, because h11 /: D[h11, r] := 0 doesn't give me an error. It's also not going to solve your problem though, because without underscores it will only match the literal expression D[h11,r]. You can add additional arguments to the answer I gave like this: h /: D[h[r_, t_, p_], r_]:=0 – Ian Jul 20 '15 at 03:11