Group Abstract Group Abstract

Message Boards Message Boards

0
|
2.8K Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Problem with Expected Value and equation solving

Posted 9 years ago

Hi everyone,

I am new to Mathematica and I have a problem with solving a simultaneous equation system in combination with a variable that follows a distribution. I really hope that someone could help. My code looks like this:

Q = Qr + n*q;
Costqu = 1/2*c*q^2 + F;
MCostqu = c*q;
Profitqu = p*q - Costqu;
Demand = A - B*p;
Solve[p == MCostqu && Demand == Q && ExpectedValue[Profitqu, WeibullDistribution[2, 2], Qr] == Inv, {n, p, q}]

Unfortunately, Mathematica does not attain the correct solution which I calculated by dividing up the system into

Solve[p == MCostqu && Demand == Q , {q, p}]
Solve[ExpectedValue[(-((-A + Qr)/(B c + n))) ((c (A - Qr))/( B c + n)) - 1/2*c*(-((-A + Qr)/(B c + n)))^2 - F, WeibullDistribution[2, 2], Qr] == Inv, {n}]

Is there any possibility to derive the solution in one step? Even better would be if Qr is replaced in the beginning as being a pdf but I dont know how to derive the ExpectedValue then. Thanks for your help!

POSTED BY: Kai Paulsen
3 Replies

What is wrong with the one step result?

Q = Qr + n*q;
Costqu = 1/2*c*q^2 + F;
MCostqu = c*q;
Profitqu = p*q - Costqu;
Demand = A - B*p; polys = {p - MCostqu, Demand - Q, 
  ExpectedValue[Profitqu, WeibullDistribution[2, 2], Qr] - Inv}

(* Out[1695]= {p - c q, 
 A - B p - n q - Qr, -Inv + 1/2 (-2 F + 2 p q - c q^2)} *)

We can solve as below. Note that this is equivalent to the original formulation.

sol = Solve[polys == 0, {n, p, q}]

(* Out[1696]= {{n -> (-2 B c F - 2 B c Inv - 
    Sqrt[2] A Sqrt[c] Sqrt[F + Inv] + 
    Sqrt[2] Sqrt[c] Sqrt[F + Inv] Qr)/(2 (F + Inv)), 
  p -> -Sqrt[2] Sqrt[c] Sqrt[F + Inv], 
  q -> -((Sqrt[2] Sqrt[F + Inv])/Sqrt[c])}, {n -> (-2 B c F - 
    2 B c Inv + Sqrt[2] A Sqrt[c] Sqrt[F + Inv] - 
    Sqrt[2] Sqrt[c] Sqrt[F + Inv] Qr)/(2 (F + Inv)), 
  p -> Sqrt[2] Sqrt[c] Sqrt[F + Inv], 
  q -> (Sqrt[2] Sqrt[F + Inv])/Sqrt[c]}} *)

Now it's straightforward to check the result.

Simplify[polys /. sol]

(* Out[1697]= {{0, 0, 0}, {0, 0, 0}} *)
POSTED BY: Daniel Lichtblau
Posted 9 years ago

Thanks for your help! Maybe I wasn't precise enough about describeing my problem. The first solution gives me variables p and q that only depend on c,F and Inv, but they should still depend on Qr (e.g. its pdf) which is attained by the second solution. So, I was wondering if it is possible to deter Mathematica from replacing Qr (or its pdf) in p and q when deriving p,q,n simultenously.

p,q should depend on Qr (or its pdf)

n should only depend on parameters like c,F,Inv,A,B and is fixed.

POSTED BY: Kai Paulsen

Your second solution does not seem to solve the system:

Simplify[(p == MCostqu && Demand == Q && 
     ExpectedValue[Profitqu, WeibullDistribution[2, 2], Qr] == 
      Inv) /. Solve[p == MCostqu && Demand == Q, {q, p}] /.

  Solve[ExpectedValue[(-((-A + Qr)/(B c + n))) ((c (A - Qr))/(B c + 
           n)) - 1/2*c*(-((-A + Qr)/(B c + n)))^2 - F, 
     WeibullDistribution[2, 2], Qr] == Inv, {n}]]

does not give True.

POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard