gpt4 book ai didi

symbolic-math - 在Maxima中用letsimp进行简化,这是怎么回事?

转载 作者:行者123 更新时间:2023-12-04 10:13:12 26 4
gpt4 key购买 nike

这是一个关于 maxima 的简单 session ,其中我试图进行简化 (r-r0)=h

(%i1) ax: G*M*m*(r-r0)/r0^2 - G*M*m/r0 ;
G M m (r - r0) G M m
(%o1) -------------- - -----
2 r0
r0
(%i2) let(r-r0,h);
(%o2) r - r0 --> h
(%i3) expand(scanmap(letsimp,ax));
G M m r 2 G M m
(%o3) ------- - -------
2 r0
r0

我在最后一部分期待这个:
                               G M m h   2 G M m
------- - -------
2 r0
r0

为什么 maxima 将 (r-r0) 替换为 r 而不是 h?
Iv 按照另一个问题中的说明尝试了letsimp 和 letrat: common subexpressions

最佳答案

r - r0不是 let 支持的表格.从文档:

-- Function: let let (, , , , ..., ) let ([, , , , ..., ], )

 Defines a substitution rule for 'letsimp' such that <prod> is
replaced by <repl>. <prod> is a product of positive or negative
powers of the following terms:

* Atoms which 'letsimp' will search for literally unless
previous to calling 'letsimp' the 'matchdeclare' function is
used to associate a predicate with the atom. In this case
'letsimp' will match the atom to any term of a product
satisfying the predicate.
* Kernels such as 'sin(x)', 'n!', 'f(x,y)', etc. As with atoms
above 'letsimp' will look for a literal match unless
'matchdeclare' is used to associate a predicate with the
argument of the kernel.


在这种情况下,可以从句法替换开始:
    (%i1) ax: G*M*m*(r-r0)/r0^2 - G*M*m/r0 $

(%i2) subst(h, r - r0, ax);
G M h m G M m
(%o2) ------- - -----
2 r0
r0

关于symbolic-math - 在Maxima中用letsimp进行简化,这是怎么回事?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61216465/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com