Taking only the positive sqrt in Mathematica

  • Context: Mathematica 
  • Thread starter Thread starter Sagekilla
  • Start date Start date
  • Tags Tags
    Mathematica Positive
Click For Summary
SUMMARY

The discussion focuses on obtaining only the positive square root in Mathematica during the normalization of a wave function. The user employs the integration function to evaluate J = Integrate[Psi[x]^2, {x, 0, a}] and solves for A, resulting in A = {-1/sqrt(2), 1/sqrt(2)}. To filter out the negative square root, the user suggests using DeleteCases[A, x_/; x < 0], which effectively removes negative values from the solution set.

PREREQUISITES
  • Familiarity with Mathematica syntax and functions
  • Understanding of wave function normalization in quantum mechanics
  • Knowledge of symbolic computation and manipulation in Mathematica
  • Basic concepts of square roots and their properties
NEXT STEPS
  • Explore the use of Conditional Expressions in Mathematica for more complex filtering
  • Learn about the Integrate function in Mathematica for different types of integrals
  • Investigate the Solve function and its options for handling multiple solutions
  • Study the implications of wave function normalization in quantum mechanics
USEFUL FOR

This discussion is beneficial for physicists, mathematicians, and researchers utilizing Mathematica for quantum mechanics calculations, particularly those focused on wave function normalization and symbolic computation.

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.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K