Solution to Puzzle: y = x/ln(2x)

  • Thread starter qraal
  • Start date
  • Tags
    Puzzle
In summary, the conversation discusses the solution to the equation y = x/ln(2x), specifically how to find the value of x when y is given. The equation is a transcendental equation and the best method for finding an approximate solution is through the use of Newton's method. There is also mention of using Lambert's W function, but there may be a mistake in the derivation. The conversation ends with a proposed solution using x=z^(1/y).
  • #1
qraal
790
3
Hi All

Is there a solution to the following?

y = x/ln(2x)

...solving for x.
 
Mathematics news on Phys.org
  • #2
It is a trancendental equation; the best you can hope for is an arbitrarily accurate approximation to the inverse on some interval.
 
  • #3
qraal said:
Hi All

Is there a solution to the following?

y = x/ln(2x)

...solving for x.

as in x/ln(2x) = 3, find x?
 
  • #4
rock.freak667 said:
as in x/ln(2x) = 3, find x?

Exactly. If I know y how do I find x?

Though the other poster is making me wonder if an approximate answer can be constructed using a Taylor series or some such.
 
  • #5
Hello qraal,

Using the method of Newton-Raphson will give you a fast approximate solution if you have a "good" starting value in the neighbourhood of the solution. The method can be found here:

http://en.wikipedia.org/wiki/Newton's_method

and is for your equation:

[tex]x_{n+1}=x_{n}+\frac{ln(2x_{n})[yln(2x_n)-x_n]}{ln(2x_n)-1}[/tex]

The problem is that the function

[tex]\frac{x}{ln(2x)}[/tex]

is diverging for x=0.5. For values smaller than 0.5 it is negative and for values larger than 0.5 it is positive. However for the positive values it has a minimum and thus two solutions if a y-value is given. So the initial value is best to be determined by plotting it.

As an example use rock.freak667 value of 3. This has two solutions, one in the neighbourhood of x=0.6 and one in the neighboorhood of x=8. These serve as starting values in the iterative scheme and give you very quickly the solutions. I have the following values: x=0.613444 and x=8.499444. I added also a graph of the function to clearify things. If you have any questions please post.

best regards,

coomast
 

Attachments

  • PF_figure.png
    PF_figure.png
    4.6 KB · Views: 395
  • #6
[tex]x=-\operatorname{W}\left(-\frac{e^{-y}}{2}\right)[/tex]
where W is Lambert's W.

This can be solved fairly quickly compared to a general Newton's method based solution.
 
  • #7
coomast said:
Hello qraal,

Using the method of Newton-Raphson will give you a fast approximate solution if you have a "good" starting value in the neighbourhood of the solution. The method can be found here:

http://en.wikipedia.org/wiki/Newton's_method

and is for your equation:

[tex]x_{n+1}=x_{n}+\frac{ln(2x_{n})[yln(2x_n)-x_n]}{ln(2x_n)-1}[/tex]

The problem is that the function

[tex]\frac{x}{ln(2x)}[/tex]

is diverging for x=0.5. For values smaller than 0.5 it is negative and for values larger than 0.5 it is positive. However for the positive values it has a minimum and thus two solutions if a y-value is given. So the initial value is best to be determined by plotting it.

As an example use rock.freak667 value of 3. This has two solutions, one in the neighbourhood of x=0.6 and one in the neighboorhood of x=8. These serve as starting values in the iterative scheme and give you very quickly the solutions. I have the following values: x=0.613444 and x=8.499444. I added also a graph of the function to clearify things. If you have any questions please post.

best regards,

coomast

Hi coomast

Thanks for the pointer to Newton's Method. Very useful!

To clarify the problem further, it's an approximate solution to the ratio of proper time versus co-ordinate time for a continuously accelerated starship's crew. Thus x > 1 in all cases I'm interested in.
 
  • #8
Hello qraal,

If the x-values are larger than 2 it has a unique solution. In case these can be between 1 an 2 as well you will have two solutions. This is clear from the picture and a substitution in the equation. Indeed, we have for x=1

[tex]y(1)=\frac{1}{ln(2)}[/tex]

whichis the same value for x=2. In between these a minimum exists for

[tex]x=\frac{e}{2}[/tex]

and the y-value is here

[tex]y=\frac{e}{2}[/tex]

So you must have y to be at least e/2 to have a solution. I would suggest to use a large initial value if you know that x>2 or y>1/ln(2) and in case y<1/ln(2) this large value will give one solution, the other can be obtained by setting the initial value to 1.05. Nice equation to study :-)

@CRGreathouse: I can't get to your expression with the function of Lambert. I get by rewritting this expression back to the original form the following:

[tex]x-ln(2x)=y[/tex]

I might be making a silly mistake, it's getting late over here and I'm a bit tired:-) Anyway to find the solution even with Lambert you will need an iterative scheme and Newton-Raphson seems the easiest here. Presumably it will give a similar formula as the one I gave. Or is there another one which is faster?

best regards,

coomast
 
  • #9
coomast said:
Hello qraal,
@CRGreathouse: I can't get to your expression with the function of Lambert. I get by rewritting this expression back to the original form the following:

[tex]x-ln(2x)=y[/tex]

I might be making a silly mistake, it's getting late over here and I'm a bit tired:-) Anyway to find the solution even with Lambert you will need an iterative scheme and Newton-Raphson seems the easiest here. Presumably it will give a similar formula as the one I gave. Or is there another one which is faster?

best regards,

coomast

I think there is a mistake in that derivation of the Lambert-W solution. Here's how I would do it.

[tex]\ln(2x) = x/y [/tex]

[tex]2x = e^{x/y}[/tex]

[tex]2x e^{-x/y} = 1[/tex]

Now let [itex]z = -x/y[/itex].

[tex]-2y\,z\,e^{z} = 1[/tex]

[tex] z e^{z} = \frac{-1}{2y}[/tex]

So from the definition of the Lambert W function :

[tex] z = W \left( \frac{-1}{2y} \right) [/tex]

and

[tex] x = -y \, W \left( \frac{-1}{2y} \right)[/tex]
 
Last edited:
  • #10
[tex]y=\frac{x}{ln(2x)}[/tex]

[tex]y*ln(2x)=x[/tex]

[tex]ln(2x)^y=lne^x[/tex]

[tex](2x)^y=e^x[/tex]

[tex]x=\frac{e^{\frac{x}{y}}}{2}[/tex]

[tex]2=e^k[/tex]

[tex]x=e^{\frac{x-k*y}{y}}[/tex]

[tex]lnx=\frac{x-k*y}{y}[/tex]

[tex]y*lnx=x-k*y[/tex]

[tex]lnx^y-lne^x=-k*y[/tex]

[tex]ln\frac{x^y}{e^x}=-k*y[/tex]

[tex]ln\frac{x^y}{e^x}=ln(e^{k*y})^{-1}[/tex]

[tex]\frac{x^y}{e^x}=\frac{1}{e^{k*y}}[/tex]

[tex]x^y=z[/tex]

[tex]e^x=e^{k*y}*z[/tex]

[tex]x=z^{1/y}[/tex]

[tex]x=k*y*ln(z)[/tex]

k is constant ≈ 0.693147

z can be any number

This is what I came up with...
 
Last edited:
  • #11
uart said:
I think there is a mistake in that derivation of the Lambert-W solution. Here's how I would do it.

[tex]\ln(2x) = x/y [/tex]

[tex]2x = e^{x/y}[/tex]

[tex]2x e^{-x/y} = 1[/tex]

Now let [itex]z = -x/y[/itex].

[tex]-2y\,z\,e^{z} = 1[/tex]

[tex] z e^{z} = \frac{-1}{2y}[/tex]

So from the definition of the Lambert W function :

[tex] z = W \left( \frac{-1}{2y} \right) [/tex]

and

[tex] x = -y \, W \left( \frac{-1}{2y} \right)[/tex]

This is the same result I had. Now the initial remark raised by CRGreathouse was:
"This can be solved fairly quickly compared to a general Newton's method based solution."
What is this other method? Using Newton-Raphson on the Lambert function gives in the end the same interative scheme as the one I proposed. I think the formula obtained is easy and fast enough to get to the solution. If another method is available I would like to learn it, it will be interesting.

best regards,

coomast
 
  • #12
What do you think about my solution?
 
  • #13
coomast said:
This is the same result I had. Now the initial remark raised by CRGreathouse was:
"This can be solved fairly quickly compared to a general Newton's method based solution."
What is this other method? Using Newton-Raphson on the Lambert function gives in the end the same interative scheme as the one I proposed. I think the formula obtained is easy and fast enough to get to the solution. If another method is available I would like to learn it, it will be interesting.

best regards,

coomast

Hi coomast. One obvious advantage of expressing solutions like this in terms of the Lambert W function is that many maths programs (eg Matlab Octave Maple etc) will already have that function implemented, which makes it nice and easy to get a quick plot for example. (see attachment)

Perhaps a bigger advantage however is that if we've already familiarized ourselves with some of the properties of the Lambert-W function then we can immediately deduce many properties of this new function with little effort.

For example, I already know (from past study of W) that W(x) has :
- no real solutions for {x<-1/e}
- one real solution for {x=-1/e} U {x>=0}
- two real solutions for {-1/e < x < 0}

I can then immediately apply this to your new function and work out where it has real solutions (and how many) with very little effort. This is where I think is the real merit lays in expressing the solution in terms of a know function (even if at the end of the day you still have to evaluate it with numerical methods).

BTW. If you apply Newtons method to the W function you can (with a bit of algebra) crunch it down to :

[tex] x_{k+1} = \frac{ x_k^2 + y e^{-x_k}} { 1 + x_k}[/tex]Edit. I temporarily forgot who was original poster in this thread. In the above I was wrongly referring to coomast as the OP. :eek:
 

Attachments

  • function.png
    function.png
    5.1 KB · Views: 424
Last edited:
  • #14
coomast said:
"This can be solved fairly quickly compared to a general Newton's method based solution."
What is this other method? Using Newton-Raphson on the Lambert function gives in the end the same interative scheme as the one I proposed. I think the formula obtained is easy and fast enough to get to the solution. If another method is available I would like to learn it, it will be interesting.

First of all, I certainly agree that your solution is "easy and fast enough". In fact it is *so* fast and *so* easy to implement that I felt the need to add an argument to support even mentioning a different method.

But the W function is sufficiently well-behaved (compared to general functions) that higher-order methods are reasonable. There are good implementations of W (along with good starting points, etc.) using Halley's method floating around the 'net. While any of these higher-order methods could in theory be applied to the problem directly, without caution you'll have convergence issues.

And since it is a general function, you may already have optimized code for W sitting around.
 
Last edited:
  • #15
Hi Guys

I can't get it to converge using Newton's Method. It comes close, but converges on an x value that gives a y that's too high by about 3%. *sigh*
 
  • #16
What are your numbers?
 
  • #17
CRGreathouse said:
What are your numbers?

My target y value is 210713.2394 and my starting x value is 3303361. I used Newton's Method, as per my Maths text and Wikipedia, i.e.

x1 = x0 - f(x0)/f '(x0)

...but it converged somewhere else.
 
  • #18
qraal said:
My target y value is 210713.2394 and my starting x value is 3303361. I used Newton's Method, as per my Maths text and Wikipedia, i.e.

x1 = x0 - f(x0)/f '(x0)

...but it converged somewhere else.

Ah! Discovered my mistake! I set up my initial equation incorrectly. To find x for a specific y* for x/ln(2x) I had to make f(x) = x/ln(2x) - y*, and then use Newton's method. D'Oh! It converged in three iterations to within the limits of accuracy I was using with those numbers.

Coomast, and all, thank you.
 
  • #19
Дьявол said:
[tex]y=\frac{x}{ln(2x)}[/tex]

...

[tex]2=e^k[/tex]

...

[tex]x^y=z[/tex]

...

[tex]x=k*y*ln(z)[/tex]

k is constant ≈ 0.693147

z can be any number

This is what I came up with...

Of course not.
 
  • #20
Kittel Knight said:
Of course not.

z can be any positive number :-)
 

FAQ: Solution to Puzzle: y = x/ln(2x)

What is the value of x when y = 0?

The value of x when y = 0 is approximately 0.72135.

How do you solve for x in this equation?

To solve for x in this equation, you can use algebraic manipulation and logarithmic properties to isolate x on one side of the equation. The final solution should be in terms of the natural logarithm function.

Can this equation have multiple solutions?

Yes, this equation can have multiple solutions. Depending on the given value of y, there can be either one or two real solutions for x.

What is the domain and range of this equation?

The domain of this equation is all real numbers greater than 0. The range of this equation is all real numbers.

Can this equation be solved without using logarithms?

No, this equation cannot be solved without using logarithms. The logarithm function is necessary to isolate x and find its value.

Similar threads

Replies
6
Views
997
Replies
11
Views
1K
Replies
21
Views
845
Replies
7
Views
1K
Replies
1
Views
2K
Replies
7
Views
1K
Replies
4
Views
1K
Replies
1
Views
906
Back
Top