TransWikia.com

How can I get rid of Abs?

Mathematica Asked by Mojtaba Rezaee on September 25, 2020

In the following code, the functions WP[t] and WS[t] are real. Time also is a positive parameter. As you can see, MATHEMATICA enters Abs in the calculations. Including Abs only complicates the next parameters and calculations that cause the program to not run. In order not to complicate the calculations, how should I correct the code so that MATHEMATICA does not include Abs in the calculations??

m = {{0, WP[t], 0}, {WP[t], 0, WS[t]}, {0, WS[t], 0}};
q = Eigenvectors[m];
p1 = Normalize[q[[1]]]
p2 = Normalize[q[[2]]]
p3 = Normalize[q[[3]]]


{-(WS[t]/(Sqrt[1 + Abs[WS[t]/WP[t]]^2] WP[t])), 0, 1/Sqrt[
 1 + Abs[WS[t]/WP[t]]^2]}

{WP[t]/(Sqrt[1 + Abs[WP[t]/WS[t]]^2 + Abs[Sqrt[WP[t]^2 + WS[t]^2]/WS[t]]^2]*WS[t]), 
-(Sqrt[WP[t]^2 + WS[t]^2]/(Sqrt[1 + Abs[WP[t]/WS[t]]^2 + 
   Abs[Sqrt[WP[t]^2 + WS[t]^2]/WS[t]]^2]*WS[t])), 
  1/Sqrt[1 + Abs[WP[t]/WS[t]]^2 + Abs[Sqrt[WP[t]^2 + WS[t]^2]/WS[t]]^2]}


 {WP[t]/(Sqrt[1 + Abs[WP[t]/WS[t]]^2 + Abs[Sqrt[WP[t]^2 + WS[t]^2]/WS[t]]^2]*WS[t]), 
   Sqrt[WP[t]^2 + WS[t]^2]/
   (Sqrt[1 + Abs[WP[t]/WS[t]]^2 + Abs[Sqrt[WP[t]^2 + WS[t]^2]/WS[t]]^2]*WS[t]), 
   1/Sqrt[1 + Abs[WP[t]/WS[t]]^2 + Abs[Sqrt[WP[t]^2 + WS[t]^2]/WS[t]]^2]}

One Answer

Add /. Abs -> RealAbs // Simplify at the end of every line.

m = {{0, WP[t], 0}, {WP[t], 0, WS[t]}, {0, WS[t], 0}};
q = Eigenvectors[m];
p1 = Normalize[q[[1]]] /. Abs -> RealAbs // Simplify
p2 = Normalize[q[[2]]] /. Abs -> RealAbs // Simplify
p3 = Normalize[q[[3]]] /. Abs -> RealAbs // Simplify

{-(WS[t]/(Sqrt[1 + Abs[WS[t]/WP[t]]^2] WP[t])), 0, 
   1/Sqrt[1 + Abs[WS[t]/WP[t]]^2]} /. Abs -> RealAbs // Simplify

{WP[t]/(Sqrt[
       1 + Abs[WP[t]/WS[t]]^2 + Abs[Sqrt[WP[t]^2 + WS[t]^2]/WS[t]]^2]*
      WS[t]), -(Sqrt[
       WP[t]^2 + 
        WS[t]^2]/(Sqrt[
         1 + Abs[WP[t]/WS[t]]^2 + 
          Abs[Sqrt[WP[t]^2 + WS[t]^2]/WS[t]]^2]*WS[t])), 
   1/Sqrt[1 + Abs[WP[t]/WS[t]]^2 + 
      Abs[Sqrt[WP[t]^2 + WS[t]^2]/WS[t]]^2]} /. 
  Abs -> RealAbs // Simplify


{WP[t]/(Sqrt[
       1 + Abs[WP[t]/WS[t]]^2 + Abs[Sqrt[WP[t]^2 + WS[t]^2]/WS[t]]^2]*
      WS[t]), Sqrt[
     WP[t]^2 + 
      WS[t]^2]/(Sqrt[
       1 + Abs[WP[t]/WS[t]]^2 + Abs[Sqrt[WP[t]^2 + WS[t]^2]/WS[t]]^2]*
      WS[t]), 1/
    Sqrt[1 + Abs[WP[t]/WS[t]]^2 + 
      Abs[Sqrt[WP[t]^2 + WS[t]^2]/WS[t]]^2]} /. 
  Abs -> RealAbs // Simplify

Answered by cvgmt on September 25, 2020

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