-1

Given:

a = b ln [ max (11, b) ]

If a is known, how can one compute b? (Do I need to use an iterative approximation method?)

bestrong
  • 151
  • 10
  • Your question is not clear. What do you mean by "iteration"? Which algorithm are you using (there are many that use iteration)? – Rory Daulton Nov 30 '17 at 14:16
  • @RoryDaulton: The question is clear, how one can obtain b, whether an iteration technique is required or not at all. "Which algorithm I'm using" -- I think you are just asking again my question. That's why I was asking, which iteration I needs (whether I need or not, previously I don't know) – bestrong Nov 30 '17 at 14:40
  • I don't know why people voted down. Guys, I think my question is totally clear, how b can be calculated. Previously, I wrote, which iteration one requires. If you guys think, that one does not need iteration for this problem, just answer like that and let me know how it is. I just assumed previously that one needs iteration for this problem. If you think that this is an useful question, just leave this page. – bestrong Nov 30 '17 at 14:45

2 Answers2

2

If a / ln(11) <= 11, then this is your solution and you don't need any iteration. Otherwise solve b * ln(b) - a = 0 e.g. with Newton-Raphson.

Henrik
  • 23,186
  • 6
  • 42
  • 92
1

Here is a graph of your function, where we have x and y rather than b and a.

enter image description here

Note that there is a "corner" at the point (11, 11 ln(11)). This is because your function can be re-written as:

a = b ln 11 if b <= 11
    b ln b  if b > 11

(I wish I could MathJax here as in some other StackExchange sites!)

Note that the solution to the second version is b = exp(W(a)) where W() is the Lambert W function. Many programming languages have packages that implement the Lambert W function. In Python, for example, the common scipy package calls it lambertw().

So a full solution in Python, after importing the lambertw function from the scipy module and exp and log (equivalent to ln) from the math module, is

b = (a / log(11) if a <= 11 * log(11)
        else exp(lambertw(a)))

This is easier than reinventing the wheel. Note that scipy's lambertw function uses continued fractions to get an approximate value then uses one or two rounds of the Newton-Raphson method to get a final result. This is faster than using only Newton-Raphson.

Rory Daulton
  • 21,934
  • 6
  • 42
  • 50