Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


Math Forum
»
Discussions
»
sci.math.*
»
sci.math
Notice: We are no longer accepting new posts, but the forums will continue to be readable.
Topic:
Floor of the log equation: s = (floor(log10(x))+1)*x  round((10^(floor(log10(x))+1)10)/9)
Replies:
4
Last Post:
May 22, 2013 11:09 PM




Re: Floor of the log equation: s = (floor(log10(x))+1)*x  round((10^(floor(log10(x))+1)10)/9)
Posted:
May 20, 2013 12:23 PM


On Sun, 19 May 2013 11:20:13 0700, nepomucenocarlos68 wrote:
> Hi guys! I need your help to solve this equation: > > I need to find 'x' for a given 's'. Both of them are natural numbers (>0). > > I don't know how to handle the floor term. > > [octave/matlab format] > s = (floor(log10(x))+1)*x  round((10^(floor(log10(x))+1)10)/9); > > [or TeX} > s = \left( \lfloor\log(x)\rfloor+1 \right)x  \frac{10^{\lfloor\log(x)\rfloor+1}10}{9} > > [or image] > http://postimg.org/image/r5fd2enll/ > > > Exact or approximate values are good. > > Is there a solution? How do I solve it?
Your image and tex forms show log() in some cases where the octave/matlab form shows log10(); in following I ignore that inconsistency (which doesn't affect the method outlined) and write l() to stand for log to some base.
A closedform solution giving x in terms of s may be difficult to find, but if you can get some reasonablyclose estimates x1, x2 of x such that s is bounded by s(x1) and s(x2), then you can do a binary or other search to find an x0 with s = s(x0), or perhaps the range of x values that yield s. Anyhow, ignoring the floor and round functions and supposing logs are base 10, the expression may be like
s = x*l(x) + x  ( 10*10^l(x)  10 )/9 [5]
so s ~ x*l(x) + x  1.1*x  1.1 [6]
so s ~ x*l(x). [7]
According to <http://en.wikipedia.org/wiki/Lambert_W_function#Example_4>, approximation [7] is solved by
x = e^W(s*ln(10)) [8]
You could compute values of x(s) using [8] for a couple of values of s, and then search. Or via some of the other Lambertfunction examples, solve [6] to get more accurate starting values of x before the search.
 jiw



