Finding the minimum value
81 ビュー (過去 30 日間)
古いコメントを表示
Hi.I have a function f(x,y)=2.62./2.62+(x-y).^4, based on the attached figure, the minimum value for this function is 1. I want to know among all of the value for x and y that makes f(x,y)=1, what is the minimum of x-y? I mean how can I find the minimum value of x-y from all of the values that make f(x,y)=1.
Thanks in advance for any help
openfig('xy.fig');
4 件のコメント
Walter Roberson
2022 年 6 月 14 日
編集済み: Walter Roberson
2022 年 6 月 14 日
For real x and y, (x-y)^4 is always non-negative. 2.62 plus a non-negative value will always be minimum 2.62 or larger. 2.62 divided by a value that is 2.62 or larger, has a maximum value of 1 and cannot be greater than 1. Imagine for example x=1000 y=0 giving 2.62+1e12 as the denominator, the division is going to give near 1e-11
The plot cannot be for the formula you give. The plot could, however, be for the version of the formula missing the ()
採用された回答
Image Analyst
2022 年 6 月 14 日
Compute your f matrix, then try this
% Find the overall minimum value of f.
minValue = min(f(:)) % Hopefully 1 but maybe not exactly.
% Find where that min value occurs
[minRow, minCol] = find(f == minValue)
Note if the min occurs in more than one element minRow and minCol will be vectors giving all the places where minValue occurs.
8 件のコメント
Walter Roberson
2022 年 6 月 14 日
sympref(FloatingPointOutput=false);
syms x y
f(x,y) = 2.62./(2.62+(x-y).^4)
dfx = diff(f, x)
critx = solve(dfx, x)
%so every y is a triple critical point for x
dfy = diff(f, y)
crity = solve(dfy, y)
%so every x is a critical point for some y
d2f = simplify(diff(dfx, x))
[N, D] = numden(d2f)
xsaddle = solve(N == 0, x)
vpa(simplify(subs(f, x, xsaddle)))
vpa(simplify(subs(f, x, xsaddle - 1/1000)))
vpa(simplify(subs(f, x, xsaddle + 1/1000)))
So the first two critical point xsaddle are maximums, the second and third critical points are places where greater or lower would lead to imaginary outputs; the last two are again maxima.
fsurf(f, [-2 2 -2 2])
Looks to me as if there is a "crease".
その他の回答 (2 件)
Walter Roberson
2022 年 6 月 14 日
For the revised formula over real numbers the minimum value is when x and y differ as much as possible, in particular if the difference between them is infinite, which would give you an output of 0.
The maximum value occurs when (x-y)^4 is minimal which occurs when x == y exactly, which gives you 2.62/2.62 == 1
2 件のコメント
tharun
2023 年 10 月 26 日
Find the minimum value f(x,y) = x3 + y 3 subject to the constraints x + y = 20
3 件のコメント
Walter Roberson
2023 年 10 月 26 日
When you have an equality constraint relating x and y, solve the constraint for one of the variables, getting a formula for it in terms of the other variable. Then substitute that formula into the main function. You now have a function of a single variable to be optimized. Proceed by way of calculus.
Sam Chak
2023 年 10 月 26 日
編集済み: Sam Chak
2023 年 10 月 26 日
Minimize a bivariate function
subject to constrained ,
can be transformed into an unconstrained optimization problem by taking the substitution method:
This yields ,
and the minimum of the quadratic function can be found at
.
From the equality constraint, we can find .
参考
カテゴリ
Help Center および File Exchange で Calculus についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!