Skip to main content
Improved formatting
Source Link
m_goldberg
  • 108.1k
  • 16
  • 104
  • 259

 ClearAll["Global`*"]

q1A = (1 - p1A - \[Beta]β + 
   p1B \[Beta]β + \[Alpha]α (-1 + p2A + \[Beta]β - 
      p2B \[Beta]β))/((-1 + \[Alpha]^2α^2) (-1 + \[Beta]^2β^2));
q1B = (1 - p1B - \[Beta]β + 
   p1A \[Beta]β + \[Alpha]α (-1 + p2B + \[Beta]β - 
      p2A \[Beta]β))/((-1 + \[Alpha]^2α^2) (-1 + \[Beta]^2β^2));
q2A = (1 - p2A - \[Beta]β + 
   p2B \[Beta]β + \[Alpha]α (-1 + p1A + \[Beta]β - 
      p1B \[Beta]β))/((-1 + \[Alpha]^2α^2) (-1 + \[Beta]^2β^2));
q2B = (1 - p2B - \[Beta]β + 
   p2A \[Beta]β + \[Alpha]α (-1 + p1B + \[Beta]β - 
      p1A \[Beta]β))/((-1 + \[Alpha]^2α^2) (-1 + \[Beta]^2β^2));

f1 = Simplify[(1 - \[Phi]AϕA)*p1A*q1A + (1 - \[Phi]BϕB)*p1B*q1B];
f2 = Simplify[(1 - \[Phi]AϕA)*p2A*q2A + (1 - \[Phi]BϕB)*p2B*q2B];

{{p1As, p1Bs, p2As, p2Bs}} = 
  {p1A, p1B, p2A, p2B} /. 
   Simplify[Solve[ Simplify[
      Solve[
        {D[f1, p1A] == 0, D[f1, p1B] == 0, D[f2, p2A] == 0, 
      D[f2, p2B] == 0}, 
        {p1A, p1B, p2A, p2B}]];

{q1As, q1Bs, q2As, q2Bs} = 
  Simplify[
     {q1A, q1B, q2A, q2B} /. {p1A -> p1As, p1B -> p1Bs, p2A -> p2As, 
     p2B -> p2Bs}];

gA = Simplify[\[Phi]A*Simplify[ϕA*(p1As*q1As + p2As*q2As)];
gB = Simplify[\[Phi]B*Simplify[ϕB*(p1Bs*q1Bs + p2Bs*q2Bs)];

"Problematic"Problematic command

 Simplify[Solve[{D[gA, \[Phi]A]ϕA] == 0, 
   D[gB, \[Phi]B]ϕB] == 0}, {\[Phi]AϕA, \[Phi]BϕB}]]

Alternative command with additional restrictions

Simplify[
Alternative command with additional restrictions

Simplify[Solve[Solve[{D[gA, \[Phi]A]ϕA] == 0, 
   D[gB, \[Phi]B]ϕB] == 0, \[Phi]AϕA == \[Phi]BϕB, \[Phi]AϕA > 0, \[Phi]AϕA < 
    1}, {\[Phi]AϕA, \[Phi]BϕB}]]

Solution for parameter values $\alpha=1/2$$\alpha=1/2$ and $\beta=1/2$$\beta=1/2$


 gA2 = Simplify[gA /. {\[Alpha]α -> 1/2, \[Beta]β -> 1/2}];
gB2 = Simplify[gB /. {\[Alpha]α -> 1/2, \[Beta]β -> 1/2}];

Simplify[Solve[Simplify[
  Solve[{D[gA2, \[Phi]A]ϕA] == 0, 
   D[gB2, \[Phi]B]ϕB] == 0, \[Phi]AϕA == \[Phi]BϕB, \[Phi]AϕA > 0, \[Phi]AϕA < 
    1}, {\[Phi]AϕA, \[Phi]BϕB}]]

Proposed Solution for general \[Alpha] and \[Beta]

\[Phi]Asol

Proposed Solution for general α and β

ϕAsol = ((2 - \[Alpha]α) (1 - \[Beta]^2β^2))/(2 - \[Alpha]α (1 + \[Beta]β));
 
Simplify[\[Phi]AsolSimplify[ϕAsol /. {\[Alpha]α -> 1/2, \[Beta]β -> 1/2}]
 

The command Solve gives a solution for specific parameter values, for. For instance, $\alpha=1/2$ and $\beta=1/2$. However, if I do not specify parameter values for $\alpha$ and $\beta$ the command does not deliver a solution (I did let it calculate for several hours without result.)


 ClearAll["Global`*"]

q1A = (1 - p1A - \[Beta] + 
   p1B \[Beta] + \[Alpha] (-1 + p2A + \[Beta] - 
      p2B \[Beta]))/((-1 + \[Alpha]^2) (-1 + \[Beta]^2));
q1B = (1 - p1B - \[Beta] + 
   p1A \[Beta] + \[Alpha] (-1 + p2B + \[Beta] - 
      p2A \[Beta]))/((-1 + \[Alpha]^2) (-1 + \[Beta]^2));
q2A = (1 - p2A - \[Beta] + 
   p2B \[Beta] + \[Alpha] (-1 + p1A + \[Beta] - 
      p1B \[Beta]))/((-1 + \[Alpha]^2) (-1 + \[Beta]^2));
q2B = (1 - p2B - \[Beta] + 
   p2A \[Beta] + \[Alpha] (-1 + p1B + \[Beta] - 
      p1A \[Beta]))/((-1 + \[Alpha]^2) (-1 + \[Beta]^2));

f1 = Simplify[(1 - \[Phi]A)*p1A*q1A + (1 - \[Phi]B)*p1B*q1B];
f2 = Simplify[(1 - \[Phi]A)*p2A*q2A + (1 - \[Phi]B)*p2B*q2B];

{{p1As, p1Bs, p2As, p2Bs}} = {p1A, p1B, p2A, p2B} /. 
   Simplify[Solve[{D[f1, p1A] == 0, D[f1, p1B] == 0, D[f2, p2A] == 0, 
      D[f2, p2B] == 0}, {p1A, p1B, p2A, p2B}]];

{q1As, q1Bs, q2As, q2Bs} = 
  Simplify[{q1A, q1B, q2A, q2B} /. {p1A -> p1As, p1B -> p1Bs, p2A -> p2As, 
     p2B -> p2Bs}];

gA = Simplify[\[Phi]A*(p1As*q1As + p2As*q2As)];
gB = Simplify[\[Phi]B*(p1Bs*q1Bs + p2Bs*q2Bs)];

"Problematic" command

 Simplify[Solve[{D[gA, \[Phi]A] == 0, 
   D[gB, \[Phi]B] == 0}, {\[Phi]A, \[Phi]B}]]

Alternative command with additional restrictions

Simplify[Solve[{D[gA, \[Phi]A] == 0, 
   D[gB, \[Phi]B] == 0, \[Phi]A == \[Phi]B, \[Phi]A > 0, \[Phi]A < 
    1}, {\[Phi]A, \[Phi]B}]]

Solution for parameter values $\alpha=1/2$ and $\beta=1/2$


 gA2 = Simplify[gA /. {\[Alpha] -> 1/2, \[Beta] -> 1/2}];
gB2 = Simplify[gB /. {\[Alpha] -> 1/2, \[Beta] -> 1/2}];

Simplify[Solve[{D[gA2, \[Phi]A] == 0, 
   D[gB2, \[Phi]B] == 0, \[Phi]A == \[Phi]B, \[Phi]A > 0, \[Phi]A < 
    1}, {\[Phi]A, \[Phi]B}]]

Proposed Solution for general \[Alpha] and \[Beta]

\[Phi]Asol = ((2 - \[Alpha]) (1 - \[Beta]^2))/(2 - \[Alpha] (1 + \[Beta]));
 
Simplify[\[Phi]Asol /. {\[Alpha] -> 1/2, \[Beta] -> 1/2}]
 

The command Solve gives a solution for specific parameter values, for instance, $\alpha=1/2$ and $\beta=1/2$. However, if I do not specify parameter values for $\alpha$ and $\beta$ the command does not deliver a solution (I did let it calculate for several hours without result.)

ClearAll["Global`*"]

q1A = (1 - p1A - β + p1B β + α (-1 + p2A + β - p2B β))/((-1 + α^2) (-1 + β^2));
q1B = (1 - p1B - β + p1A β + α (-1 + p2B + β - p2A β))/((-1 + α^2) (-1 + β^2));
q2A = (1 - p2A - β + p2B β + α (-1 + p1A + β - p1B β))/((-1 + α^2) (-1 + β^2));
q2B = (1 - p2B - β + p2A β + α (-1 + p1B + β - p1A β))/((-1 + α^2) (-1 + β^2));

f1 = Simplify[(1 - ϕA)*p1A*q1A + (1 - ϕB)*p1B*q1B];
f2 = Simplify[(1 - ϕA)*p2A*q2A + (1 - ϕB)*p2B*q2B];

{{p1As, p1Bs, p2As, p2Bs}} = 
  {p1A, p1B, p2A, p2B} /. 
    Simplify[
      Solve[
        {D[f1, p1A] == 0, D[f1, p1B] == 0, D[f2, p2A] == 0, D[f2, p2B] == 0}, 
        {p1A, p1B, p2A, p2B}]];

{q1As, q1Bs, q2As, q2Bs} = 
  Simplify[
     {q1A, q1B, q2A, q2B} /. {p1A -> p1As, p1B -> p1Bs, p2A -> p2As, p2B -> p2Bs}];

gA = Simplify[ϕA*(p1As*q1As + p2As*q2As)];
gB = Simplify[ϕB*(p1Bs*q1Bs + p2Bs*q2Bs)];

Problematic command

 Simplify[Solve[{D[gA, ϕA] == 0, D[gB, ϕB] == 0}, {ϕA, ϕB}]]

Alternative command with additional restrictions

Simplify[
  Solve[{D[gA, ϕA] == 0, D[gB, ϕB] == 0, ϕA == ϕB, ϕA > 0, ϕA < 1}, {ϕA, ϕB}]]

Solution for parameter values $\alpha=1/2$ and $\beta=1/2$

gA2 = Simplify[gA /. {α -> 1/2, β -> 1/2}];
gB2 = Simplify[gB /. {α -> 1/2, β -> 1/2}];

Simplify[
  Solve[{D[gA2, ϕA] == 0, D[gB2, ϕB] == 0, ϕA == ϕB, ϕA > 0, ϕA < 1}, {ϕA, ϕB}]]

Proposed Solution for general α and β

ϕAsol = ((2 - α) (1 - β^2))/(2 - α (1 + β));
Simplify[ϕAsol /. {α -> 1/2, β -> 1/2}]

Solve gives a solution for specific parameter values. For instance, $\alpha=1/2$ and $\beta=1/2$. However, if I do not specify parameter values for $\alpha$ and $\beta$ the command does not deliver a solution (I did let it calculate for several hours without result.)

Source Link
Frank
  • 23
  • 3

Solving a system of nonlinear equations with parameters

I try to solve a system of two nonlinear first-order conditions for the variables $\phi_{A}$ and $\phi_{B}$ with two parameters $\alpha, \beta \in (0,1)$. Please see example code below. I am looking for symmetric solutions for $\phi_{A}$ and $\phi_{B}$, which lies between $0$ and $1$, given it exists.


ClearAll["Global`*"]

q1A = (1 - p1A - \[Beta] + 
   p1B \[Beta] + \[Alpha] (-1 + p2A + \[Beta] - 
      p2B \[Beta]))/((-1 + \[Alpha]^2) (-1 + \[Beta]^2));
q1B = (1 - p1B - \[Beta] + 
   p1A \[Beta] + \[Alpha] (-1 + p2B + \[Beta] - 
      p2A \[Beta]))/((-1 + \[Alpha]^2) (-1 + \[Beta]^2));
q2A = (1 - p2A - \[Beta] + 
   p2B \[Beta] + \[Alpha] (-1 + p1A + \[Beta] - 
      p1B \[Beta]))/((-1 + \[Alpha]^2) (-1 + \[Beta]^2));
q2B = (1 - p2B - \[Beta] + 
   p2A \[Beta] + \[Alpha] (-1 + p1B + \[Beta] - 
      p1A \[Beta]))/((-1 + \[Alpha]^2) (-1 + \[Beta]^2));

f1 = Simplify[(1 - \[Phi]A)*p1A*q1A + (1 - \[Phi]B)*p1B*q1B];
f2 = Simplify[(1 - \[Phi]A)*p2A*q2A + (1 - \[Phi]B)*p2B*q2B];

{{p1As, p1Bs, p2As, p2Bs}} = {p1A, p1B, p2A, p2B} /. 
   Simplify[Solve[{D[f1, p1A] == 0, D[f1, p1B] == 0, D[f2, p2A] == 0, 
      D[f2, p2B] == 0}, {p1A, p1B, p2A, p2B}]];

{q1As, q1Bs, q2As, q2Bs} = 
  Simplify[{q1A, q1B, q2A, q2B} /. {p1A -> p1As, p1B -> p1Bs, p2A -> p2As, 
     p2B -> p2Bs}];

gA = Simplify[\[Phi]A*(p1As*q1As + p2As*q2As)];
gB = Simplify[\[Phi]B*(p1Bs*q1Bs + p2Bs*q2Bs)];

"Problematic" command

 Simplify[Solve[{D[gA, \[Phi]A] == 0, 
   D[gB, \[Phi]B] == 0}, {\[Phi]A, \[Phi]B}]]

Alternative command with additional restrictions

Simplify[Solve[{D[gA, \[Phi]A] == 0, 
   D[gB, \[Phi]B] == 0, \[Phi]A == \[Phi]B, \[Phi]A > 0, \[Phi]A < 
    1}, {\[Phi]A, \[Phi]B}]]

Solution for parameter values $\alpha=1/2$ and $\beta=1/2$


gA2 = Simplify[gA /. {\[Alpha] -> 1/2, \[Beta] -> 1/2}];
gB2 = Simplify[gB /. {\[Alpha] -> 1/2, \[Beta] -> 1/2}];

Simplify[Solve[{D[gA2, \[Phi]A] == 0, 
   D[gB2, \[Phi]B] == 0, \[Phi]A == \[Phi]B, \[Phi]A > 0, \[Phi]A < 
    1}, {\[Phi]A, \[Phi]B}]]

Proposed Solution for general \[Alpha] and \[Beta]

\[Phi]Asol = ((2 - \[Alpha]) (1 - \[Beta]^2))/(2 - \[Alpha] (1 + \[Beta]));

Simplify[\[Phi]Asol /. {\[Alpha] -> 1/2, \[Beta] -> 1/2}]

The command Solve gives a solution for specific parameter values, for instance, $\alpha=1/2$ and $\beta=1/2$. However, if I do not specify parameter values for $\alpha$ and $\beta$ the command does not deliver a solution (I did let it calculate for several hours without result.)

I know that the solution that I am looking for should be $$\phi_A=\phi_B=\frac{\left(2-\alpha\right)\left(1+\beta^{2}\right)}{2-\alpha\left(1+\beta\right)},$$

but unfortunately I cannot receive this result in the above example. Any help is highly appreciated. Thanks in advance. I am new to mathematica and this is my first question on Mathematica StackExchange.