Re: Re: New Analytical Functions - Mathematica Verified

*To*: mathgroup at smc.vnet.net*Subject*: [mg66967] Re: [mg66916] Re: New Analytical Functions - Mathematica Verified*From*: Daniel Lichtblau <danl at wolfram.com>*Date*: Mon, 5 Jun 2006 03:48:35 -0400 (EDT)*References*: <200605280104.VAA23436@smc.vnet.net> <200606011055.GAA20733@smc.vnet.net> <e5osg1$hvp$1@smc.vnet.net> <200606030726.DAA17310@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Mohamed Al-Dabbagh wrote: > Daniel Lichtblau wrote: > > >>They will change the behavior of its derivatives. Actually I think I did >>not want to use the DiracDelta component in that particular definition >>(or else to use further derivatives thereof in the definition for higher >>derivatives of FractionalPart). >>........................... >>........................... >>Did you try it? >> > > > Dan, > > Your usage of DiracDelta has made some remarkable correction for the > result, but on a very high cost of runtime! I have made some > experiments and wanted to publish them. You should remember that my > paper: > > http://dabbagh2.fortunecity.com/disc > > has proved that the derivative of the fractional part of any function > is the SAME as derivative of that function WITHOUT involving in the > calculation of fractional part! This is not exactly new. The function FractionalPart[f[x]] is differentiable wherever f[x] is differentiable except where it takes on integer (or, in the complex plane, Gaussian integer) values. At such points one might regard the derivative as undefined, or as a generalized function in terms of derivatives of delta functions, depending on the situation at hand. One often sees FractionalPart used for e.g. sawtooth waves, and in that setting a generalized function derivative is often appropriate. > When I used your improvement using Dirac Delta, a very substantial > improvement occurred on the numerical results. HOWEVER, this lead to > some very long delays. To the extent that calculating 5th derivative of > the FractionalPart(x^5) to 1000 places of decimal would take about ONE > HOUR!!!! Here are some results I arranged it in a page prepared for > you: > > http://dabbagh2.fortunecity.com/lichtblau/ > > You will see how my formulas are A LOT faster. > > > Mohamed Al-Dabbagh First let me correct my derivatives (or at least post what I think are the correct ones). Derivative[1][FractionalPart][x_] := 1 - DiracDelta[x] Derivative[n_Integer /; n>1][FractionalPart][x_] := (-1)^n*Derivative[DiracDelta[x]] Now we use your function f. In[3]:= f[x_] := x^5 In[4]:= gMath[x_] := FractionalPart[f[x]] In[5]:= InputForm[Timing[gMath''[12.2`400]]] Out[5]//InputForm= {0.003999999999999998*Second, 36316.95999999999999999999999999999999999999999\ 99999999999999999999999999999999999999999999999999999999999999999999999999999\ 99999999999999999999999999999999999999999999999999999999999999999999999999999\ 99999999999999999999999999999999999999999999999999999999999999999999999999999\ 99999999999999999999999999999999999999999999999999999999999999999999999999999\ 99999999999999999999999999999999999999999999999999999999999998868`399.5228787\ 4528037} So it takes a fraction of a second. Offhand I do not know why it appears to run so slow for you. Here is the result for the slightly more complicated example, both for evaluating second and fifth derivatives. In[8]:= f[x_] := x^5*Sin[x]^2 In[10]:= InputForm[Timing[gMath''[12.2`400]]] Out[10]//InputForm= {0.*Second, 258282.7295151941533077499484389228239911198853695416606571789553\ 97340348154747842920564555894547008803556440086166245643590282093764764200190\ 36636044752758309971369144877274629804969160115275382411797649612521530487913\ 14021423969924741654432978075641339718450969747617369938122882505861900120631\ 23291336171292192057571061244505228564074008530150250653359154263365233552077\ 75165520042239719014756718443621091152`398.1608559226428} In[11]:= InputForm[Timing[Derivative[5][gMath][12.2`400]]] Out[11]//InputForm= {0.064004*Second, -5.08650128579910493665046315290795289078198431826789276935\ 82833885062256473165463289248429898024173337160137072344086983520144149450609\ 25117527136634188560981519715993806959080731375558227844064929448344771904044\ 99542455152362012447722945323920015084363270028976459194249211406113484752274\ 39553483871787782701218811066558362577548299391921139619721479189052606484281\ 5379262528773061529913587801452056996643588005`398.3053093021263*^6} At the bottom of your note you say: "Now you understand how powerful my formulas are compared to the existing ones you use in Mathematica." While I am at a loss to understand why the computations are so slow when you run them, I think you are vastly overstating the case here. Differentiation in Mathematica by default does but little with discontinuous functions such as FractionalPart. But as seen above a user can readily add derivatives to suit ones needs, and evaluations involving those derivatives seem (to me) to be reasonably fast. Daniel Lichtblau Wolfram Research

**References**:**Re: New Analytical Functions - Mathematica Verified***From:*"Mohamed Al-Dabbagh" <mohamed_al_dabbagh@hotmail.com>

**Re: New Analytical Functions - Mathematica Verified***From:*"Mohamed Al-Dabbagh" <mohamed_al_dabbagh@hotmail.com>