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
 All Forums
 Origin Forum for Programming
 Forum for Python
 Python function for Colume value calucation

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
doyazi302 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'
2   L A T E S T    R E P L I E S    (Newest First)
doyazi302 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

ChaoC 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

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000