3
$\begingroup$

I try to solve the following equation (or at least to find its approximation)

Reduce[n/(k*Log2[n - k]) == 6 && k > 0 && n > 0, {k, n}]

But it cannot be solved. Is there a method to solve it as n=f(k) (or k=f(n)) or approximate it?

$\endgroup$
1
  • $\begingroup$ Assuming that solutions exists in Reals, there should an additional condition: $n>k+1$ $\endgroup$ Apr 30, 2018 at 17:23

2 Answers 2

5
$\begingroup$

Make a substitution to simplify it, solve, substitute back and solve again:

Reduce[(n Log[2])/(k Log[-k + n]) == 6 && k > 0 && n > 0 /. n -> k u, k]
(*  u > 1 && k == 2^(u/6)/(-1 + u)  *)

% /. u -> n/k // Reduce
(*
k >= (E Log[2])/(3 2^(5/6)) &&
  (n == -((-k Log[2] + 6 k ProductLog[-1, -(Log[2]/(3 2^(5/6) k))])/Log[2]) || 
   n == -((-k Log[2] + 6 k ProductLog[-(Log[2]/(3 2^(5/6) k))]) / Log[2]))
*)

Plots:

p = Plot[{
    -((-k Log[2] + 6 k ProductLog[-1, -(Log[2]/(3 2^(5/6) k))])/Log[2]),
    -((-k Log[2] + 6 k ProductLog[-(Log[2]/(3 2^(5/6) k))])/Log[2])},
   {k, (E Log[2])/(3 2^(5/6)), 4}, PlotRange -> {0, 20}];

cp = ContourPlot[(n Log[2])/(k Log[-k + n]) == 6, {k, 0.3, 4}, {n, 0, 
    20}, PlotPoints -> {15, 50}, MaxRecursion -> 3, 
   ContourStyle -> {Cyan, AbsoluteThickness[4]}];

Show[cp, p]

Mathematica graphics

$\endgroup$
3
$\begingroup$

By Solve:

Solve[n/(k*Log2[n - k]) == 6, n]
(* {{n -> (k (Log[2] - 6 ProductLog[-(Log[2]/(3 2^(5/6) k))]))/Log[2]}} *)

If you assume k=3 then:

Reduce[n/(k*Log2[n - k]) == 6 && k > 0 && n > 0 && k == 3, n]
(*k == 3 && (n == (3 (Log[2] - 6 ProductLog[-(Log[2]/(9 2^(5/6)))]))/
Log[2] || 
n == (3 (Log[2] - 6 ProductLog[-1, -(Log[2]/(9 2^(5/6)))]))/Log[2]) *)

Another method:

In range 0 < k < 10 and 0 < n < 10:

m=50;(* Find 50 solution if exist ? *)
FindInstance[n/(k*Log2[n - k]) == 6 && k > 0 && n > 0 && 0 < k < 10 && 0 < n < 10, {k, n},Reals,m] // N// MatrixForm
(* {{k -> 0.449766, n -> 7.72727}, {k -> 0.444691, 
n -> 7.54545}, {k -> 0.480344, n -> 8.81818}, {k -> 0.485448, 
n -> 9.}, {k -> 0.406717, n -> 2.36364}, {k -> 0.375183, 
n -> 4.90909}, {k -> 0.352836, n -> 3.27273}, {k -> 0.360354, 
n -> 4.18182}, {k -> 0.395312, n -> 5.72727}, {k -> 0.470138, 
n -> 8.45455}, {k -> 0.442159, n -> 7.45455}, {k -> 0.419571, 
n -> 6.63636}, {k -> 0.400052, n -> 5.90909}, {k -> 0.390649, 
n -> 5.54545}, {k -> 0.353387, n -> 3.63636}, {k -> 0.417094, 
n -> 6.54545}, {k -> 0.357474, n -> 4.}, {k -> 0.422056, 
n -> 6.72727}, {k -> 0.498199, n -> 9.45455}, {k -> 0.412167, 
n -> 6.36364}, {k -> 0.459941, n -> 8.09091}, {k -> 0.424549, 
n -> 6.81818}, {k -> 0.49565, n -> 9.36364}, {k -> 0.352516, 
n -> 3.36364}, {k -> 0.439629, n -> 7.36364}, {k -> 0.503294, 
n -> 9.63636}, {k -> 0.4644, n -> 8.25}, {k -> 0.420399, 
n -> 6.66667}, {k -> 0.476091, n -> 8.66667}, {k -> 0.427257, 
n -> 6.91667}, {k -> 0.352582, n -> 3.33333}, {k -> 0.469075, 
n -> 8.41667}, {k -> 0.356316, n -> 3.91667}, {k -> 0.375357, 
n -> 4.91667}, {k -> 0.379255, n -> 5.08333}, {k -> 0.492463, 
n -> 9.25}, {k -> 0.3874, n -> 5.41667}, {k -> 0.411349, 
n -> 6.33333}, {k -> 0.45273, n -> 7.83333}, {k -> 0.391613, 
n -> 5.58333}, {k -> 0.35362, n -> 3.66667}, {k -> 0.373461, 
n -> 4.83333}, {k -> 0.462064, n -> 8.16667}, {k -> 0.471414, 
n -> 8.5}, {k -> 0.434163, n -> 7.16667}, {k -> 0.429555, 
n -> 7.}, {k -> 0.385326, n -> 5.33333}, {k -> 0.457394, 
n -> 8.}, {k -> 0.363065, n -> 4.33333}, {k -> 0.497137, 
n -> 9.41667}}*)

m=100;(*Find 100 solution if exist ? *)
FindInstance[n/(k*Log2[n - k]) == 6 && k > 0 && n > 0 && 0 < k < 10 && 0 < n < 10, {k, n},Reals,m] // N // MatrixForm


ContourPlot[n/(k*Log2[n - k]) == 6, {k, 0, 10}, {n, 0, 10}, 
PlotPoints -> 30, FrameLabel -> Automatic]

ContourPlot[n/(k*Log2[n - k]) == 6, {n, 0, 10}, {k, 0, 10}, 
PlotPoints -> 30, FrameLabel -> Automatic]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.