[Scipy-tickets] [SciPy] #1666: LinearNDInterpolator fails when dimensions differ by many orders of magnitude

SciPy Trac scipy-tickets@scipy....
Fri Jun 1 23:39:30 CDT 2012


#1666: LinearNDInterpolator fails when dimensions differ by many orders of
magnitude
-----------------------------------------+----------------------------------
 Reporter:  bloop369                     |       Owner:  somebody   
     Type:  defect                       |      Status:  new        
 Priority:  normal                       |   Milestone:  Unscheduled
Component:  scipy.interpolate            |     Version:  0.10.0     
 Keywords:  LinearNDInterpolator, QHull  |  
-----------------------------------------+----------------------------------
 If I am calculating a function of two arguments, say f(t,x),
 LinearNDInterpolator fails when t and x differ by many orders of magnitude
 (like 15). Sometimes I get a QHull warning like:

 qhull precision warning:
 The initial hull is narrow (cosine of min. angle is 1.0000000000000000). A
 coplanar point may lead to a wide facet.  Options 'QbB' (scale to unit
 box) or 'Qbb' (scale last coordinate) may remove this warning.  Use 'Pp'
 to skip this warning.  See 'Limitations' in qh-impre.htm.

 In borderline cases, I get inaccurate results with no warning!

 It is hardly unusual in science to have a function where one argument is
 many (ten or more) orders of magnitude larger than the other. For example,
 maybe I am calculating a function of time and space f(t,x) using SI units
 (seconds for t, meters for x), but I'm discussing astronomical phenomena
 or nanoscale phenomena or whatever.

 Based on the warning message, it sounds like using the 'QbB' option
 ("scale to unit box") in QHull would be perfect to solve this problem. Is
 there any reason that this option is not used?

 Sample code: x=1e-15;  points =
 np.array([[3*x,3],[3*x,5],[4*x,3],[4*x,5]]);  data = [4,5,6,7];  a =
 LinearNDInterpolator(points,data);  print a(3.5*x,4)

 Mathematically, the answer should be 5.5, independent of x, but it fails
 when x is too big or small.

 Thanks in advance!

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1666>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list