![](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!