|
发表于 2023-10-3 08:20:49
|
显示全部楼层
1# chyanog
这里有一个问题需要先明确一下.
就是如何量化 一个数学表达式的复杂程度.
=============
在Mathematica里面,化简用的是Simplify,FullSimplify .
其对复杂度的默认的量化参数就是一个表达式的LeafCount.With the default setting ComplexityFunction->Automatic, forms are ranked primarily according to their LeafCount, with corrections to treat integers with more digits as more complex. =============
如果LeaFcount 不能达到理想的效果,那我们用户只能自己实现ComplexityFunction了.
比如,我们按照表达式输入的字符个数的多少来衡量表达式的复杂度,可以这样:- f[e_] := StringLength[ToString[InputForm[e]]]Simplify[Abs[x], x < 0, ComplexityFunction -> f]
复制代码 |
|