Group Abstract Group Abstract

Message Boards Message Boards

Solve for transcendental curve x^y == y^x && x != y

GROUPS:
Sorry for this may seem stupid but how come whenever I type in
NSolve[x^y == z && y^x == z && x != y, {x, y, z}]
I get back
NSolve::nsmet: This system cannot be solved with the methods available to NSolve. >>
when i should get x=2,y=4,z=16. In english im trying to find what x and y are in x^y=y^x,y not equal to x.
POSTED BY: awalia2002
Answer
7 months ago
Reduce is more powerful than NSolve but doesn't get an answer either.
Reduce[x^y == y^x && x != y, {x, y}, Integers]
Reduce::nsmet: This system cannot be solved with the methods available to Reduce.
POSTED BY: Frank Kampas
Answer
7 months ago
You are dealing with a transcendental equation with infinitely many solutions, It can be seen easily all your solution points lie on a curve if you neglect x = y line:
cp = ContourPlot[x^y == y^x, {x, 0, 10}, {y, 0, 10}]



Now you can use this plot to extract numerical values of points {x,y} satisfying your equation with x!=y:
pts = Cases[cp, {x_, y_} /; x != y, Infinity][[1 ;; -1 ;; 25]]
{{1.36396, 10.}, {1.41051, 8.91051}, {1.46481, 7.85714}, {1.55516, 6.65912},
{1.65445, 5.71429}, {1.78033, 4.91071}, {1.99402, 4.01786}, {2.33117, 3.22403},
{9.85722, 1.37507}, {8.91051, 1.41051}, {7.81719, 1.46853}, {6.65912, 1.55516},
{5.75786, 1.65285}, {4.91071, 1.78033}, {3.97382, 2.00832}, {3.22403, 2.33117}}

They of course would land perfectly on the curve you need:
Show[cp, Graphics[{PointSize[Large], Red, Point[pts]}]]

POSTED BY: Sam Carrettie
Answer
7 months ago
This can actually be solved analytically. Consider the following. Your equation
x^y==y^x && x!=y

can actually be rewritten as
x^(1/x)==y^(1/y) && x!=y

So if we now solve equations
{x^(1/x)==t, y^(1/y)==t, x!=y}

as finding functions x(t) and y(t), we will parametrize your curve. For this let's that equation
Reduce[x^(1/x) == t && x > 0 && t > 0, x]

does have a beautiful simple solution
(t == 1 && x == 1) ||
(0 < t < 1 && x == E^-ProductLog[-Log[t]]) ||
(1 < t <= E^(1/E) && (
     x == E^-ProductLog[-1, -Log[t]] ||
     x == E^-ProductLog[-Log[t]]))

The same solution would go for y(t). There are two domains listed here:
0 < t < 1||1 < t <= E^(1/E)

and two functions:
E^-ProductLog[-Log[t]])||E^-ProductLog[-1, -Log[t]]

So it is obvious to avoid trivial parametric curve
x[t]==y[t]

We need to choose different functions for x(t) and y(t) in the same domain. You can see how exactly overlaps the numerical plot (green, thick) with analytic formula (red, dashed):
 Show[
 
  ParametricPlot[{
   {E^-ProductLog[-Log[t]], E^-ProductLog[-1, -Log[t]]},
   {E^-ProductLog[-1, -Log[t]], E^-ProductLog[-Log[t]]}},
  {t, 0, E^(1/E)}, PlotRange -> {{0, 7}, {0, 7}}, PlotStyle -> Directive[Thick, Dashed, Red]],
 
  ContourPlot[x^y == y^x, {x, 0, 10}, {y, 0, 10},
   ContourStyle -> Directive[Green, Thickness[.05], Opacity[.3]]]

]



From this it is obvious to deduce the final solution:
sol[x_] := Piecewise[{
  {E^-ProductLog[-1, -Log[x^(1/x)]], 0 < x < E},
  {E^-ProductLog[-Log[x^(1/x)]], E < x}}];

sol[x] // TraditionalForm


Plot[sol[x], {x, 0, 7}, AspectRatio -> Automatic, PlotRange -> {0, 7}]

POSTED BY: Vitaliy Kaurov
Answer
7 months ago
Thanks Vitaliy for your keen insight.

For the sake of clearness I think that in your 4th code insert you meant
Reduce[x^(1/x) == t && x > 0 && t > 0, x] // TraditionalForm
(i/o Reduce[y^(1/y) == x...)

Unfortunately this part of your code (in the 9th insert)
ParametricPlot[{
   {E^-ProductLog[-Log[t]], E^-ProductLog[-1, -Log[t]]},
   {E^-ProductLog[-1, -Log[t]], E^-ProductLog[-Log[t]]}},
  {t, 0, E^(1/E)}, PlotRange -> {{0, 7}, {0, 7}}, PlotStyle -> Directive[Thick, Dashed, Red]]
makes my Mathematica 9.0.1.0 to stop responding (or it goes into a "not responding" state for a very very long time) in my Windows 8.1 system and I can't do nothing but force close the program.
There must be probably something wrong in system and/or my settings ...
POSTED BY: Luca M
Answer
7 months ago
Thank you everyone i got it figured out, now i have another question, i forgot to mention i am new to mathemeticia, i got it yesterday.
how would I tell mathemeticia in NSolve[(x^2) + (y^2) == z^2] to only list natural numbers
POSTED BY: awalia2002
Answer
7 months ago
Interestingly enough, Wolfram|Alpha can solve for this! But only for lower branch. Just enter the following
x^y = y^x

POSTED BY: Sam Carrettie
Answer
7 months ago
Luca, thanks I fixed the code. With respect to ParametricPlot - try reopen Mathematica. It works perfectly fine on my Mac and M.9.0.1. If problem persists - try to find minimal example that breaks and post it as a separate question. Thanks!
POSTED BY: Vitaliy Kaurov
Answer
7 months ago
Use Reduce function to set a domain for the problem: 
 
In[6]:= Reduce[(x^2)+(y^2)==z^2,{x,y,z},Integers]
Out[6]= (C[1]|C[2]|C[3])\[Element]Integers&&C[3]>=0&&((x==C[1] (C[2]^2-C[3]^2)&&y==2 C[1] C[2] C[3]&&z==C[1] (C[2]^2+C[3]^2))||(x==2 C[1] C[2] C[3]&&y==C[1] (C[2]^2-C[3]^2)&&z==C[1] (C[2]^2+C[3]^2)))
POSTED BY: Shenghui Yang
Answer
7 months ago