Thanks for the responses alerting to the potential inaccuracies. I am now using D:2 with the increment tailored to my knowledge of the particular verb to which D:2 is applied. Seems to be successful. However I think there should be some "cautions" inserted into the description of D.2 etc.
On Thu, Apr 22, 2010 at 11:38 PM, John Randall < [email protected]> wrote: > Dan Bron wrote: > > Piet de Jong wrote: > >> What am I misunderstanding. > >> Why does D.2 not work as expected? > > > > D. has known precision issues. See, for example: > > > > http://www.jsoftware.com/pipermail/general/2006-July/027701.html > > Thanks to Dan for promoting me to expert. > > The derivatives appear to be calculated with a step size of 1e_7, and > higher derivatives appear to be calculated by differentiating lower > derivatives: > > a=:+/@:*: D.2 [ 1 1 > f=:+/@:*: > 1e_7 1e_7 f D: 2 [ 1 1 > 1.95399 _0.0444089 > _0.0444089 1.95399 > a > 1.95399 _0.0444089 > _0.0444089 1.95399 > > Precision problems occur even for functions of one variable. > > g=:1+*: > g D. 2 [ 1 > 1.95399 > h=:1e_7 > d=:1 : 'h %~ (u y+h)-u y' > g d d [ 1 > 1.95399 > > By using a better approximation formula for the second derivative, you can > use a larger step size (h): > > h=:1e_5 > d2=:1 : '(*: h) %~ (u y-h)+(_2*u y)+(u y+h)' > g d2 1 > 2 > > Best wishes, > > John > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > -- Piet de Jong -------------------------------------------------- View my current research at http://ssrn.com/author=619154 -------------------------------------------------- ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
