Taking only the positive sqrt in Mathematica

  • Context: Mathematica 
  • Thread starter Thread starter Sagekilla
  • Start date Start date
  • Tags Tags
    Mathematica Positive
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 4K views
Sagekilla
Messages
18
Reaction score
0
As my title says, I need to take only the positive square root of some evaluation. For my calculation, the negative square root is extraneous.

What I do is a normalization of a wave function:

Code:
J = Integrate[Psi[x]^2, {x, 0, a}]
sol = Solve[J == 1, A]
A /. sol
My only problem is those above expression will give me A = {-1/sqrt(2), 1/sqrt(2)}.

How can I force Mathematica to only give me positive square root?
 
Physics news on Phys.org
Code:
DeleteCases[A,x_/;x<0]

This will ofc only work with expressions mathematica can evaluate numerically or knows to be positive or negative.