Abs derivative (was Re: ? ? ? ! ?)
- To: mathgroup at smc.vnet.net
- Subject: [mg8310] Abs derivative (was Re: [mg8223] ? ? ? ! ?)
- From: Olivier Gerard <jacquesg at pratique.fr>
- Date: Sun, 24 Aug 1997 13:24:27 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Original message > Can anyone explain what v3.0 of Mathematica thinks it's doing when it > executes > > Plot[Abs'[x], {x, -3/10, 3/10}] > > ??? > > Note the prime: The first argument of Plot was Abs'[x], not Abs[x]. > > The strange behavior I see appears both on a PowerMac 7200/120 running > Mac OS 7.5.3 and on a Wintel box running Windoze 95, so I presume that > it isn't platform dependent--or at least, not fully so. > > --Lou Talman It seems that, having no special rules to differentiate Abs (a process which usually gives Sign[x] with a problem at 0) it is using a standard numerical interpolation of the derivative. The graphics shows that it uses the same sample points for this interpolation regardless of the number of PlotPoints you ask for: they are 0.05 apart so the interval you have chosen shows well the relaxation of the approximation. But if you ask for say > Plot[Abs'[3 x], {x, -3/10, 3/10}] it uses points 3 times closer. Well, Lou that's funny and a bit sad. An entry like this could have been foreseen in the Abs code. This is easy to fix it by adding new rules to Abs. Doing it Quick and Dirty: Unprotect[Abs]; Derivative[1][Abs] ^:= Sign ; Protect[Abs]; After that, the plots are correct. This solution assume a convention: Abs'[0]=0 which is sensible in some cases but not always as formally the function has not one derivative but two limits. In fact this solution also causes Limit[ Abs'[x], x->0] to give interesting numerical answers. Prior to this modification, Limit[ Abs'[x], x->0] gives Abs'[0] with Analytic->True and nothing with default Analytic->False. After this modification Limit[ Abs'[x], x->0] gives 0 with Analytic->True and 1 or -1 with default Analytic->False depending on the Direction Option. Olivier Gerard