程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Solving equations with unknowns in Python

編輯:Python

use python Problems in solving formulas with unknowns

from sympy import *
t,n,k,g,w,r,a,e,b=symbols('t,n,k,g,w,r,a,e,b')
f1=(1-t)n**ake*gb-wn-rk
dn=diff(f1,n)
print("dn=",dn)
dk=diff(f1,k)
print("dk=",dk)
dn= ag**bke*na*(1 - t)/n - w
dk= eg**bke*na*(1 - t)/k - r
m=solve([dn,dk],[n,k])
print(m)

dn= ag**bke*na*(1 - t)/n - w
dk= eg**bke*na*(1 - t)/k - r
Traceback (most recent call last):
File "D:\python\venv\1.py", line 10, in
m=solve([dn,dk],[n,k])
File "D:\python\venv\lib\site-packages\sympy\solvers\solvers.py", line 1108, in solve
solution = _solve_system(f, symbols, flags)
File "D:\python\venv\lib\site-packages\sympy\solvers\solvers.py", line 1972, in _solve_system
raise NotImplementedError('could not solve %s' % eq2)
NotImplementedError: could not solve e*g
bn**a(1 - t)((-n(1 - a)w/(ag**b(t - 1)))(1/e))(e - 1) - r


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved