0
$\begingroup$

Why does the following not work!

Expand[Evaluate[(Sqrt[(m1 - m2 - m3) (m1 + m2 - m3)]), 
   Assumptions -> {m1 > 0 && m2 > 0 && m3 > 0}]] //. 
 Thread[{{m1, m2} -> {a, b}}]

I want both replacement and expansion like: m1*m2... etc

Edited:

(Sqrt[(m1 - m2 - m3) (m1 + m2 - m3)]) // 
 ExpandAll //. Thread[{{m1, m2} -> {a, b}}]

Even this replacement does not work.

$\endgroup$
5
  • 2
    $\begingroup$ (1) You get a very clear error message. (2) You don't need any Evaluate. (3) What do you even want to get as a result? (4) Take a look at ExpandAll. $\endgroup$ Commented Mar 16 at 22:28
  • $\begingroup$ Read again what I need. It does not work even without "Evaluate". $\endgroup$ Commented Mar 16 at 22:30
  • 3
    $\begingroup$ Read again Domen's point (4), which is the solution to your problem, I believe. (None of the functions in your code use Assumptions, so there's no point in forcing it in there.) (5) You might want the last bit to be Thread[{m1, m2} -> {a, b}]. $\endgroup$ Commented Mar 16 at 23:09
  • $\begingroup$ And you should pay attention to the precedence. This can be checked by n-click a piece of code: i.sstatic.net/eAAHrUIv.png $\endgroup$ Commented Mar 17 at 1:04
  • $\begingroup$ @Domen that's work $\endgroup$ Commented Mar 17 at 8:17

1 Answer 1

1
$\begingroup$
FullSimplify[Evaluate[(Sqrt[(m1 - m2 - m3) (m1 + m2 - m3)]), 
   Assumptions -> {m1 > 0 && m2 > 0 && m3 > 0}]]

Is it good enough?

@Domen method also works as he presented it

enter image description here

$\endgroup$
2
  • 1
    $\begingroup$ 1. Assumptions doesn't have any effect here. 2. Evaluate doesn't have any effect here. 3. As mentioned above, please pay attention to the precedence, the rule Thread[{m1, m2} -> {a, b}] doesn't have effect here. $\endgroup$ Commented Mar 17 at 10:39
  • $\begingroup$ @xzczd agree with you $\endgroup$ Commented Mar 17 at 13:21

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.