maxima 代数表达式变换
最后更新于:2022-04-01 07:31:25
本文最初写于 2010-07-26于 sohu 博客,这次博客搬家一起搬到这里来。
版权所有,转载请注明出处。
maxima有很多操纵代数表达式的函数,这里只列出了部分常用的。其他的我还没用过。
ratsimp(expr); /* Simplify expression */
fullratsimp(expr) /* fully Simplify expression */
radcan(expr); /* Simplify radicals(包含对数、指数、根式) */
factor(expr); /* Factor expression (因式分解)*/
factor (expr, p)
gfactor(expr); /* Factor complex (将成对的复数根也因式分解开)*/
expand(expr); /* Expand expression(表达式展开) */
expand (expr, p, n);
expr,logexpan=super; /* Expand logarithms (展开对数表达式)*/
logcontract(expr); /* Contract logarithms */
一些例子:
1 ratsimp
sin (x/(x^2 + x)) = exp ((log(x) + 1)^2 - log(x)^2);
ratsimp (%);
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-01-24_56a4233d2ef36.PNG)
expr: (x^(a/2) + 1)^2*(x^(a/2) - 1)^2/(x^a - 1);
ratsimp (expr);
fullratsimp (expr);
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-01-24_56a4233d3bade.PNG)
2 radcan
radcan((log(x+x^2)-log(x))^a/log(1+x)^(a/2));
radcan((%e^x-1)/(1+%e^(x/2)));
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-01-24_56a4233d491fb.PNG)
3 factor
factor (2^63 - 1);
factor (-8*y - 4*x + z^2*(2*y + x));
factor (1 + x^4, a^2 - 2);
gfactor (x^4 - 1);
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-01-24_56a4233d56f94.PNG)
4 expand
expr:(x+1)^2*(y+1)^3;
expand(expr);
expr:(x+1)^-2*(y+1)^3;
expand(expr,2,2);
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-01-24_56a4233d62cfc.PNG)
5 logcontract
2*(a*log(x) + 2*a*log(y))$
logcontract(%);
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-01-24_56a4233d6e54e.PNG)