1
$\begingroup$

I have seen a few posts about this (such as this one), but none solved my problem. As a silly example, suppose I want to solve (1-x)^n = 0, knowing that n > 1. I tried doing,

Assuming[n > 1, Solve[(1 - x)^n == 0, x]]

But, Mathematica goes a bit crazy and gives,

{x -> 1 - 0^(1/n)}

with a warning message. Now, the answer is technically correct I guess, but I would really just like to see x -> 1 of course. Note that Mathematica probably ignores the assumption, because, if I assume n < -1, then I get the same output anyway, although there really is no solution. Is there a way to make this work as expected?

$\endgroup$
4
  • 3
    $\begingroup$ How about Solve[(1 - x)^n == 0 && n > 1, x] ? $\endgroup$ – Nasser Jul 30 '19 at 12:56
  • $\begingroup$ Ok, that works, although I fail to see what was wrong with my attempt? Thanks anyway. $\endgroup$ – Patrick.B Jul 30 '19 at 13:00
  • 1
    $\begingroup$ Solve[] does not make use of $Assumptions, so Assuming[..] is effectively a no-op. $\endgroup$ – Michael E2 Jul 30 '19 at 13:35
  • $\begingroup$ You could also add a domain specification to Solve: Solve[(1-x)^n == 0, x, Reals]. $\endgroup$ – Carl Woll Jul 30 '19 at 19:46
1
$\begingroup$

Solve does not take the option Assumptions, consequently the Assuming construct has no affect on it. The constraint (n > 1) should be included within Solve and as an assumption when simplifying.

Solve[{(1 - x)^n == 0, n > 1}, x]

(* {{x -> ConditionalExpression[1, n > 1]}} *)

Simplify accepts Assumptions so you can simplify the output of Solve using either

Simplify[
 Solve[{(1 - x)^n == 0, n > 1}, x],
 Assumptions -> n > 1]

(* {{x -> 1}} *)

or

Simplify[Solve[{(1 - x)^n == 0, n > 1}, x], n > 1]

(* {{x -> 1}} *)

or

Assuming[n > 1, Solve[{(1 - x)^n == 0, n > 1}, x] // Simplify]

(* {{x -> 1}} *)
$\endgroup$
1
$\begingroup$

As suggested by Nasser, just try,

Solve[(1-x)^n && n > 1,x]

If you want to get rid of the Conditional expression which ensues, just apply Normal to the above expression.

$\endgroup$
1
  • $\begingroup$ Even $n>0$ works in the above. $\endgroup$ – user64494 Jul 30 '19 at 13:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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