Numerical Integration; Tanh-Sinh Quadrature v. 4.2

The latest version (4.2) of the numerical integration spreadsheet by Graeme Dennes is now available for download from Tanh_Sinh Quadrature.

For more details of the background see: Faster Integration with the Tanh-Sinh Method and subsequent posts on this subject.

In addition to the code and examples on the use of Tanh-Sinh quadrature and a number of other techniques, the download file contains examples and thoroughly documented code for a range of other spreadsheet and VBA functions, including:

  • Dynamic linking of graphs to function results, without writing the results to the spreadsheet
  • Evaluating functions entered as text on the spreadsheet
  • Timing of function execution time with a high precision timer
  • Accurate determination of processor constants, such as maximum an minimum floating point values.
  • VBA code for the complete range of standard trigonometry functions
  • Examples of incorporating the quadrature functions in other routines.

The revisions included in Ver. 4.2 are listed below.  In the next post in this series I will look in more detail at how these functions can be incorporated in other spreadsheets.

Version 4.2 Release Notes

  1. Following a private suggestion, all quadrature programs now provide the number of function evaluations as a more useful performance metric.
  2. The Romberg program runs in 30 percent of the time taken by the previous (V4.1) release, and accuracy averages only one digit less than Tanh-Sinh. The Romberg algorithm implemented herein by the author may be the fastest and most accurate to date.
  3. The function plotter is located on a separate worksheet for convenience.
  4. Finite interval test functions total 400, which may be the largest set of diverse test integrals available (with answers) at no cost.

Graeme Dennes

 

Posted in Excel, Maths, Newton, Numerical integration, UDFs, VBA | Tagged , , , , , , , , | 2 Comments

Solving polynomials – update

The polynomial spreadsheet (details here) provides functions to solve polynomial equations of any order; using an “exact” method for up to quartic, and an iterative procedure for higher orders.  The input for the functions requires the equation coefficients to be in a continuous column or row range.  This is convenient for many cases, but there are times when it is necessary to enter each coefficient separately.

I have now added a new function to the spreadsheet, which has the coefficients entered separately, and calls the appropriate solver function, depending on the number of coefficients.  The new function, including full open source code, may be downloaded from Polynomial.zip.The screenshot below shows an example of usage of the new function (included in the download file):

Polynomial1In this example three coefficients of a cubic equation are constant, but the fourth varies. The solution to the equation can be set up easily as follows:

  • Enter the values for coefficients a to c in any convenient range.
  • Enter the values for coefficient d in a column
  • In the cell adjacent to the top of the d column, enter the SolvePoly function:
    =solvepoly($B$12,$B$13,$B$14,C12).  Note the $ signs, making the first three addresses absolute (i.e. they will not change when the function is copied).
  • To display the three solutions and the number of real roots enter the function as an array function: select the function cell and the adjacent three cells; press F2; press ctrl-shift-enter.
  • These four cells may now be copied to the clipboard and pasted over as many rows as required.  Note that the first three coefficients always refer to the fixed range, but the d coefficient changes as it is copied down.
Posted in Arrays, Excel, Maths, UDFs, VBA | Tagged , , , , , | 1 Comment

Faster Biaxial Bending

The spreadsheet to calculate ultimate moment capacity of a reinforced or prestressed concrete section under combined axial load and biaxial bending, last presented here, has been updated to use the QuadBrent solver, rather than the Excel Goal Seek function, for better performance. The new solver function reduces the time to calculate the neutral axis angle from about 1 second down to 2 to 5 milliseconds, which is quite a respectable improvement in performance.

The new file can be downloaded from ULS Design Functions, including full open-source code.

The screenshot below shows the new FindNAAng function, which returns the calculated Neutral Axis angle for the specified combination of axial load and biaxial bending:

Biax-2-1

As in the previous version, the Neutral Axis angle may be entered manually on the input sheet, or updated automatically with the Adjust NA Angle button:
Biax-2-2

An output summary is given on the input sheet (as shown above) or detailed output data is provided on the Out sheet.  Alternatively interaction diagrams may be plotted for a range of neutral axis angles, as shown below:
Biax-2-3

See the previous post, or download, for more details.

Posted in Beam Bending, Concrete, Excel, Newton, UDFs, VBA | Tagged , , , , , , , , | 1 Comment

Alglib/Python spline functions update

The Excel Spline-Matrix spreadsheet has now been updated with several new spline interpolation functions.  See Alglib/Python linear and non-linear fitting functions for links to download and install the necessary Excel-Python and Alglib files.  Also required is Python version 2.7 or 2.6.

The spline functions included in the new version are:
xl_Spline3-01

Of which, the new ones are:

xl_PSpline: Parametric spline interpolation
xl_Spline3-02

The parametric spline function generates a smooth curve through a series of points, which need not be in order of increasing X.  Output may be specified to be periodic, in which case the curve is extended to the starting point, with slopes adjusted to provide a smooth curve throughout:
xl_Spline3-03

xl_Ratinterp provides rational interpolation without poles.  See the Alglib User Guide for background information.
xl_Spline3-04

xl_RatInterp output compared with a cubic spline
xl_Spline3-05

xl_Spline3D provides 3D Cubic spline interpolation.  The screenshot below shows a very simple example, taken from the Alglib manual.
xl_Spline3-06

xl_RBF and xl_RBFGrid provide Radial Basis Function interpolation.  Again see the Alglib User Guide for background information.
xl_Spline3-07

In this example the xl_RBF function is used to interpolate concrete shrinkage data, as used in the xl_NonLinFit example:
xl_Spline3-08

The xl_RBFGrid function provides the same results, but with more convenient data input, when 2D data is arranged in grid format.
xl_Spline3-09

Posted in AlgLib, Arrays, Excel, Link to Python, Maths, Newton, UDFs, VBA | Tagged , , , , , , , , , , | 2 Comments

The Deserter

The Deserter is a traditional song featured on Fairport Convention’s 1968 album Liege and Lief; it is said to be the favourite track on the album of Sandy Denny, and the producer, Joe Boyd.  The song has a long history, and many versions.  Dave Swarbrick commented:

Although we learned this song from a faded Victorian broadside, it is much older in origin. It was the habit of broadside printers to bring older songs up to date—in this case by including the name of Prince Albert.

A detailed list of performances can be found at Mainly Norfolk.  It seems from some of the comments that some performers totally missed the irony in the closing verse.

Searching on “Ratcliff Highway” led me to this beautiful instrumental version:

and a live recording of a totally different traditional song, by The Dubliners:

Posted in Bach | Tagged , , , , | Leave a comment