检查表达式是否已定义。

huangapple go评论44阅读模式
英文:

Maxima: check if expression is defined

问题

我想测试某些表达式是否已定义,而不会使程序停止。
例如,如果我有两个矩阵:
检查表达式是否已定义。

我知道这两个矩阵的乘积(A*B)是没有定义的。所以我希望Maxima能够在不中断要测试的更多表达式的评估的情况下打印出这个乘积未定义的信息。

英文:

I want to test wether certain expressions are deifned, without having the programm to be stoped.
For example, if have two matrices:
检查表达式是否已定义。

I know that the product (A*B) of these two is not well defined. So i would like to have maxima print out that this product is not defined without interrupting the evaluation of more expression that are to be tested.

答案1

得分: 1

也许你对errcatch函数感兴趣,它评估表达式并在没有错误时返回结果,但如果发生错误则返回一个空列表。

要实现你想要的功能,你需要多做一些工作,但至少Maxima不会在出现错误时停止。

英文:

Perhaps you are interested in the errcatch function that evaluates expressions and returns the results if there are no errors but returns an empty list if some error occurred.

You'll have to do a bit more work to do what you want, but at least Maxima won't stop on an error.

huangapple
  • 本文由 发表于 2023年7月27日 19:28:40
  • 转载请务必保留本文链接:https://go.coder-hub.com/76779288.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定