# How to solve this nonlinear 2 by 2 equations?

I have a equation (x^2 + q1^2 - y^2)/2*(x + q1 - y) + (1 - 2*a)*q + 2*F = 2*(1 - a)*c[q] in q(variable) with parameters q1,a,F and function c(in variable q also, and I define it outside Solve so I can change it easier), when q=x,y the equation will be satisfied. I am new to mathematica, and not sure whether I define c in right way, whether I write my question in correct code. Any suggestion will be appreciated! Thanks in advance.

a = 0.25
F = 0.015641
q1 = 5.3415
c[b_] = ln[b + 1]
Solve[{(x^2 + q1^2 - y^2)/2*(x + q1 - y) + (1 - 2*a)*x + 2*F -
2*(1 - a)*c[x] ==
0 && (x^2 + q1^2 - y^2)/2*(x + q1 - y) + (1 - 2*a)*y + 2*F -
2*(1 - a)*c[y] == 0}, {x, y}]


and the output is:

Solve::inex: Solve was unable to solve the system with inexact coefficients or the system
obtained by direct rationalization of inexact numbers present in the system. Since many of
the methods used by Solve require exact input, providing Solve with an exact version of
the system may help. >>
Solve[{0.031282 + 0.5 x +
1/2 (5.3415 + x - y) (28.5316 + x^2 - y^2) - 1.5 ln[1 + x] == 0 &&
0.031282 + 0.5 y + 1/2 (5.3415 + x - y) (28.5316 + x^2 - y^2) -
1.5 ln[1 + y] == 0}, {x, y}]


I do not understand the above paragraph, and what are inexact coefficients?

• a = 0.25;F = 0.015641;q1 = 5.3415;c[b_] := Log[b + 1];eqs = {(x^2 + q1^2 - y^2)/2*(x + q1 - y) + (1 - 2*a)*x + 2*F - 2*(1 - a)*c[x] <= 0, (x^2 + q1^2 - y^2)/2*(x + q1 - y) + (1 - 2*a)*y + 2*F - 2*(1 - a)*c[y] <= 0}; RegionPlot[eqs, {x, -2, 15}, {y, -5, 15}] – Dr. belisarius Jun 28 '14 at 5:11
• @belisarius,hi thanks for your reply, but nothing was draw on the plot; why we use <= instead of "==" ? And I guess I should use Log[e,b+1] if I want to ues base e instead of 10? – Bob Jun 28 '14 at 5:18
• 'Log" is the natural logarithm and your function 'ln' is not defined unless you have defined it somewhere else in the notebook. @belisarius wants to show you the regions these two equation are covering giving you a suggestion where the solution, if any, might lie. – Matariki Jun 28 '14 at 5:39

This is a way to perhaps get approximate solutions and perhaps refine numerically.

Using setup:

     a = 0.25
F = 0.015641
q1 = 5.3415
c[b_] :=Log[b+1]


Then

f[x_, y_] := (x^2 + q1^2 - y^2)/2*(x + q1 - y) + (1 - 2*a)*x + 2*F -
2*(1 - a)*c[x]
g[x_, y_] := (x^2 + q1^2 - y^2)/2*(x + q1 - y) + (1 - 2*a)*y + 2*F -
2*(1 - a)*c[y]
p1 = Plot3D[f[x, y],
{x, -1, 2}, {y, 5, 6}, MeshFunctions -> {#3 &, g[#1, #2] &},
Mesh -> {{0}, {0}},
MeshStyle -> {Black, {Red, Thick}},
PlotLabel -> HoldForm[f[x, y]]];
p2 = Plot3D[g[x, y],
{x, -1, 2}, {y, 5, 6}, MeshFunctions -> {#3 &, f[#1, #2] &},
Mesh -> {{0}, {0}},
MeshStyle -> {Black, {Red, Thick}}, PlotLabel -> HoldForm[g[x, y]]]
cp = GraphicsRow[{p1, p2}, ImageSize -> 600]
plt = Plot3D[g[x, y] - f[x, y], {x, -1, 2}, {y, 5, 6},
MeshFunctions -> {#3 &, f[#1, #2] &, g[#1, #2] &},
Mesh -> {{0}, {0}, {0}}, MeshStyle -> {Red, Blue, Green},
PlotPoints -> 100, PlotLabel -> HoldForm[g[x, y] - f[x, y]]]


The plots:  In the top plots the zeros of the other function is superimposed in red. In the bottom plot the line of z=0 is in red. I arrived at the region after plotting larger ranges.

Now extracting the approximate solutions:

pts = plt[[1, 1]];
lines = Cases[pl, Line[x__] :> x, Infinity];
ans = Grid[Partition[Graphics3D /@ (Line[pts[[#]]] & /@ lines), 3]]
sol = Intersection[pts[[lines[]]], pts[[lines[]]]] Approximate solutions:

{{0.070586, 5.46582, 0.}, {0.13275, 5.26307, 0.}}

• Seems you forgot to include the a = 0.25; F = 0.015641; q1 = 5.3415; c[b_] := Log[b + 1]; part. It only matters because the OP has defined c[b_] wrong. – Dr. belisarius Jun 28 '14 at 13:36
• Hi, thanks for your help! But I guess I did not express my question clearly. I guess your approximate solutions are 2 pairs of (x,y,0)? But what I am seeking is just one x one y, maybe I should not use x,y but use q1,q2 because in my model, there is a variable q, and q1,q2 are just where two graphs intersects, thus the equation agrees and this equation involves q1,q2. – Bob Jun 28 '14 at 13:52
• @belisarius...I corrected c but when I have time will add the setup...off to sleep now – ubpdqn Jun 28 '14 at 14:28