Optimization problem - max independent given a function value

조회 수: 9 (최근 30일)
Bruno
Bruno 2015년 6월 30일
답변: Bruno 2015년 7월 1일
Hi I have the following:
syms irr2 m_S s
irr1=0.05;
M=0.7;
n=120;
f=(symsum(1/(1+irr1)^s,s,1,n)-symsum(1/(1+irr2)^s,s,1,n)*(1+M*m_S)/(1+irr2)^m_S);
f must be equal zero
m_S is a variable
I wanna know which is the max irr2 ... how can I do it?

채택된 답변

Bruno
Bruno 2015년 7월 1일

추가 답변 (2개)

Walter Roberson
Walter Roberson 2015년 6월 30일
The max irr2 is approximately 10^7.26190814317193495613417466800 . This can be a difficult number to track down as the function is extremely steep in this area. The m_S for which the maximum occurs is approximately -1.3687669705805147932311784659488142590365365377179
You were probably expecting an answer in terms of m_S. However, if you take your f and plot it for any fixed irr2 around 1/10000, varying m_S, you will see that it peaks it the small negative values, being mostly negative. Differentiate f with respect to m_S, solve for 0, and you see that the maximum is at -(1/7)*(10*ln(1+irr2)-7)/ln(1+irr2) . The roots of f with respect to irr2 become greatest when the function is maximized with respect to m_S, as that pulls the downward-rounded shape up by the most.
So substitute that -(1/7)*(10*ln(1+irr2)-7)/ln(1+irr2) for m_S in f. Your chances of solving for the zeros are iffy as huge numbers are involved. But if you take that f and change variables to N = log10(irr2), you can plot the maximal f with respect to log10(irr2). There is one root at log10(irr2) approximately -.894057116696332445739068328606 and there is a second root at log10(irr2) approximately 7.26190814317193495613417466800. You can substitute irr2=10^7.26190814317193495613417466800 back into -(1/7)*(10*ln(1+irr2)-7)/ln(1+irr2) to get the m_S at which the value occurs.
As m_s increases past the -1.368-ish, the maximum irr2 that satisfies f=0 will decrease.
  댓글 수: 2
Bruno
Bruno 2015년 6월 30일
편집: Bruno 2015년 6월 30일
Walter, wonderful and thanks... is there a way to do this with fmincon with the constraint that m_S must be positive? The problem I have is that I cannot make the equation explicit for irr2 and I need to repeat the calcolus for many equations!
Could you please explain me the process of how to do it in Matlab? Thanks!

댓글을 달려면 로그인하십시오.


Torsten
Torsten 2015년 7월 1일
I did not check for efficiency, but my suggestion is as follows:
1. Find analytical expressions for the sums involved (Hint: Geometric series).
Result is an explicit expression of the form f(m_s,irr2) = 0.
2. You can't solve f for irr2 in terms of m_s.
But assume irr2 = irr2(m_s).
Differentiate f(m_s,irr2(m_s)) implicitly with respect to m_s:
0=df/dm_s + df/d(irr2)*d(irr2)/dm_s.
Solving for d(irr2)/dm_s gives
d(irr2)/dm_s = - (df/dm_s) / (df/d(irr2)).
3. Solve the ordinary differential equation
d(irr2)/dm_s = - (df/dm_s) / (df/d(irr2))
with initial condition irr2(m_s=0) = irr1
using ODE45.
Use the event facility of ODE45 to detect when d(irr2)/dm_s becomes zero.
This is the value for m_s where irr2 has a local extremum.
My hope is that it's unique and a maximum.
Best wishes
Torsten.

카테고리

Help CenterFile Exchange에서 Numeric Solvers에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by