13

Mathematica used to be easily able to solve an equation like this:

Reduce[Log[Sqrt[k p]/Log[k]] == 0, p]

(I can easily do it myself, at least I can find the solution p = log(k)^2/k.)

Now in Mathematica 12, all I get is Reduce::nsmet: This system cannot be solved with the methods available to Reduce.

I thought it might be an issue with assumptions, so I tried assuming both k and p were sufficiently large, but it didn't help.

Is there a way to get Mathematica 12 to produce useful output on the problem above?

user64494
  • 26,149
  • 4
  • 27
  • 56
Thomas Ahle
  • 503
  • 3
  • 8
  • 1
    Works fine with Solve instead of Reduce. A simpler version of this problem is Reduce[Sqrt[a x] == b, x], which shows how hard this problem is in all generality. – Roman Jun 10 '19 at 13:01
  • Fwiw I don't think this is particular to V12. I tried on 11.3 and it gave up there too. – 1110101001 Jun 11 '19 at 03:03
  • I still keep my version 9.0.1 although I also have the newest version, but in a way 9.0.1 is the last really stable version. – Yukterez Jun 11 '19 at 03:54
  • 1
    Please do not use the [tag:bugs] tag when posting new questions. See the tag description for why. – Szabolcs Jun 11 '19 at 06:40
  • @Roman my version of Mathematica is able to solve Sqrt[a x] == b using Reduce, though it does complain about the solution containing the "unsolved equation" 0 == b - Sqrt[b^2] as an assumption. – Thomas Ahle Jun 16 '19 at 11:09
  • @ThomasAhle that was my point: it is able to reduce the equation, but complains as you say, and the solution is surprisingly complicated: (b == 0 && a == 0) || (a != 0 && 0 == b - Sqrt[b^2] && x == b^2/a) – Roman Jun 17 '19 at 06:06

1 Answers1

18

Working only in the real numbers could be a solution:

Reduce[Log[Sqrt[k p]/Log[k]] == 0, p, Reals]
(*    k > 1 && p == Log[k]^2/k    *)

I think the branch cuts of the square root make this problem difficult to solve in all complex generality ($k\in\mathbb{C}$). Maybe previous versions of Mathematica were a bit less careful with these branch cuts? From what I hear there has been a lot of work done in Mathematica recently on how to deal with branch cuts.

The given solution $p=\frac{\ln^2k}{k}$ is actually valid for any $\lvert k\rvert>1$, not just for the positive real $k>1$:

ComplexPlot3D[Log[Sqrt[k p]/Log[k]] /. p -> Log[k]^2/k,
  {k, -2 - 2 I, 2 + 2 I}, PlotRange -> All, Exclusions -> None]

enter image description here

I guess it would still be nice to find a way to solve/reduce this equation that returns a solution like Abs[k] > 1 && p == Log[k]^2/k to show the most general solution.

Roman
  • 47,322
  • 2
  • 55
  • 121
  • 1
    Interestingly, while your answer works; Reduce[Log[Sqrt[k p]/Log[k]] == 0 && Element[{p, k}, Reals], p] does not. – Bob Hanlon Jun 10 '19 at 13:22
  • @BobHanlon Try p>0&&k>0 . The domain Reals means the variables and functions are assumed to be real. – Michael E2 Jun 10 '19 at 14:03
  • @Roman Doesn't the assumptions k > 0 && p > 0 imply that the variables aren't complex? Adding Reals to reduce does the trick though. Thanks! – Thomas Ahle Jun 10 '19 at 14:25
  • 3
    @ThomasAhle yes, but the term inside the logarithm can still be negative, thereby allowing for cuts. Restricting k > 1 avoids this scenario and Reduce returns a result. Try Reduce[Log[Sqrt[k p]/Log[k]] == 0 && k > 1 && p > 0, p]. – Greg Hurst Jun 10 '19 at 14:41
  • 1
    Also read the few lines in the docs starting here: https://reference.wolfram.com/language/ref/Reduce.html#26975. Using the domain spec of Reduce (its third argument) restricts all values of all function evaluations to be real. Implicitly this means Reduce[Log[Sqrt[k p]/Log[k]] == 0, p, Reals] is restricting to k > 1. – Greg Hurst Jun 10 '19 at 14:43