0
$\begingroup$

In Maple you can use {} inside the command in order to present the evaluation as x=... For instance, the command solve({x^2+2x+1=0}, {x}) generates {x=-1},{x=-1}.

So, I wonder if there is a way to say to Mathematica that I want to present the solution of an equation as x=...

$\endgroup$
1
  • 1
    $\begingroup$ Use Reduce, e.g., Reduce[x^2 + 2 x + 1 == 0, x] evaluates to x == -1 $\endgroup$
    – Bob Hanlon
    Commented Oct 30, 2015 at 12:30

1 Answer 1

3
$\begingroup$

How about:

HoldForm[Evaluate[Solve[x^2 + 2 x + 1 == 0]]] /. Rule -> Set
$\endgroup$
5
  • $\begingroup$ could you please give me an example? $\endgroup$
    – Yorgos
    Commented Oct 30, 2015 at 11:50
  • 3
    $\begingroup$ @Yorgos I don't understand what you are asking. Have you tried evaluating John's expression? It does exactly what you ask. $\endgroup$
    – MarcoB
    Commented Oct 30, 2015 at 12:08
  • $\begingroup$ Since I use Maple much more than Mathematica I used "enter" for evaluation, forgetting that in Mathematica you have to use "shift+enter" :P $\endgroup$
    – Yorgos
    Commented Oct 30, 2015 at 12:29
  • 1
    $\begingroup$ Or use ... /. Rule -> Equal if you prefer Wolframese. $\endgroup$
    – Michael E2
    Commented Oct 30, 2015 at 12:40
  • 1
    $\begingroup$ Yes, @Michael. If you do that, you don't need the evaluation control, so the expression becomes Solve[x^2 + 2 x + 1 == 0] /. Rule -> Equal. $\endgroup$
    – John Doty
    Commented Oct 30, 2015 at 12:56

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.