How to obtain algebraic solution of the logarithmic equation

expression=-b n + Exp[t] lambda n
Solve[ expression == 0, t]

The output should be $$t=Ln \left(\frac{b}{lambda}\right)$$, but I get.

{{t -> ConditionalExpression[2 I \[Pi] C[1] + Log[b/lambda], 
    C[1] \[Element] Integers]}}

1 Answer 1


Tell Mathematica (Element[t,Reals]) what you are looking for (and change e^t to Exp[t] )

expression = -b  + Exp[t] lambda  
Solve[expression == 0, t, Reals]
{{t -> ConditionalExpression[Log[b/lambda], (b > 0 && lambda > 0) || (b < 0 && lambda < 0)]}}
  • $\begingroup$ what I posted is an MWE, it is not the real problem. In the real problem, I do not know the final answer. So, I can not tell Mathematica what I am looking for. My question would be then "If I do not know the solution of an equation, how to find this solution using Mathematica?" $\endgroup$
    – JuanMuñoz
    Commented Dec 11, 2020 at 14:08
  • $\begingroup$ What I meant is if you know you're looking for a real solution use Solve[…, Reals] $\endgroup$ Commented Dec 11, 2020 at 14:41
  • $\begingroup$ This response is simple and goes directly to the question that was asked. If it is not adequate, that indicates something amiss in the question. $\endgroup$ Commented Dec 11, 2020 at 14:46
  • $\begingroup$ @UlrichNeumann Right thanks you!!!! I wonder, how can I extract the solution and save it as a new variable x_new=Solve[ expression == 0, t] $\endgroup$
    – JuanMuñoz
    Commented Dec 11, 2020 at 15:09
  • $\begingroup$ @JuanMuñoz Perhaps ` tnew=(t /. sol)[[1, 1]]` as a workaround? $\endgroup$ Commented Dec 11, 2020 at 15:59

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.