Author |
Topic  |
|
doyazi302
USA
2 Posts |
Posted - 08/29/2025 : 12:29:16 PM
|
Need help,
I tried to calucate column values using Python function, as decribed below. But I got an error message like, '<' not supported between instances of 'list' and 'int', I could solve this with my Juypter notebook, but no idea how to do debugging.
At Set Colume values "Col(E)" = 'py.J(5, 270/col('Temp'),
"Python Function" import numpy as np from scipy.integrate import quad
def J(n, y): integrand = lambda x: (x**n) / ((np.exp(x) - 1)*(1 - np.exp(-x))) result, _ = quad (integrand, 0, y) return result
Error as below >> Traceback (most recent call last): File "C:\Users\zsung\AppData\Local\OriginLab\101\TMP\pyTmp\_SCV.py", line 7, in J result, _ = quad (integrand, 0, y) ^^^^^^^^^^^^^^^^^^^^^^ File "C:\ProgramData\OriginLab\PyPackage\Py311\64bit\scipy\integrate\_quadpack_py.py", line 433, in quad flip, a, b = b < a, min(a, b), max(a, b) ^^^^^ TypeError: '<' not supported between instances of 'list' and 'int'
|
|
ChaoC
USA
208 Posts |
Posted - 08/29/2025 : 1:17:55 PM
|
Hello,
This doesn't appear to be an Origin-specific issue. I’d recommend checking out the Quad documentation,: https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.quad.html
b is expected to be a float but in your code: quad (integrand, 0, y)
You are passing Col("Temp") in y which is a list. Note: In Origin, you need double quotes if referring to the long name. I.e. col("Temp") not col('Temp').
You can try something like ChatGPT as a starting point for debugging if you don't know how to.
Best, Chao |
 |
|
doyazi302
USA
2 Posts |
Posted - 08/29/2025 : 3:01:48 PM
|
quote: Originally posted by ChaoC
Hello, Chao, thank you for the comments,
Col("Temp"), the double quotes come from column selection, provided by origin column selection. So it is the defult. I set the upper limit of the integration with 270 devided with each value of the column (Col("Temp").
So I do not understand why origin recognize this is list rather than interger.
This doesn't appear to be an Origin-specific issue. I’d recommend checking out the Quad documentation,: https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.quad.html
b is expected to be a float but in your code: quad (integrand, 0, y)
You are passing Col("Temp") in y which is a list. Note: In Origin, you need double quotes if referring to the long name. I.e. col("Temp") not col('Temp').
You can try something like ChatGPT as a starting point for debugging if you don't know how to.
Best, Chao
|
 |
|
|
Topic  |
|
|
|