Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Taking only the positive sqrt in Mathematica

  1. May 27, 2010 #1
    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 (Text):
    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?
     
  2. jcsd
  3. May 27, 2010 #2
    Code (Text):
    DeleteCases[A,x_/;x<0]
    This will ofc only work with expressions mathematica can evaluate numerically or knows to be positive or negative.
     
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook




Loading...
Similar Threads for Taking positive sqrt Date
Mathematica Taking forever to plot Feb 27, 2018
Text position in matlab plot Oct 20, 2015
How long does it take to get good at matlab? Apr 24, 2015
Latex - tables taking up too much room May 24, 2012
Mathematica: Taking limits Apr 24, 2012