Skip to main content
1 of 2
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.

Frank
  • 23
  • 3