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)

 

posted @ 2021-10-15 08:04  在学习编程的lsy呀  阅读(523)  评论(0编辑  收藏  举报