Mathematica Interpolation function error

  • #1
Youssi
6
2
TL;DR Summary
Interpolation error : :inder: The order-2 derivative of {1651.15,0.129739} is not a tensor.
Hello everyone,
I am relatively new to Mathematica, and I am encountering an issue when trying to interpolate numerical data imported from an Excel file.
Here are the steps I've taken:
I imported the numerical data from an Excel file into Mathematica.
I attempted to interpolate the data using the command:
[Lambda]Interp = Interpolation[lambda, InterpolationOrder -> 2];
However, I encountered the following error:
Interpolation::inder: The order-2 derivative of {1651.15,0.129739} is not a tensor.
As a new user, I'm unsure how to correct this issue. I would greatly appreciate any guidance or suggestions on resolving this error. If there are alternative approaches to achieve the interpolation, please feel free to share them.

Thank you in advance for your help!
 

Attachments

  • condu_therm_rer.xlsx
    11.5 KB · Views: 25
Physics news on Phys.org
  • #2
How do you import the data?
 
  • Like
Likes Youssi
  • #3
This the command that i use to import data :
Lambda= Import["C:\\Users\\Documents\\Modélisation\\1_\\mathematica\\condu_therm_rer.xlsx"];
and this is how the data are displayed:
{{{707.637, 0.0556025}, {1280.52, 0.092702}, {1415.35, 0.0927435}, {1651.15, 0.129739}, {1887.03, 0.148273}, {2055.5, 0.166787}, {2257.63, 0.194541}, {2358.68, 0.213034}, {2527.14,0.231548}, {2560.66, 0.277712}, {2661.67, 0.305435}, {2729.01, 0.323918}, {2796.23, 0.370092}, {2930.91, 0.407057}, {2964.39, 0.462452}, {3132.67, 0.527119}, {3132.48, 0.573273}, {3300.75, 0.637941}, {3300.56, 0.684095}, {3401.5, 0.73028}, {3536.33, 0.730321}, {3637.83, 0.638044}, {3941.43, 0.582753}, {4110.08, 0.555112}, {4177.65, 0.51821}, {4346.19, 0.518262}, {4548.44, 0.518324}, {4683.08, 0.56452}, {4851.39, 0.619956}, {4851.12, 0.684572}, {4884.6, 0.739967}, {4951.87, 0.776911}, {4985.46, 0.804613}}}
 
  • #4
Youssi said:
This the command that i use to import data :
Lambda= Import["C:\\Users\\Documents\\Modélisation\\1_\\mathematica\\condu_therm_rer.xlsx"];
Mathematica imports multiple Excel worksheets all at once in the form of a list: {Sheet1, Sheet2, ...}. Since you only have one sheet, change your import statement to:
Lambda=Import["C:\\Users\\Documents\\Modélisation\\1_\\mathematica\\condu_therm_rer.xlsx"][[1]];
to extract your single sheet from the list. This removes the outermost set of braces and allows the interpolation to run successfully.
 
  • Like
Likes Youssi and DrClaude
  • #5
renormalize said:
Mathematica imports multiple Excel worksheets all at once in the form of a list: {Sheet1, Sheet2, ...}. Since you only have one sheet, change your import statement to:
Lambda=Import["C:\\Users\\Documents\\Modélisation\\1_\\mathematica\\condu_therm_rer.xlsx"][[1]];
to extract your single sheet from the list. This removes the outermost set of braces and allows the interpolation to run successfully.
Thank you very much! It worked.
 
  • Like
Likes renormalize

1. What causes errors in Mathematica's Interpolation function?

Errors in Mathematica's Interpolation function can be caused by a variety of factors, including insufficient or unevenly spaced data points, attempting to interpolate outside the range of the provided data (extrapolation), data containing noise or discontinuities, and using an interpolation order that does not suit the data complexity. Ensuring data quality and appropriate use of the function's parameters can help mitigate these errors.

2. How can I fix the "Interpolation::inder: The order n of the derivative is too large" error?

This error occurs when you request a derivative of an order higher than the interpolation function supports. To fix this, you can either reduce the derivative order requested or increase the number of data points and possibly the interpolation order, so the higher derivative can be calculated accurately.

3. Why do I get the "Interpolation::nher: Required order of continuity could not be achieved" error?

This error typically arises when the interpolation function cannot achieve the smoothness specified by the `InterpolationOrder` due to discontinuities or sharp bends in the data. To resolve this, you can lower the `InterpolationOrder`, preprocess your data to smooth out discontinuities, or segment your data and apply interpolation to each segment separately.

4. What should I do if I encounter the "Interpolation::femimq: The interpolation points ... are not distinct" error?

This error indicates that some of the points in your dataset are duplicated or too close to each other, which confuses the interpolation algorithm. Check your data for duplicate or near-duplicate points and remove them. Ensuring that all points are unique and sufficiently spaced will help avoid this issue.

5. How can I avoid the "General::munfl: Tiny or zero spacing detected" error in Mathematica's Interpolation function?

This error is usually caused by numerical issues related to the spacing of the data points being too small, leading to underflow problems. To avoid this, ensure that your data points are scaled appropriately and that there is a reasonable amount of spacing between them. It may also help to increase the working precision of your computation using the `WorkingPrecision` option in the Interpolation function.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
263
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
224
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
899
  • Programming and Computer Science
Replies
6
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
16K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • Programming and Computer Science
Replies
1
Views
688
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Back
Top