简体   繁体   中英

Using sympy for bunch of equations

Hello I try to use sympy to solve equations,

The goal is explain each eq_ with X, IN1, IN2, IN3, IN4a and IN4s only

from sympy import symbols, Eq, solve

X = symbols('X')
IN1 = symbols('IN1')
IN2 = symbols('IN2')
IN3 = symbols('IN3')
IN4a = symbols('IN4a')
IN4s = symbols('IN4s')

SSOL = symbols('SSOL')
CROP = symbols('CROP')
SON = symbols('SON')
DUNG = symbols('DUNG')
FEED = symbols('FEED')
FODGAS = symbols('FODGAS')
RESP = symbols('RESP')
DUNGGAS = symbols('DUNGGAS')

eq_SSOL = Eq(0.2 * DUNG + IN3 + IN1 + 0.25 * X + 0.03 * SON)
eq_CROP = Eq(0.6 * SSOL + IN4s)
eq_SON = Eq(32.8 * X + 7.8 * (IN1 + IN3) + 17.7 * IN2 + 13 * IN4s + 41.4 * IN4a)
eq_DUNG = Eq(0.8 * FEED)
eq_FEED = Eq(0.27 * CROP + IN2)
eq_FODGAS = Eq(0.03 * CROP)
eq_RESP = Eq(0.02 * FEED)
eq_DUNGGAS = Eq(0.3 * DUNG)

solve((eq_SON, eq_CROP, eq_SSOL, eq_FEED, eq_RESP, eq_DUNG, eq_DUNGGAS, eq_FODGAS), (SSOL, CROP, SON, DUNG, FEED, FODGAS, RESP, DUNGGAS))

I certainly doubt that this is the way to go but I also run out of google search terms to find solutions

Is there a way to solve this?

Your eq_SON equation is independent of all the variables in which you are interested. You need 8 equations involving the 8 symbols for which you are solving.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM