Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 926375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:40:34+00:00 2026-05-15T19:40:34+00:00

This list is a simple function that maps a 2D point to a number,

  • 0

This list is a simple function that maps a 2D point to a number, if
you regard each {{x,y},z} as f[x,y]=z

{ 
 {{1,3},9}, {{1,4},16}, 
 {{2,4},8}, {{2,5},10} 
} 

I now want a function that interpolates/extrapolates f[x,y] for any {x,y}.

Mathematica refuses to do this:

Interpolation[{{{1,3},9}, {{1,4},16},{{2,4},8}, {{2,5},10}},  
 InterpolationOrder->1] 

Interpolation::indim: The
coordinates do not lie on a structured
tensor product grid.

I understand why (Mathematica wants a “rectangular” domain), but
what’s the easiest way to force Mathematica to create an interpolation?

This doesn’t work:

f[1,3]=9; f[1,4]=16; f[2,4]=8; f[2,5]=10; 
g=FunctionInterpolation[f[x,y],{x,1,2},{y,3,5}] 

FunctionInterpolation::nreal:
16 Near {x, y} = {1, –}, the function did not
evaluate to a real number.
5 FunctionInterpolation::nreal:
17 Near {x, y} = {1, –}, the function did not
evaluate to a real number.
5 FunctionInterpolation::nreal:
18 Near {x, y} = {1, –}, the function did not
evaluate to a real number.
5 General::stop: Further output of
FunctionInterpolation::nreal
will be suppressed during this calculation.

Even if you ignore the warnings above, evaluating g gives errors

g[1.5,4] // FortranForm 


     f(1.5,4) + 0.*(-9.999999999999991*(f(1.4,4) - f(1.5,4)) +  
 -      0.10000000000000009* 
 -       (9.999999999999991* 
 -          (9.999999999999991*(f(1.4,4) - f(1.5,4)) +  
 -            4.999999999999996*(-f(1.4,4) + f(1.6,4))) +  
 -         0.5000000000000006* 
 -          (-10.000000000000014* 
 -             (-3.333333333333333*(f(1.3,4) - f(1.6,4)) -  
 -               4.999999999999996*(-f(1.4,4) + f(1.6,4))) -  
 -            9.999999999999991* 
 -             (9.999999999999991*(f(1.4,4) - f(1.5,4)) +  
 -               4.999999999999996*(-f(1.4,4) + f(1.6,4)))))) 

The other “obvious” idea (interpolating interpolating functions
themselves) doesn’t work either.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T19:40:35+00:00Added an answer on May 15, 2026 at 7:40 pm

    If polynomial interpolation is acceptable, InterpolatingPolynomial does what you want (where data is your list of points above):

    In[63]:= InterpolatingPolynomial[data, {x, y}]
    
    Out[63]= -24 + x (12 - 5 y) + 12 y
    
    In[64]:= f[2, 3]
    
    Out[64]= 6
    

    You could also use Fit to do least-squares fitting on the linear combination of functions specified in the second argument:

    In[65]:= Fit[Flatten /@ data, {1, x, y}, {x, y}]
    
    Out[65]= 4.75 - 8. x + 4.5 y
    

    Of course, a fitted function may not exactly interpolate your data points. If such fitting is acceptable though, FindFit can fit to any (linear or non-linear) model function you specify:

    In[72]:= FindFit[Flatten/@data, x y (a Sin[x] + b Cos[y]) + c, {a,b,c}, {x,y}]
    
    Out[72]= {a -> -0.683697, b -> 0.414257, c -> 15.3805}
    

    HTH!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was trying to implement a simple function that can concatenate any number of
OK, I have this simple function that finds the element of the list that
consider this simple function def foo(l=[]): if not l: print List is empty else
Hopefully this is simple: I have a relatively long list where each list item
Ive been writing a simple jquery function that turns a div with a list
I am trying to write a list function that takes a simple list and
I have a simple recursive array function that looks like this: function recursive_array($results) {
I've got a simple function that takes a List parameter. While working with it,
I first have this simple example that works (my first time using maps). The
I got a Python function that outputs a list like this, def get_items(argument): for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.