【问题标题】:How to prevent maxima to rewrite the output of 2*sqrt(2) to 2^(3/2)?如何防止最大值将 2*sqrt(2) 的输出重写为 2^(3/2)?
【发布时间】:2014-07-08 13:55:57
【问题描述】:

最大值输入

2*sqrt(2)

默认返回输出

2^(3/2)

如何让 Maxima 只返回 2*sqrt(2) ?

(我在 tex() 函数中使用它。)

【问题讨论】:

    标签: output tex maxima simplification


    【解决方案1】:

    据我所知,没有办法阻止 Maxima 将 2*sqrt(2) 简化为 2^(3/2),但有两个可能难以使用的例外情况:

    (1) 完全关闭简化。但这会禁用所有简化,例如1 + 1 简化为 2。但如果你想试试:只要输入simp : false;

    (2) 通过:lisp (setf (get '%sqrt 'operators) nil) 禁用sqrt(2)2^(1/2) 的简化但是Maxima 在很大程度上不知道如何处理sqrt

    我不推荐其中任何一种。

    【讨论】:

      【解决方案2】:

      你可以试试

      simp: false;
      tex(2*sqrt(2));
      block code...;
      simp: true;
      

      这样您就不必永久禁用简化。

      【讨论】:

        【解决方案3】:

        你可以这样做:

        (%i1) matchdeclare(n_, integerp,m_, integerp)$
              tellsimp(n_*sqrt(m_), n_*sqrt(box(m_)))$
        

        之后:

        (%i3) 2*sqrt(2);
        (%o3) 2 √2
        
        (%i4) sqrt(3)*9;
        (%o4) 9 √3
        

        您会注意到输出中平方根符号下方的数字是红色的,因为 box()。但是如果你选择 wxMaxima 中的表达式,然后弹出“Copy LaTeX”,你会得到你想要的,例如。 g.

        \[2\,\sqrt{2}\]
        

        不幸的是,如果您尝试使用 tex(2*sqrt(2)) 获取 TeX 代码,您将得到 $$2\,\sqrt{\boxed{2}}$$instead。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2020-01-23
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多