The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Python
 Python function for Colume value calucation
 New Topic  Reply to Topic
 Printer Friendly
Author  Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

doyazi302

USA
2 Posts

Posted - 08/29/2025 :  12:29:16 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

doyazi302

USA
2 Posts

Posted - 08/29/2025 :  3:01:48 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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

Go to Top of Page
   Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000