在 Mathematica 中求正平方根
我目前正在按照以下方式进行一些标准化:
J = Integrate[Psi[x, 0]^2, {x, 0, a}]
sol = Solve[J == 1, A]
A /. sol
对于这种类型的标准化,负平方根是无关的。这个计算的结果是:
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]}}
即使我尝试给它一个 Assuming[...] 或 Simplify[...],它仍然给我相同的结果:
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]}}
谁能告诉我我在这里做错了什么?
我在 Windows 7 64 位上运行 Mathematica 7。
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. The result of this calculation is:
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'm running Mathematica 7 on Windows 7 64-bit.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
ToRules
执行框内显示的操作:将方程(如Reduce
输出)转换为规则。对于您的情况:对于更复杂的情况,我经常发现在插入典型参数值后检查符号解的值很有用。当然,这并不是万无一失的,但如果您知道只有一个解决方案,那么这是一种简单而有效的方法:
ToRules
does what the box says: converts equations (as inReduce
output) to rules. In your case:For more complex cases, I have often found it useful to just check the value of the symbolic solutions after pluging in typical parameter values. This is not foolproof, of course, but if you know there is one and only one solution then it is a simple and efficient method:
Solve
不是这样工作的。您可以尝试使用Reduce
,例如,至少在一般情况下,将此输出转换为替换规则会有点棘手,因为
Reduce
可能使用任意多个逻辑连接词。在这种情况下,我们可以破解:Solve
doesn't work like this. You might tryReduce
, instead, e.g.It's then a little tricky to transform this output to replacement rules, at least in the general case, because
Reduce
might use arbitrary many logical connectives. In this case, we could just hack: