Python Forum
Python sympy problem for symbolic equation definition - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: Python sympy problem for symbolic equation definition (/thread-41834.html)



Python sympy problem for symbolic equation definition - joellapointe_engineering - Mar-24-2024

I have a problem forming a symbolic equation with the sympy command "sp.Eq()".I have an Excel sheet with equations formed by concatenation of cells as follow :

[Image: EQN1.jpg]

Then, an Excel concatenation is done to form the equation :

'+F_WORM_X*1+R_WORM_LOW_BEA_X*1+R_WORM_UP_BEA_X*1+F_WORM_FRIC_X*1'

So this Excel equation is put in a panda dataframe from the Excel sheet :

Quote:FBD_WORM_ = pd.read_excel("FUSION EPS_LOAD CASE_BIGBLUE_V03.xlsx", sheet_name = "FBD worm", )

And the symbolic equation is formed from the content of the dataframe :

Quote:EQ_W_1 = sp.Eq(FBD_WORM_.iloc[14, 3], 0)

It gives me a sympify error :

Quote:runfile('G:/Mon disque/2023-08-07/Nouveau classement/PROJETS/FUSION/LOAD CASES VS BIGBLUE/Fusion_Bearing Analysis_BiBlue Case_V03.py', wdir='G:/Mon disque/2023-08-07/Nouveau classement/PROJETS/FUSION/LOAD CASES VS BIGBLUE')Traceback (most recent call last):

File C:\ProgramData\anaconda3\lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec exec(code, globals, locals)

File g:\mon disque\2023-08-07\nouveau classement\projets\fusion\load cases vs bigblue\fusion_bearing analysis_biblue case_v03.py:65 EQ_W_1 = sp.Eq(FBD_WORM_.iloc[14, 3], 0)

File C:\ProgramData\anaconda3\lib\site-packages\sympy\core\relational.py:626 in new lhs = _sympify(lhs)

File C:\ProgramData\anaconda3\lib\site-packages\sympy\core\sympify.py:529 in _sympify return sympify(a, strict=True)

File C:\ProgramData\anaconda3\lib\site-packages\sympy\core\sympify.py:450 in sympify raise SympifyError(a)

SympifyError: SympifyError: '+F_WORM_X1+R_WORM_LOW_BEA_X1+R_WORM_UP_BEA_X1+F_WORM_FRIC_X1'

Is it a bas equation formation?

It is not clear for me what is the problem with the equation?