![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/476238/image.png)
Supremum of a concave function
3 ビュー (過去 30 日間)
古いコメントを表示
I have a function I want to calculate its supremum. The function is below.
-0.25* (c+A^t-v)^T *(c+A^t-v)/v for all v>0
2 件のコメント
Image Analyst
2021 年 1 月 1 日
編集済み: Image Analyst
2021 年 1 月 1 日
numPoints = 1000;
v = linspace(0.02, 1, 1000);
% Guesses:
c = 1 * ones(1, numPoints);
A = 2 * ones(1, numPoints);
T = 2 * ones(1, numPoints);
t = 3 * ones(1, numPoints);
% Compute function
y = -0.25 * (c+A.^t-v).^T .* (c+A.^t-v)./v %for all v>0
% Plot it.
plot(v, y, 'b.-', 'LineWidth', 2);
grid on;
What are c, A, t, and T?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/476238/image.png)
John D'Errico
2021 年 1 月 1 日
編集済み: John D'Errico
2021 年 1 月 1 日
What do you know about c, A, t, and T? T is most important, of course. For example, if T is not an integer, then things are, let me say, difficult? That is because noninteger powers of negative numbers will be complex, so that supremem will be a nasty thing.
回答 (1 件)
Walter Roberson
2021 年 1 月 2 日
This creates a list of supermum for the function, together with the conditions under which the supermum hold. The calculations would have been easier if we had been given more information about the symbols.
syms A t T v c;
f = -0.25* (c+A^t-v)^T *(c+A^t-v)/v;
df = diff(f,v);
sol = solve(df == 0,v,'returnconditions', true);
flavor = simplify(subs(diff(df,v),v,sol.v));
conditional_flavor = arrayfun(@(F,C) simplify(piecewise(C & F>0,symtrue,nan)), flavor, sol.conditions);
bs1 = [T == -1, T==0, T==1, T~=-1 & T~=0 & T~=1 & 1<real(T), T~=-1 & T~=0 & T~=1 & 1>real(T)];
bs2 = [c + A^t~=0, c + A^t==0];
branches = and(bs1, bs2(:));
for bidx = 1 : numel(branches)
assume(assumptions, 'clear')
assume(branches(bidx));
constrained_conditions(:,bidx) = simplify(conditional_flavor);
end
assume(assumptions, 'clear')
supermum= [];
for K = 1: size(constrained_conditions,1)
for bidx = find(~isnan(constrained_conditions(K,:)))
temp = arrayfun(@(C) simplify(piecewise(v == sol.v(K) & C, subs(f, v, sol.v(K)))), branches(bidx) & constrained_conditions(K,bidx));
supermum = [supermum; temp];
end
end
supermum
There is also a saddle point of f = 0 when v = c + A^t
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Calculus についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!