Take positive square root in Mathematica

Posted by Sagekilla on Stack Overflow See other posts from Stack Overflow or by Sagekilla
Published on 2010-05-27T23:54:31Z Indexed on 2010/05/28 7:51 UTC
Read the original article Hit count: 232

Filed under:

Hi all, I'm currently doing some normalization along the lines of:

J = Integrate[Psi[x, 0]^2, {x, 0, a}]
sol = Solve[J == 1, A]
A /. sol

For this type of normalization, the negative square root is extraneous. My results are:

In[49]:= J = Integrate[Psi[x, 0]^2, {x, 0, a}]
Out[49]= 2 A^2

In[68]:= sol =  Solve[J == 1, A]
Out[68]= {{A -> -(1/Sqrt[2])}, {A -> 1/Sqrt[2]}}

Even if I try giving it an Assuming[...] or Simplify[...], it still gives me the same results:

In[69]:= sol =  Assuming[A > 0, Solve[J == 1, A]]
Out[69]= {{A -> -(1/Sqrt[2])}, {A -> 1/Sqrt[2]}}

In[70]:= sol =  FullSimplify[Solve[J == 1, A], A > 0]
Out[70]= {{A -> -(1/Sqrt[2])}, {A -> 1/Sqrt[2]}}

Can anyone tell me what I'm doing wrong here? I'd much appreciate it!

If it helps any, I'm running Mathematica 7 on Windows 7 64-bit.

© Stack Overflow or respective owner

Related posts about mathematica