简化 Mathematica 中的绝对值
形式的术语
Abs[-2 b + 2 d1 m + l Tan[\[Theta]]]
我目前有一个大型表达式,其中有许多我从问题的几何形状中知道的
-2 b + 2 d1 m + l Tan[\[Theta]] > 0
,但是,当我尝试简化我的表达式时,
Simplify[Abs[-2 b + 2 d1 m + l Tan[\[Theta]]], -2 b + 2 d1 m + l Tan[\[Theta]] > 0]
我只是回到
Abs[-2 b + 2 d1 m + l Tan[\[Theta]]]
如何使 Mathematica 简化不必要的绝对值?
编辑1
我试图简化的完整表达式是
-(1/(2 (m - Tan[\[Theta]])))
Sqrt[1 + m^2] (B2 Sqrt[(-2 b + 2 d1 m + l Tan[\[Theta]])^2] +
B4 Sqrt[(-2 b + 2 d2 m + l Tan[\[Theta]])^2] +
B5 Sqrt[(2 b + 2 d3 m + l Tan[\[Theta]])^2] +
B7 Sqrt[(2 b + 2 d4 m + l Tan[\[Theta]])^2] +
B1 Sqrt[(2 b - 2 (d1 + l) m + l Tan[\[Theta]])^2] +
B3 Sqrt[(2 b - 2 (d2 + l) m + l Tan[\[Theta]])^2] +
B6 Sqrt[(-2 (b + (d3 + l) m) + l Tan[\[Theta]])^2] +
B8 Sqrt[(-2 (b + (d4 + l) m) + l Tan[\[Theta]])^2])
每个根号下的平方项已知是正实数。
I currently have a large expression with many terms of the form
Abs[-2 b + 2 d1 m + l Tan[\[Theta]]]
I know, from the geometry of my problem, that
-2 b + 2 d1 m + l Tan[\[Theta]] > 0
However, when I try to simplify my expression,
Simplify[Abs[-2 b + 2 d1 m + l Tan[\[Theta]]], -2 b + 2 d1 m + l Tan[\[Theta]] > 0]
I just get back
Abs[-2 b + 2 d1 m + l Tan[\[Theta]]]
How can I make Mathematica simplify out the unnecessary absolute value?
EDIT 1
The full expression which I'm trying to simplify is
-(1/(2 (m - Tan[\[Theta]])))
Sqrt[1 + m^2] (B2 Sqrt[(-2 b + 2 d1 m + l Tan[\[Theta]])^2] +
B4 Sqrt[(-2 b + 2 d2 m + l Tan[\[Theta]])^2] +
B5 Sqrt[(2 b + 2 d3 m + l Tan[\[Theta]])^2] +
B7 Sqrt[(2 b + 2 d4 m + l Tan[\[Theta]])^2] +
B1 Sqrt[(2 b - 2 (d1 + l) m + l Tan[\[Theta]])^2] +
B3 Sqrt[(2 b - 2 (d2 + l) m + l Tan[\[Theta]])^2] +
B6 Sqrt[(-2 (b + (d3 + l) m) + l Tan[\[Theta]])^2] +
B8 Sqrt[(-2 (b + (d4 + l) m) + l Tan[\[Theta]])^2])
The terms being squared under each of the radicals is known to be a positive real number.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
由于已知这些项都是实数和正数,因此平方和取平方根只会得到相同的数字。因此,您可以执行类似的操作
,其中
expr
是上面的巨型表达式。Since the terms are all known to be real and positive, squaring and taking the square-root will only give you the same number. Hence, you could do something like
where
expr
is your giant expression above.这里有两个想法:
1)
2)
复杂度函数 f 使得 Abs 比 Times 更昂贵。请参阅文档以了解简化。这有帮助吗?
Here are two ideas:
1)
2)
Th complexity function f makes Abs more expensive than Times. See docu for Simplify. Does that help?
如果您只想删除绝对值的特定实例,您可以按照以下方式执行操作:
这样它只会从您指定的任何表达式中删除绝对值:
我将看看是否可以找到比这更好的解决方案。
If you only wish to remove specific instances of absolute value, you could do something along these lines:
That way it only removes the absolute value from any expressions you specify:
I'll see if I can find a nicer looking solution than this.
我经常被诸如
Abs[a]^2
之类的东西所刺激,而诸如使用Assuming
与a\[Element]Reals
之类的东西则不会。没有帮助。我在这里找到了一些帮助WolframMathWorld - 绝对平方与
ComplexExpand[Abs[a ]^2,目标函数-> {Conjugate}]
,但有时它仍然返回诸如Conjugate[Sqrt[a^2 + b^2]]
之类的内容,并且我发现包装了第二个ComplexExpand (不带参数)周围有帮助。
I'm constantly stimied by things like
Abs[a]^2
, and stuff like usingAssuming
witha\[Element]Reals
doesn't help.I found some help here WolframMathWorld - Absolute Square with
ComplexExpand[Abs[a]^2, TargetFunctions -> {Conjugate}]
, but sometimes it still returns stuff likeConjugate[Sqrt[a^2 + b^2]]
and I've found wrapping a secondComplexExpand
(without parameters) around that helps.