编程语言
首页 > 编程语言> > python-fsolve函数如何解决添加参数的问题

python-fsolve函数如何解决添加参数的问题

作者:互联网

 1 def solve(d1, d2, d3):
 2 
 3 
 4     def solve_function(unsolved_value):
 5         x, y, z = unsolved_value[0], unsolved_value[1], unsolved_value[2]
 6         # x, y, z = symbols("x y z")
 7         return [
 8                 (x1 - x) * (x1 - x) + (y1 - y) * (y1 - y) + (z1 - z ) * (z1 - z) - int(d1) * int(d1),
 9                 (x2 - x) * (x2 - x) + (y2 - y) * (y2 - y) + (z2 - z) * (z2 - z) - int(d2) * int(d2),
10                 (x3 - x) * (x3 - x) + (y3 - y) * (y3 - y) + (z3 - z) * (z3 - z) - int(d3) * int(d3),
11         ]
12 
13     solved = fsolve(solve_function, [0, 0, 0])
14     return solved

调用

 solved = solve(666,666,666)

 

标签:unsolved,python,fsolve,value,int,添加,solve,666,d2
来源: https://www.cnblogs.com/lsyy2017/p/15409402.html