Mathematica Interpolation function error

Click For Summary
SUMMARY

The discussion centers on resolving an error encountered while using the Interpolation function in Mathematica with data imported from an Excel file. The user initially faced the error message "Interpolation::inder: The order-2 derivative of {1651.15,0.129739} is not a tensor" due to improper data structure after import. The solution involved modifying the import command to extract the first sheet from the imported list, allowing the interpolation to execute correctly. The corrected command is: Lambda=Import["C:\\Users\\Documents\\Modélisation\\1_\\mathematica\\condu_therm_rer.xlsx"][[1]]; which successfully resolved the issue.

PREREQUISITES
  • Familiarity with Mathematica 12.0 or later
  • Understanding of data structures in Mathematica
  • Basic knowledge of interpolation techniques
  • Experience with importing data from Excel files
NEXT STEPS
  • Explore Mathematica's Interpolation function documentation for advanced usage
  • Learn about data manipulation in Mathematica using List and Matrix functions
  • Investigate error handling in Mathematica to troubleshoot similar issues
  • Study best practices for importing data from Excel into Mathematica
USEFUL FOR

This discussion is beneficial for Mathematica users, data analysts, and researchers who are working with numerical data interpolation and require guidance on importing data from Excel effectively.

Youssi
Messages
6
Reaction score
2
TL;DR
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?
 
  • Like
Likes   Reactions: Youssi
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   Reactions: 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   Reactions: renormalize

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 11 ·
Replies
11
Views
17K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 6 ·
Replies
6
Views
12K