Message Boards Message Boards

0
|
524 Views
|
8 Replies
|
1 Total Likes
View groups...
Share
Share this post:

The Simplify function is not completely simplified

Posted 1 month ago

Hello,

In Mathematica,

FullSimplify[(Sqrt[1/a^2]  a  G  \[Pi]  u  Sqrt[a^2/(a^2 + 

\!\(\*SubsuperscriptBox[\(R\), \(1\), \(2\)]\))]  (Sqrt[a^2 + 

\!\(\*SubsuperscriptBox[\(R\), \(1\), \(2\)]\)] - Sqrt[a^2 + 

\!\(\*SubsuperscriptBox[\(R\), \(2\), \(2\)]\)]))/Sqrt[a^2 + 

\!\(\*SubsuperscriptBox[\(R\), \(2\), \(2\)]\)], Assumptions -> a > 0]

will produce

(a G \[Pi] u Sqrt[1/(a^2 + 
\!\(\*SubsuperscriptBox[\(R\), \(1\), \(2\)]\))] (Sqrt[a^2 + 
\!\(\*SubsuperscriptBox[\(R\), \(1\), \(2\)]\)] - Sqrt[a^2 + 
\!\(\*SubsuperscriptBox[\(R\), \(2\), \(2\)]\)]))/Sqrt[a^2 + 
\!\(\*SubsuperscriptBox[\(R\), \(2\), \(2\)]\)]

But

FullSimplify[(Sqrt[1/a^2] a G \[Pi] u Sqrt[a^2/(a^2 + 
\!\(\*SubsuperscriptBox[\(R\), \(1\), \(2\)]\))] (Sqrt[a^2 + 
\!\(\*SubsuperscriptBox[\(R\), \(1\), \(2\)]\)] - Sqrt[a^2 + 
\!\(\*SubsuperscriptBox[\(R\), \(2\), \(2\)]\)]))/Sqrt[a^2 + 
\!\(\*SubsuperscriptBox[\(R\), \(2\), \(2\)]\)], 
 Assumptions -> a > 0 && Subscript[R, 1] > 0]

will produce the right result

a G \[Pi] u (-(1/Sqrt[a^2 + 
\!\(\*SubsuperscriptBox[\(R\), \(1\), \(2\)]\)]) + 1/Sqrt[a^2 + 
\!\(\*SubsuperscriptBox[\(R\), \(2\), \(2\)]\)])

What is the reason?

enter image description here

POSTED BY: Zhenyu Zeng
8 Replies

The condition r1!=Sqrt[-1]a is not enough to allow the simplification; for example, r1 = 2 I a is also problematic:

expr0 = (Sqrt[1/a^2]    a    G    \[Pi]    u    Sqrt[
           a^2/(a^2 + 
\!\(\*SubsuperscriptBox[\(R\), \(1\), \(2\)]\))]   
    (Sqrt[a^2 + 
\!\(\*SubsuperscriptBox[\(R\), \(1\), \(2\)]\)] - Sqrt[a^2 + 
\!\(\*SubsuperscriptBox[\(R\), \(2\), \(2\)]\)]))/Sqrt[a^2 + 
\!\(\*SubsuperscriptBox[\(R\), \(2\), \(2\)]\)]
expr2 = FullSimplify[expr0, 
    Assumptions -> a > 0 && Subscript[R, 1] > 0]
{expr0, expr2} /. Subscript[R, 1] -> 2 I  a /. a -> 1 // Simplify
POSTED BY: Gianluca Gorni
Posted 1 month ago

Yes! I know now.

POSTED BY: Zhenyu Zeng

The two expressions are not equivalent if you allow R_1 to be complex:

expr1 = FullSimplify[(Sqrt[1/a^2]   a   G   \[Pi]   u   Sqrt[
      a^2/(a^2 + 
\!\(\*SubsuperscriptBox[\(R\), \(1\), \(2\)]\))]   (Sqrt[a^2 + 
\!\(\*SubsuperscriptBox[\(R\), \(1\), \(2\)]\)] - Sqrt[a^2 + 
\!\(\*SubsuperscriptBox[\(R\), \(2\), \(2\)]\)]))/Sqrt[a^2 + 
\!\(\*SubsuperscriptBox[\(R\), \(2\), \(2\)]\)], 
  Assumptions -> a > 0]
expr2 = FullSimplify[(Sqrt[1/a^2]   a   G   \[Pi]   u   Sqrt[
      a^2/(a^2 + 
\!\(\*SubsuperscriptBox[\(R\), \(1\), \(2\)]\))]   (Sqrt[a^2 + 
\!\(\*SubsuperscriptBox[\(R\), \(1\), \(2\)]\)] - Sqrt[a^2 + 
\!\(\*SubsuperscriptBox[\(R\), \(2\), \(2\)]\)]))/Sqrt[a^2 + 
\!\(\*SubsuperscriptBox[\(R\), \(2\), \(2\)]\)], 
  Assumptions -> a > 0 && Subscript[R, 1] > 0]
{expr1, expr2} /. {a -> 1, Subscript[R, 1] -> 2 I, 
   Subscript[R, 2] -> 1, G -> 1, u -> 1} // N

Here is a much simpler situation exhibiting the same behaviour:

expr1 = FullSimplify[Sqrt[1/r^2]  Sqrt[r^2]]
expr2 = FullSimplify[Sqrt[1/r^2]  Sqrt[r^2] , Assumptions -> r > 0]
{expr1, expr2} /. r -> I
POSTED BY: Gianluca Gorni
Posted 1 month ago

Thanks a lot.

POSTED BY: Zhenyu Zeng
Posted 1 month ago

If you do not tell Mathematica that variables are positive or real then it will often assume that variables may be complex. For your problem that may mean that you have zeros in denominators and multiplying by zero may give solutions that you will not accept. Telling it r1>0 or Element[r1,Reals] is enough to know that you do not have zero denominators. Telling it that r1!=Sqrt[-1]a is not enough for it to understand that.

POSTED BY: Bill Nelson
Posted 1 month ago

May you tell me why

Telling it that r1!=Sqrt[-1]a is not enough for it to understand that.

POSTED BY: Zhenyu Zeng
Posted 1 month ago

Do not know. The algorithm in FullSimplify may not include analysis of the code to handle NotEqual and specific single values for variables.

POSTED BY: Bill Nelson
Posted 1 month ago

Okay. I think it is a bug.

POSTED BY: Zhenyu Zeng
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract