I am trying to figure out an efficient way for solving systems of equations in Sympy "automatically". Let me exemplify, this is a standard approach to formulating the code
n = 3
y = sp.symbols('y1:{}'.format(n + 1))
TempDict1=(sp.solve([Dem_s[0],Dem_s[1]],(y[0],y[1])))
I want to make it iterable, so the system of equations update itself with regards to how many equations and variables exists in the lists of Dem_s and y respectively.
I have tried the following:
Templist=[]
for i in range(n-1):
Templist.append(y[i])
TempDict1={}
for i in range(n-1):
TempDict1=sp.solve([Dem_s[i]], (Templist))
However, this will not solve it. Do you have any suggestions?
Thanks in advance.