Rank: 4 based on 3023 downloads (last 30 days) and 51 files submitted
photo

John D'Errico

E-mail
Company/University
Retired

Personal Profile:

Mainly retired from Eastman Kodak. (Of course, Kodak itself is now semi-retired. I don't think I had any influence in that.) I still write MATLAB code as I find something interesting, but I DON'T answer your questions, and I do NOT do homework. Your homework is YOUR problem, not mine. Do NOT e-mail me with your homework problems or student projects. When I'm not doing something with MATLAB, you might find me playing bridge.

Professional Interests:
Bridge, MATLAB, numerical analysis, mathematical modeling

 

Watch this Author's files

 

Files Posted by John View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
07 May 2012 HPF - a big decimal class (currently in beta release) High precision floating point arithmetic, a new class written in MATLAB Author: John D'Errico hpf, multiple precision, big decimal, floating point, arithmetic, mathematics 45 3
  • 5.0
5.0 | 4 ratings
04 May 2012 The Fibonacci Sequence Efficient computation of Fibonacci and Lucas numbers Author: John D'Errico fibonacci, lucas, numbers, integers, sequence, recursion 49 0
03 May 2012 Screenshot FresnelS and FresnelC Efficient and accurate computation of the Fresnel sine and cosine integrals Author: John D'Errico fresnel, sine, cosine, sin, cos, integrals 47 2
  • 5.0
5.0 | 1 rating
04 Mar 2012 Screenshot interparc Distance based interpolation along a general curve in space Author: John D'Errico interpolation, spline, linear, cubic, parametric, arc length 33 0
22 Feb 2012 Screenshot SLM - Shape Language Modeling Least squares spline modeling using shape primitives Author: John D'Errico spline, splines, cubic, hermite, breaks, knots 172 51
  • 5.0
5.0 | 26 ratings
Comments and Ratings by John View all
Updated File Comments Rating
19 May 2012 Animated gif generator from images This script is a GUI to easily generate an animated gif from images. Time between images can be set. Author: Héctor Corte

The point of Matthew's comment is not that MATLAB is required, but that you have failed to tell anyone that there is at least one toolbox required, one that not everyone may have. Have you used any functions in this code that are in some toolbox? (Yes.) The important question is, do you really need that tool you used? It prevents many people from using this utility.

As for globals being used in this code, they are a bit of a crutch here. So why not learn to write better code?

17 May 2012 Integer partition generator Generates a table of all integer partitions up to a value N. Author: David Holdaway

There is yet another partitions generator on the FEX.

http://www.mathworks.com/matlabcentral/fileexchange/12009-partitions-of-an-integer

11 May 2012 HPF - a big decimal class (currently in beta release) High precision floating point arithmetic, a new class written in MATLAB Author: John D'Errico

Hi Michael,

This is not really intended as a replacement for VPI, as the VPI tool concentrates entirely on large integers. In HPF you will see I've not given you tools to factor integers, or to test for primality, modular inverses, modular roots, or a powermod function.

Here I've concentrated on numerical methods, so I've provided computations for trig functions, exponentials, logs, erf, etc. HPF might be used to get around the dynamic range limitation of a double, or for someone who desperately wants to work in a given number of digits. It would seem to be a good tool for a student to learn about numerical precision problems. As well, I've found HPF to be quite useful in showing what MATLAB stores when we represent a number as an IEEE 754 double. (My own version of a tool like num2strexact that need not be compiled.) And it is a nice tool to test an algorithm to determine if a problem is due to a lack of numerical precision. I've even heard of a version of chol that will run with HPF numbers.

In general, I'd expect that most users of HPF will work with numbers in the range of 30 to perhaps 50 or so digits at most, except for those individuals who love to play in the huge digit sandbox.

As far as VPI goes, I plan on offering a new version to give a speed bump. (When I do, I'd like to play with some quadratic sieve factoring schemes to update factor.) I'd been debating in my own mind if I should leave the old VPI up there or not, for those users who have older releases of MATLAB.

By the way, that speed bump for VPI can come from one of two sources. For example, I could re-write VPI as a wrapper class for an existing Big Integer tool. I looked at such a question when I wrote HPF. (In fact, I wrote HPF in three separate versions, choosing the migit version as it ran the fastest.) Alternatively, I could in theory write the new VPI version to use migits, much like HPF uses now. The problem with migits is, they work well for numbers where the length of the mantissa does not change.

The issue is there are limits on the size of a number that can be operated on with migits, and integer arithmetic can cause integers to grow arbitrarily large. As such I would be forced to limit the size of the migits to be rather small. Thus with 3-migits, one can generate integers up to a few hundred millions of decimal digits. That would surely be adequate for the conceivable future, but perhaps one day it might be a limitation. (Somebody always wants to push the limits of any computational tool.)

Finally, a migital version of VPI would be simpler (and more efficient) to write than my HPF implementation, since it would not be forced to work in a fixed umber of digits. And there is no need for guard digits when you work with pure integers. (Is migital a word? I guess it is now.)

I'd be willing to take any advice people have to offer on these matters. Vote now.

John

11 May 2012 fminsearchbnd, fminsearchcon Bound constrained optimization using fminsearch Author: John D'Errico

I should point out that these tools use fminsearch as the optimizer, just providing an overlay on top to implement constraints. That means that any parameters that fminsearch ignores are ignored here too. So diffminchange and diffmaxchange are completely irrelevant.

I can't really test out what is happening since I don't have any data. But I looked at the code, and usually when you get a nan as a result, it comes from some parameter going into a bad place.

So I'd put some debugging effort into the code, letting you drop in with the debugger as soon as a nan gets generated. Do one of these before you execute the code:

dbstop if naninf

I'm a bit confused why you are calling det on a diagonal matrix too. That would be far more efficiently done as simply the product of the elements. And since you are then computing the log of the determinant, do it as the sum of the logs of the elements, avoiding potential underflows or overflows.

Anyway, before you do any optimizations, always test your objective function. Make sure that it does what you expect, that it yields valid results, and that the results change when you perturb the parameters. Next, when you run an optimizer and you see strange things happening, set the "Display" option in the optimizer to 'iter'. In fact, I always do this on every optimization the first time I run one for any problem. Verify that it is doing something intelligent. Are the parameters changing? (Note that fminsearchbnd transforms the parameters, so that fminsearch is working with different numbers than you expect.)

And, finally, 9 parameters is at the very upper limit of what I'd ever recommend for a Nelder-Mead based tool, but it should run, albeit a bit slowly.

02 May 2012 FresnelS and FresnelC Efficient and accurate computation of the Fresnel sine and cosine integrals Author: John D'Errico

New version submitted - thanks to Felipe.

Comments and Ratings on John's Files View all
Updated File Comment by Comments Rating
18 May 2012 Surface Fitting using gridfit Model 2-d surfaces from scattered data Author: John D'Errico Josh

John,

Thanks a lot. Not only did I enjoy an excellent bit of code, but also for your variety of stimulating and entertaining responses. Thank you for breaking up my day with at least 5 minutes of enjoyable rhetoric and exceptional references (Mark Twain / god and little green apples) ... brilliant! Have a few extra stars.

Josh

17 May 2012 Surface Fitting using gridfit Model 2-d surfaces from scattered data Author: John D'Errico E, K

Lovely, thanks

15 May 2012 HPF - a big decimal class (currently in beta release) High precision floating point arithmetic, a new class written in MATLAB Author: John D'Errico Jeff
12 May 2012 HPF - a big decimal class (currently in beta release) High precision floating point arithmetic, a new class written in MATLAB Author: John D'Errico Wilson, David
12 May 2012 Adaptive Robust Numerical Differentiation Numerical derivative of an analytically supplied function, also gradient, Jacobian & Hessian Author: John D'Errico Hasan, Md. Ikramul
Top Tags Applied by John
interpolation, curve, distance, modeling, regression
Files Tagged by John View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
07 May 2012 HPF - a big decimal class (currently in beta release) High precision floating point arithmetic, a new class written in MATLAB Author: John D'Errico hpf, multiple precision, big decimal, floating point, arithmetic, mathematics 45 3
  • 5.0
5.0 | 4 ratings
04 May 2012 The Fibonacci Sequence Efficient computation of Fibonacci and Lucas numbers Author: John D'Errico fibonacci, lucas, numbers, integers, sequence, recursion 49 0
03 May 2012 Screenshot FresnelS and FresnelC Efficient and accurate computation of the Fresnel sine and cosine integrals Author: John D'Errico fresnel, sine, cosine, sin, cos, integrals 47 2
  • 5.0
5.0 | 1 rating
04 Mar 2012 Screenshot interparc Distance based interpolation along a general curve in space Author: John D'Errico interpolation, spline, linear, cubic, parametric, arc length 33 0
22 Feb 2012 Screenshot SLM - Shape Language Modeling Least squares spline modeling using shape primitives Author: John D'Errico spline, splines, cubic, hermite, breaks, knots 172 51
  • 5.0
5.0 | 26 ratings

Contact us at files@mathworks.com