在 Maxima 中,我想更改以下等式:
ax+b-c-d=0
转换成以下格式
(ax+b)/(c+d)=1
注意:
像 ax+b-c-d+1=1 这样的东西不是我想要的。
基本上我想在一侧有正元素,在另一侧有负元素,然后将正元素除以负元素。
最佳答案
这是一个快速尝试。它可以处理您所描述形式的一些方程,但可能很容易找到一些它无法处理的方程。也许它运作得足够好,或者至少提供了一些灵感。
ptermp (e) := symbolp(e) or (numberp(e) and e > 0)
or ((op(e) = "+" or op(e) = "*") and every (ptermp, args(e)));
matchdeclare (pterm, ptermp);
matchdeclare (otherterm, all);
defrule (r1, pterm + otherterm = 0, ratsimp (pterm/(-otherterm)) = 1);
注意:按字母顺序,包罗万象的 otherterm
必须位于 pterm
之前!这是简化“+”表达式和模式匹配过程的一个有用但晦涩的结果......对于晦涩难懂感到抱歉。
示例:
apply1 (a*x - b - c + d = 0, r1);
a x + d
------- = 1
c + b
apply1 (a*x - (b + g) - 2*c + d*e*f = 0, r1);
a x + d e f
----------- = 1
g + 2 c + b
关于format - Maxima:如何以定义的格式改革方程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26180450/