Lagrangian Interpolator

Enter X,Y data pairs, with the X and Y values separated by spaces.
There must be at least two pairs of data points.



  Alts ON
Enter any general value of X
X   =  
The Interpolated Y Value corresponding to X is    
Y   =  

This program was intended to aid in interpolating within astronomical tables, however it can be used to interpolate within any continuous data table.

The data is entered or pasted in the text area above as a table or string of paired numeric (x, y) values at arbitrary intervals, separated by spaces.   Then, based on this given data, the program can interpolate the value of Y corresponding to any given general value of X within the range of the given data.

All the (X, Y) data pair values can be swapped at any time to exchange computational roles.

USAGE EXAMPLES:

EXAMPLE 1:
When the program is initialized, there are 4 numbers already in the input box.  These are default values to be used in this simple example, which shows how to use the LaGrangian interpolator as a temperature scale inter-converter.

The numbers represent two pairs of matching temperatures.  In this case, the numbers represent the known freezing and boiling points of water on the Fahrenheit and Celsius scales respectively, with the left X-column representing Fahrenheit temperatures and the right Y-column representing the corresponding Celsius temperature equivalents.

F    C

The input data in effect is telling the program that we know that the freezing point of water on the two scales is 32 degrees Fahrenheit and zero degrees Celsius respectively.  We also know that the boiling point of water on the two scales is 212 degrees Fahrenheit and 100 degrees Celsius respectively.

Based on the given data, all we have to do to now, to compute (interpolate) the Celsius equivalent of 98.6 degrees Fahrenheit, is enter an argument of X=98.6 and interpolate the corresponding Celsius temperature of Y=37 C.

Since a temperature scale conversion is a simple linear operation, we can extrapolate outside the given known data range for any temperature in general.

All we need is two pairs of corresponding known temperatures on any two scales.  It does not have to be any special points, just equivalent points on the corresponding scales, as the starting data.

To reverse the process, simply swap the XY data roles and the program becomes a Celsius to Fahrenheit converter instead.

Given any two pairs of corresponding temperatures in any two scales, we could use this program as a 2-way temperature scale interconversion program between those scales.


EXAMPLE 2:

The problem in this example is to interpolate the time that the Sun-Earth distance is 1.0 AU, based on a given ephemeris data table for October 5th, 2015.

The following table of dynamical times (HH=hours) vs. Sun-Earth distances (AU) was computed based on the NASA/JPL DE405 model.  The table shows that the Sun-Earth distance at 19h (TD) is 1.000027622 AU and at 22h, the distance is 0.999969092 AU.  By inspection, we can see that somewhere between 19h and 20h, the Sun-Earth distance crosses the 1.0 AU point.  We wish to find the dynamical time at which the distance = 1.0 AU.

HH    Distance AU

To use the LaGrangian interpolator to solve the problem, we begin by simply copying and pasting the numerical table as-is into the text input area of the LaGrangian interpolator program.

Once the data table is copied, we may then interpolate.  Given any general value in the left column (X), we can interpolate the corresponding value in the right column (Y).

The original data table is given as time vs. distance.  Given any time in hours, we can interpolate the distance.  However, in this case we need to solve the reverse problem.

Given the known distance, we want to compute the unknown time.  To do this we simply swap or exchange the (X,Y) data values.  This is done by clicking the [Swap XY Data] button.  All corresponding XY-data pairs should swap places with each other.  This produces the following table of distance vs. time.

Distance AU        HH

We have now exchanged the computational roles of the original (X,Y) data.  This can be done at any time.  Given any distance (X), we can now interpolate the corresponding time (Y) in hours.

Entering X = 1.0 as the distance, we interpolate Y = 19.3598271469671673 hours as the time when the Sun-Earth distance is 1.0 AU, on October 5th, 2015.

To break this down a bit more, check the [Alts ON] box and click [Interpolate Y for X] again.  This will display alternative contexts of Y.

From the alternative contexts of Y,
we can see that context 2 applies, so that
19.3598271469671673 hours
equates to 19h 21m 35.378s

So, on Monday, October 5th, 2015, the Sun-Earth distance will be 1.0 AU at 19:21:35 TD, according to the NASA/JPL DE405 solar system model.

However, to obtain the actual clock time (UT) of the event, we will have to apply the ΔT correction to the computed dynamical time.

Compute UT From TD and ΔT

We can only estimate the future ΔT value based on the current trend, since its precise value can only be determined by observation.  For the date October 5th, 2015, the estimated ΔT is +66 seconds.  This means that to find the UT of the event, we subtract 66 seconds (01m 06s) from the dynamical time (TD).

So, in this example, the computed UT of the event is

In this case, the difference between the dynamical time and actual UT of the event is only about a minute anyway.  Rounding it to simply 19:20 (07:20 PM) UT is sufficient.

NOTE: AU = Astronomical Unit
1.0 AU = 149597870.691 km (NASA/JPL-DE405) = 92955807.267 mi


©Jay Tanner - NeoProgrammics - 2010 - v1.85