1

我试图sqrt()使用 texput 重新定义 Maxima 中的输出,但遇到了一个我无法理解的错误。

这是我为创建所需字符串而编写的函数:

sqrt_tex:lambda([e], printf(false,"\\csqrt{~a}", tex1(e)))

当应用于表达式时,它的行为似乎符合预期:

sqrt_tex(2);
   > \csqrt{2}

但是texput('sqrt, sqrt_tex, prefix);当我尝试通过后:

tex1(sqrt(2))
    > Maxima encountered a Lisp error:
 ((LAMBDA SIMP) ((MLIST) $E) (($PRINTF) NIL "\\csqrt{~a}" $E)) is not a string designator.
Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.

我确定我错过了一些简单的东西,但无法弄清楚。任何帮助将不胜感激!

4

1 回答 1

0

一时兴起,我删除了prefix,这似乎有效。我假设sqrt是前缀运算符,因为sinand cosare(我相信)并且我认为它们的定义类似。

于 2021-01-20T22:07:42.370 回答