The Math Forum

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
James Waldby

Posts: 545
Registered: 1/27/11
Re: Floor of the log equation: s = (floor(log10(x))+1)*x -

Posted: May 20, 2013 12:23 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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]
> 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 closed-form solution giving x in terms of s may be difficult to find,
but if you can get some reasonably-close 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 <>,
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 Lambert-function examples,
solve [6] to get more accurate starting values of x before the search.


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.