image
Physics Forums Logo
image
image
* Register * Upgrade Blogs Library Staff Rules Mark Forums Read
image
image   image
image

Go Back   Physics Forums > Mathematics > General Math


Reply

image Solution to a puzzle Share It Thread Tools Search this Thread image
Old Jun19-09, 05:42 PM                  #1
qraal

qraal is Offline:
Posts: 252
Solution to a puzzle

Hi All

Is there a solution to the following?

y = x/ln(2x)

...solving for x.
  Reply With Quote
Old Jun19-09, 05:45 PM                  #2
arildno

arildno is Offline:
Posts: 9,771
Recognitions:
PF Contributor PF Contributor
Homework Helper Homework Helper
Science Advisor Science Advisor
Re: Solution to a puzzle

It is a trancendental equation; the best you can hope for is an arbitrarily accurate approximation to the inverse on some interval.
  Reply With Quote
Old Jun19-09, 05:45 PM                  #3
rock.freak667

rock.freak667 is Offline:
Posts: 2,759
Recognitions:
Homework Helper Homework Helper
Re: Solution to a puzzle

Originally Posted by qraal View Post
Hi All

Is there a solution to the following?

y = x/ln(2x)

...solving for x.
as in x/ln(2x) = 3, find x?
  Reply With Quote
Old Jun19-09, 06:09 PM                  #4
qraal

qraal is Offline:
Posts: 252
Re: Solution to a puzzle

Originally Posted by rock.freak667 View Post
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.
  Reply With Quote
Old Jun20-09, 03:01 PM                  #5
coomast

coomast is Offline:
Posts: 279
Re: Solution to a puzzle

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:

LaTeX Code: x_{n+1}=x_{n}+\\frac{ln(2x_{n})[yln(2x_n)-x_n]}{ln(2x_n)-1}

The problem is that the function

LaTeX Code: \\frac{x}{ln(2x)}

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
Attached Images
File Type: png PF_figure.png (17.5 KB, 7 views)
  Reply With Quote
Old Jun20-09, 03:37 PM                  #6
CRGreathouse

CRGreathouse is Offline:
Posts: 2,939
Recognitions:
Homework Helper Homework Helper
Science Advisor Science Advisor
Re: Solution to a puzzle

LaTeX Code: x=-\\operatorname{W}\\left(-\\frac{e^{-y}}{2}\\right)
where W is Lambert's W.

This can be solved fairly quickly compared to a general Newton's method based solution.
  Reply With Quote
Old Jun20-09, 03:58 PM                  #7
qraal

qraal is Offline:
Posts: 252
Re: Solution to a puzzle

Originally Posted by coomast View Post
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:

LaTeX Code: x_{n+1}=x_{n}+\\frac{ln(2x_{n})[yln(2x_n)-x_n]}{ln(2x_n)-1}

The problem is that the function

LaTeX Code: \\frac{x}{ln(2x)}

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.
  Reply With Quote
Old Jun20-09, 07:27 PM                  #8
coomast

coomast is Offline:
Posts: 279
Re: Solution to a puzzle

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

LaTeX Code: y(1)=\\frac{1}{ln(2)}

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

LaTeX Code: x=\\frac{e}{2}

and the y-value is here

LaTeX Code: y=\\frac{e}{2}

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:

LaTeX Code: x-ln(2x)=y

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
  Reply With Quote
Old Jun21-09, 04:40 AM       Last edited by uart; Jun21-09 at 06:10 AM..            #9
uart

uart is Offline:
Posts: 1,178
Re: Solution to a puzzle

Originally Posted by coomast View Post
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:

LaTeX Code: x-ln(2x)=y

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.

LaTeX Code: \\ln(2x) = x/y

LaTeX Code: 2x = e^{x/y}

LaTeX Code: 2x e^{-x/y} = 1

Now let LaTeX Code: z = -x/y .

LaTeX Code: -2y\\,z\\,e^{z} = 1

LaTeX Code:  z e^{z} = \\frac{-1}{2y}

So from the definition of the Lambert W function :

LaTeX Code:  z = W \\left( \\frac{-1}{2y} \\right)

and

LaTeX Code:  x = -y \\, W \\left( \\frac{-1}{2y} \\right)
  Reply With Quote
Old Jun21-09, 05:24 AM       Last edited by Дьявол; Jun21-09 at 08:20 AM..            #10
Дьявол

Дьявол is Offline:
Posts: 366
Blog Entries: 1
Re: Solution to a puzzle

LaTeX Code: y=\\frac{x}{ln(2x)}

LaTeX Code: y*ln(2x)=x

LaTeX Code: ln(2x)^y=lne^x

LaTeX Code: (2x)^y=e^x

LaTeX Code: x=\\frac{e^{\\frac{x}{y}}}{2}

LaTeX Code: 2=e^k

LaTeX Code: x=e^{\\frac{x-k*y}{y}}

LaTeX Code: lnx=\\frac{x-k*y}{y}

LaTeX Code: y*lnx=x-k*y

LaTeX Code: lnx^y-lne^x=-k*y

LaTeX Code: ln\\frac{x^y}{e^x}=-k*y

LaTeX Code: ln\\frac{x^y}{e^x}=ln(e^{k*y})^{-1}

LaTeX Code: \\frac{x^y}{e^x}=\\frac{1}{e^{k*y}}

LaTeX Code: x^y=z

LaTeX Code: e^x=e^{k*y}*z

LaTeX Code: x=z^{1/y}

LaTeX Code: x=k*y*ln(z)

k is constant ≈ 0.693147

z can be any number

This is what I came up with...
  Reply With Quote
Old Jun21-09, 06:23 AM                  #11
coomast

coomast is Offline:
Posts: 279
Re: Solution to a puzzle

Originally Posted by uart View Post
I think there is a mistake in that derivation of the Lambert-W solution. Here's how I would do it.

LaTeX Code: \\ln(2x) = x/y

LaTeX Code: 2x = e^{x/y}

LaTeX Code: 2x e^{-x/y} = 1

Now let LaTeX Code: z = -x/y .

LaTeX Code: -2y\\,z\\,e^{z} = 1

LaTeX Code:  z e^{z} = \\frac{-1}{2y}

So from the definition of the Lambert W function :

LaTeX Code:  z = W \\left( \\frac{-1}{2y} \\right)

and

LaTeX Code:  x = -y \\, W \\left( \\frac{-1}{2y} \\right)
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
  Reply With Quote
Old Jun21-09, 08:22 AM                  #12
Дьявол

Дьявол is Offline:
Posts: 366
Blog Entries: 1
Re: Solution to a puzzle

What do you think about my solution?
  Reply With Quote
Old Jun21-09, 10:25 AM       Last edited by uart; Jun21-09 at 10:44 AM..            #13
uart

uart is Offline:
Posts: 1,178
Re: Solution to a puzzle

Originally Posted by coomast View Post
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 :

LaTeX Code:  x_{k+1} = \\frac{ x_k^2 + y  e^{-x_k}} { 1 + x_k}


Edit. I temporarily forgot who was original poster in this thread. In the above I was wrongly referring to coomast as the OP. :o
Attached Images
File Type: png function.png (4.8 KB, 3 views)
  Reply With Quote
Old Jun21-09, 11:53 AM       Last edited by CRGreathouse; Jun21-09 at 12:15 PM..            #14
CRGreathouse

CRGreathouse is Offline:
Posts: 2,939
Recognitions:
Homework Helper Homework Helper
Science Advisor Science Advisor
Re: Solution to a puzzle

Originally Posted by coomast View Post
"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.
  Reply With Quote
Old Jun21-09, 04:01 PM                  #15
qraal

qraal is Offline:
Posts: 252
Re: Solution to a puzzle

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*
  Reply With Quote
Old Jun21-09, 07:45 PM                  #16
CRGreathouse

CRGreathouse is Offline:
Posts: 2,939
Recognitions:
Homework Helper Homework Helper
Science Advisor Science Advisor
Re: Solution to a puzzle

What are your numbers?
  Reply With Quote
image image
Reply
Thread Tools


Similar Threads for: Solution to a puzzle
Thread Thread Starter Forum Replies Last Post
The Solution To The Hardest Logic Puzzle Ever! gravenewworld Brain Teasers 13 Nov10-06 05:09 PM
Draft paper deriving a non-empty, stationary, axisymmetric solution solution of Einstein's Equations, based on the Lorentz Force Law Jay R. Yablon General Physics 15 Nov4-06 04:30 PM
Penrose: Before the Big Bang--Outrageous Solution to a Profound Cosmological Puzzle marcus Beyond the Standard Model 14 Sep28-06 06:52 PM
[SOLVED] Draft paper deriving a non-empty, stationary, axisymmetric solution solution Jay R. Yablon General Physics 16 Apr25-06 05:01 AM
Need solution to this puzzle zoich Brain Teasers 4 Jun15-05 02:57 AM

Powered by vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd. © 2009 Physics Forums
Sciam | physorgPhysorg.com Science News Partner
image
image   image