1

I want to create an UpValue that will cause a function that is zero for it's second derivative to have a value when the second derivative is integrated. The function is:

YrA3[x_, hh_] := Piecewise[{{x, 0 <= x && x <= hh}, {hh, hh < x && x <= 1}}];

I created this UpValue that I'm expecting the integration of the second derivative to use:

YrA3 /: D[YrA3[x_, hh_, ___], xx_] := 1/Lenh;    
SetOptions[D, NonConstants -> {YrA3}];

When I check the definitions they seem correct:

?YrA3
(* Out:
  D[YrA3[x_, hh_, ___], xx_] ^:= 1/Lenh
  YrA3[x_, hh_] := Piecewise[{{x, 0 <= x && x <= hh}, {hh, hh < x && x <= 1}}]
*)

But when I run the code it doesn't work:

YrA3[x, l/3]
Derivative[1, 0][YrA3][x, 1/3]
Derivative[2, 0][YrA3][x, 1/3]
Integrate[Derivative[2, 0][YrA3][x, 1/3], {x, 0, 1}]

(* the first line works *)
(* the second line acts as if the UpValue doesn't exist *)
(* the third line works (i.e. zero) *)
(* the fourth line acts as if the UPValue doesn't exist (i.e. zero) *)

The link I used to try and understand what I need to do is How to customize derivative behavior via upvalues?

I do not understand what the BlankNullSequence and NonConstants declaration are supposed to be doing but whatever it is it doesn't seem to work. Is there something else I might try? or even a hint at the best way to debug something like this would be helpful.

Dave
  • 43
  • 2

0 Answers0