TransWikia.com

When numbers plugged in - this expression evaluates to zero, but otherwise will not evaluate to zero

Mathematica Asked on January 12, 2021

I have the following code:

COV1 = {{a1,0},{0,a2}}; COV2 = {{b1,0},{0,b2}};
T = MatrixPower[MatrixPower[COV1,1/2],-1]*MatrixPower[MatrixPower[COV1,1/2]*COV2*MatrixPower[COV1,1/2],1/2]*MatrixPower[MatrixPower[COV1,1/2],-1];
Thalf = 1/2*{{1,0},{0,1}} + 1/2*T;
COV3 = Thalf*COV1*Transpose[Thalf]+{{0,t},{t,0}}
d1 = Sqrt[Tr[COV1 + COV2 - 2*MatrixPower[MatrixPower[COV1,1/2]*COV2*MatrixPower[COV1,1/2],1/2]]]
d2 =Sqrt[Tr[COV1 + COV3 - 2*MatrixPower[MatrixPower[COV1,1/2]*COV3*MatrixPower[COV1,1/2],1/2]]]*2
Simplify[d2 - d1]

When I plug in numbers such as

a1 = 5, a2 = 7, b1 = 9, b2 = 45

The last expression evaluates to zero. However when I leave everything as variable, the expresssion doesn’t reduce to zero. However, it should. What is going on?

My guess is I need to impose conditions like a1, a2, b1, b2 are strictly positive reals — but I don’t know how to do this.

Also I tried this powerExpand trick I found — it didn’t work (perhaps I used it incorrectly?)

One Answer

Since a1,a2,b1,b2 are all positive, we can substitute them with other numbers $x^2, y^2, z^2, w^2$.

FullSimplify[d2 - d1 /. {a1 -> x^2, a2 -> y^2, b1 -> z^2, b2 -> w^2},
 Element[{x,y,z,w}, PositiveReals]]

(* result: 0 *)

Correct answer by flinty on January 12, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP