本文介绍了在 MAXIMA 中,如何打印整个调用堆栈?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

抱歉,如果这是一个新手问题,但我找不到关于此的任何文档或其他 stackoverflow 问题.我想查看在求解表达式或方程时调用的所有最大值函数的整个堆栈跟踪.我尝试了跟踪、回溯和调试模式.查看了不同的显示和打印功能,但都不起作用.

Sorry if this is a novice question, but I couldn't find any documentation or other stackoverflow questions on this. I want to see entire stack trace of all maxima functions called in solving an expression or an equation. I tried trace, backtrace, and debugmode. Looked at different display and print functions, but none worked.

示例 1:

(%i1) is(equal( (a+b)^2, a^2+b^2+2*a*b ));
(%o1) true

示例 2:

(%i2) trace(factor);
(%o2) [factor]
(%i3) trace_options(factor, info);
(%o3) [info]
(%i4) factor( (x^2 - 7*x + 10) / (x - 5) );
1 Enter ?factor [(x^2-7*x+10)/(x-5)] -> true
1 Exit  ?factor x-2 -> true
(%o4) x-2

我希望看到 Maxima 执行的每个中间步骤及其在推导这些解决方案或结论中的结果.关于最细微级别调用的信息甚至更好.

I want to see every intermediate step Maxima executed and its result in the derivation of these solutions or conclusions.Info on minutest level calls is even better.

谢谢,RB

推荐答案

作为一个黑客,您可以追踪 builtins-list.txt:

As a hack you can trace all functions listed in builtins-list.txt:

l: read_list("builtins-list.txt") $
for e in l do errcatch(apply('trace, [e])) $
untrace(bfloatp) $ /* to limit output */
is(equal( (a+b)^2, a^2+b^2+2*a*b )) $

返回:

(%i5) is(equal( (a+b)^2, a^2+b^2+2*a*b )) $
                            2   2    2
1 Enter is [is(equal((a + b) , a  + b  + 2 a b))]
 1 Enter ratp [2]
 1 Exit  ratp false
 1 Enter ratp [b + a]
 1 Exit  ratp false
 1 Enter ratp [2]
 1 Exit  ratp false
 1 Enter ratp [b + a]
 1 Exit  ratp false
 1 Enter ratp [2]
 1 Exit  ratp false
 1 Enter ratp [a]
 1 Exit  ratp false
 1 Enter ratp [2]
 1 Exit  ratp false
 1 Enter ratp [b]
 1 Exit  ratp false
                      2
 1 Enter setp [(b + a) ]
 1 Exit  setp false
                   2            2
 1 Enter subvarp [b  + 2 a b + a ]
 1 Exit  subvarp false
                   2            2
 1 Enter subvarp [b  + 2 a b + a ]
 1 Exit  subvarp false
                         2    2            2
 1 Enter ratsimp [(b + a)  - b  - 2 a b - a ]
                       2    2            2
  1 Enter ratp [(b + a)  - b  - 2 a b - a ]
  1 Exit  ratp false
                              2    2            2
  1 Enter totaldisrep [(b + a)  - b  - 2 a b - a ]
                             2    2            2
  1 Exit  totaldisrep (b + a)  - b  - 2 a b - a
  1 Enter ratdisrep [0]
   1 Enter ratp [0]
   1 Exit  ratp true
  1 Exit  ratdisrep 0
 1 Exit  ratsimp 0
 1 Enter facts []
 1 Exit  facts []
 1 Enter niceindices [0]
 1 Exit  niceindices 0
 1 Enter constantp [0]
  1 Enter numberp [0]
   1 Enter ratnump [0]
   1 Exit  ratnump true
  1 Exit  numberp true
 1 Exit  constantp true
 1 Enter rectform [0]
 1 Exit  rectform 0
 1 Enter sign [0]
 1 Exit  sign zero
1 Exit  is true
1 Enter concat [, %o, 5]
1 Exit  concat %o5
1 Enter concat [, %i, 5]
1 Exit  concat %i5
1 Enter concat [, %i, 6]
1 Exit  concat %i6

这篇关于在 MAXIMA 中,如何打印整个调用堆栈?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-16 17:43