Often in engineering calculations we want to be able to work with material properties that vary with extensive properties like Temperature and Pressure. For example the specific heat of air varies appreciably with temperature. As in that link, these property variations are determined from experiments and tabulated for specific temperature intervals.

The table represents a numerical function, i.e. it gives cp(T).

What I'm looking for is a module to code this in python. Is there a scipy or numpy function which takes a pair of arrays, and returns a function which, when called with a Temperature argument, will return the corresponding heat capacity (linearly interpolating where necessary).

To be clear, I don't want to curve fit the data. It's cumbersome and some accuracy is lost.

  • 1
    This question is off-topic right now since it asks for "a way to code" something (a tabular representation). You could make it relevant if you reword it into asking about "a library that imports tabular data". If that's not what you want, then I think StackOverflow is a better place to ask it, as long as you show them what you've tried.
    – Tymric
    Oct 28 '14 at 19:03
  • 2
    @Timmy I've just replaced "way" by "module". Makes it fit, and matches the answer :)
    – Izzy
    Oct 29 '14 at 10:30

The module I was looking for is scipy.interpolate.

  • I tried searching a couple more times when I had finished typing out the question, and found the answer. Oct 28 '14 at 17:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.