Can I break

into - Separating them as... t*b<m and t*b>=m... .

Since second part has prob as 0 so I can ignore it. Will this be equivalent to max command in Matlab? Help @Torsten or help anyone?

2 views (last 30 days)

Show older comments

Sabrina Garland
on 14 Mar 2024

Commented: Sabrina Garland
on 16 Mar 2024

I have a Manager who has no information about the profit from investment into two bonds, other than the fact that they are independently drawn from uniform distribution ${m, 1}$ where, m>0. Profit from 1st and 2nd bond are denoted by a and b respectively.

He asks his partner (who is knowledgeable about profit from two bonds but is risk averse) to invest among two bonds. Manager knows that 1st bond is less risky and so partner will invest in a when a>=t*b where 0<t<1. So, basically only when profit from a is very very low, will partner not invest in 1st bond.

Now manager sees that partner has invested in 1st bond so it must be the case that a>=t*b. So, given this information he is trying to compute expected profit.

Since t<1, and both a and b has domain space over m to 1, so it might be the case that t*b falls below m. How to handle that in integration -

I know expected value will look something like this -

So, I asked Matlab to calculate the following -

syms a b m t

inteqn = int(int(a, a, max(t * b, m), 1 ), b, m, 1) / int(1, a, max(t * b, m), 1 );

% Calculate Eaa

disp(inteqn);

But it printed some equation with Nan. What am I doing wrong? Please help.

John D'Errico
on 14 Mar 2024

Edited: John D'Errico
on 14 Mar 2024

At the VERY least, you have chosen to MULTIPLY the two terms, instead of dividing them. Assuming you really wanted to form a ratio there, surely that should be a red flag. That little * instead of a division operator should be an issue. ;-) Or, maybe you really did want to multiply them, and you just showed a formula in your question with a ratio. ;-)

syms a b m t

% inteqn = int(int(a, a, max(t * b, m), 1 ), b, m, 1) * int(1, a, max(t * b, m), 1 );

Anyway, is your code correct to do the integrations? I'll check the denominator term first.

This is a double integral, but the inner integral has 1 as the kernel. So we just take the DIFFERENCE of the two limits, to get.

1 - max(t * b, m)

as the inner integral of the denominator. In there, we see something about a NaN appear. Perhaps this is where your question arises. Remember that you told MATLAB only that a,b,m and t were just some symbolic variables. They can take on any value at all. The omitnan flag there is not truly important, apprently having gotten auto-generated from the call to max.

Next, you would integrate that from m to 1.

int(max(t * b, m) - 1,b,m,1)

Of couse here, we see that MATLAB did not succeed in the integration. Perhaps it would be better to deal with the max function, as instead a piecewise function. That is, as a function of b, what is max(m,b*t)? We know that t is non-negative, as are a, b, and m. We might put that information directly into the syms call.

syms a b m t real positive

Kdenom = 1 - max(t * b, m)

And even there, MATLAB did not resolve the max, as a function of b. Again, we know that a,b,m,t are all positive. And we know that 0<t<1. We can write that max call as a piecewise function of b instead. Sometimes it helps to give syms a little push in the right direction.

Kdenom = 1 - piecewise(b < m/t,m,b >= m/t, b*t)

Now, integrate that from m to 1.

int(Kdenom,b,[m,1])

This yields a bit of a mess, because MATLAB is worried about various conditions on what if t is greater than 1, etc? Only now might we recognize that we never told MATLAB that t is strictly between 0 and 1. Does that help?

assume(0<t<1)

int(Kdenom,b,[m,1])

And that definitely reduces things. Even here though, there are still issues about m. What if m < t? m==t? What if m > 1?

What is the value of m? Hmm. It appears you said that m is a random variable, uniformly distributed on some interval. But your statement about m is somewhat unclear. Is it true that m is presumed to be uniformly distributed on the open interval (0,1)?

int(Kdenom,b,[m,1])

It would appear that case 3 is the one that would apply, IF we know that m < t, and 0<m<1.

And we have not even looked at the numerator term. That will likely be more of the same. And ince this so very much looks like a homework assignment, I will stop here.

John D'Errico
on 16 Mar 2024

I showed what the result is. At least for one of the integrals. It will be a function of m. And it will apparently depend on the relationship between m and t. Which one is larger?

The numerator integral will be something similar, but I assume a little more complicated. Hopefully not too much more so.

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

Start Hunting!