2013-05-02 57 views
1

我尝试使用$假设模式为

$Assumptions = f[x_] > 0 
Simplify[Sqrt[f[y]^2]] 

可惜,这是行不通的。

我想定义一个假设的类,因此有可能有上述工作?谢谢!

+1

做一些搜索后,我发现已经有这个问题的几个线程。在我看来,目前还没有完美的方法,但我们可以在计算之前添加所有需要的规则。请参阅[1](http://mathematica.stackexchange.com/questions/15410/how-to-define-a-large-number-of-assumptions),[2](http://mathematica.stackexchange.com /问题/ 14984 /模式匹配式下标变量)。 – 2013-05-02 07:57:19

回答

1

Mathematica文档中的示例是Sqrt[x^2],如果您提供假设Element[x,Reals],则简化为Abs [x]。这非常适用于功能模式,以及:

Simplify[Sqrt[f[x]^2], f[_] \[Element] Reals]

+1

值得注意的是这个“直接”使用patttern的工作原因是Element采用了模式参数。你不能做例如f [_]> 0。请参阅Jens在这里回答.. http://mathematica.stackexchange.com/questions/14984/pattern-matching-in-subscripted-variables – agentp 2013-06-10 15:29:26

相关问题