Mathematica Mathematica Interpolation function error

AI Thread Summary
A user new to Mathematica faced an error while trying to interpolate numerical data imported from an Excel file. The issue arose from the way the data was imported, which included multiple worksheets as a list. The user initially used the command `Lambda= Import["C:\\Users\\Documents\\Modélisation\\1_\\mathematica\\condu_therm_rer.xlsx"];`, resulting in an error during interpolation. A solution was provided to modify the import command to `Lambda=Import["C:\\Users\\Documents\\Modélisation\\1_\\mathematica\\condu_therm_rer.xlsx"][[1]]`, which extracts the first worksheet and eliminates the outer braces, allowing the interpolation to function correctly. The user confirmed that this adjustment resolved the issue.
Youssi
Messages
6
Reaction score
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

Physics news on Phys.org
How do you import the data?
 
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}}}
 
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
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

Similar threads

Replies
4
Views
1K
Replies
1
Views
2K
Replies
6
Views
2K
Replies
5
Views
2K
Replies
6
Views
4K
Replies
6
Views
11K
Back
Top