[英]Optimization of two vectors in python
我需要對兩個向量x和y進行優化,目標函數是這兩個向量 f( x,y ) 的函數, x和y也與 a- x / y =0 相關,是否有一個井-在python上解決這個問題的已知方法?
好吧,您的問題很籠統,如果您提供更多詳細信息,那就太好了。 但是我從這里抓取了一個代碼片段,您可以在其中進行編輯。 scipy 有一個優化類,它有幾種優化函數的方法。
import numpy as np from scipy.optimize import minimize def f(x,y): return 10 - x/y # initial values x0 = 1.3 y0 = 0.5 res = minimize(f, [x0, y0], method='...') print(res.x)
如果你提供更多信息,比如你想使用什么算法,我可以提供更精確的代碼。
[英]Cross product of two vectors in Python
[英]About concatenating two vectors in python
[英]check if two vectors are equal python
[英]Python array optimization with two constraints
[英]How to sort two vectors in one in Python?
[英]Python, Numpy: How to change two vectors at once
[英]Python, DotProduct between two vectors issue
[英]Calculating angle between two vectors in python
[英]Python - How to find a correlation between two vectors?
[英]Python Class method: Subtracting two vectors
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.