我在Sympy中有一个表达(比如
-M - n + x(n)
Run Code Online (Sandbox Code Playgroud)
并且我想创建一个正式的线性函数,f表示,并将其应用于我的表达式,以便在简化后得到:
-f(M) - f(n) + f(x(n))
Run Code Online (Sandbox Code Playgroud)
是否有可能告诉同意线性的属性得到验证?
一种非常黑客的方法是将函数f应用于总和中的每个子表达式.例如,当给出类似我给出的第一个表达式时,简单地访问出现在总和中的术语会很好(这里它将是
[-M, -n , x(n)]
Run Code Online (Sandbox Code Playgroud)
然后在列表上映射f并将其求和以获得预期的值.
有没有一种简单的方法可以这样做,还是我必须通过表达式的句法树?
我正在尝试在 mac os X 10.11 上编译需要 boost、GMP 和 MPFR 的 plll 库。
我已经通过自制软件安装了 boost、GMP 和 MPFR,然后我在 plll 中的目录构建中启动了 cmake,但是我得到了那个错误:
By not providing "FindMPFR.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "MPFR", but
CMake did not find one.
Could not find a package configuration file provided by "MPFR" with any of
the following names:
MPFRConfig.cmake
mpfr-config.cmake
Add the installation prefix of "MPFR" to CMAKE_PREFIX_PATH or set
"MPFR_DIR" to a directory containing one of …Run Code Online (Sandbox Code Playgroud)