【问题标题】:How to view the source code implemetation of a function/method in Maple?如何查看 Maple 中函数/方法的源代码实现?
【发布时间】:2012-04-20 15:43:41
【问题描述】:

我尝试了以下方法:

interface(verboseproc=2);
readlib(FormalPowerSeries);

但我没有得到源代码,而是得到以下几行:

module()
local UpdateCoeff,ComplexApart,RationalAlgorithm,constantRE,PSInt,PS,hypergeomRE,de2re,hypergeomRsolve,printDE,DIRECTION,simpl,FindDE,Limit,Recursion,RecursionSimplify,Pochhammer,simpreal,simppoch,simpfact,tofact,`FPS/Hankel1`,`FPS/Hankel2`,`FPS/JacobiP`,`FPS/Bateman`,`FPS/ExpIntegralE`,`FPS/Abramowitz`,`FPS/Fibonacci`,`FPS/LegendreP`,`FPS/LegendreQ`,`FPS/ChebyshevT`,`FPS/ChebyshevU`,`FPS/LaguerreL`,standardsum,REorder,subsspecfunc,SUBS,mysolve;
export FPS,HolonomicDE,SimpleRE,_pexports,`convert/RESol`;
global `diff/FPS/Hankel1`,`diff/FPS/Hankel2`,`diff/FPS/JacobiP`,`diff/FPS/LegendreP`,`diff/FPS/LegendreQ`,`diff/FPS/ChebyshevT`,`diff/FPS/ChebyshevU`,`diff/FPS/LaguerreL`,`diff/FPS/Bateman`,`diff/FPS/ExpIntegralE`,`diff/FPS/Abramowitz`,`diff/FPS/Fibonacci`,`convert/FormalPowerSeries`,`convert/FPS`;

end module

有没有办法查看源码实现?

【问题讨论】:

    标签: algorithm symbolic-math maple


    【解决方案1】:
    restart:
    
    interface(verboseproc=3): # verbose printing of procedure bodies
    
    exports(FormalPowerSeries); # those which you can normally print
    
    eval(FormalPowerSeries:-FPS); # printing one of the exports
    
    eval(FormalPowerSeries); # the shell of the module, showing locals
    
    # normally, you cannot print the locals
    eval(FormalPowerSeries:-RationalAlgorithm);
    
    kernelopts(opaquemodules=false): # allowing printing of the locals
    
    eval(FormalPowerSeries:-RationalAlgorithm);
    

    【讨论】:

    • 是否有任何类似的方法可以在mathematica 8 中查看源代码?
    • @saint1729 使用函数GeneralUtilities`PrintDefinitions,如GeneralUtilities`PrintDefinitions[Plot]
    • 如果输出只是module() ... end module是什么意思?这是否意味着该函数的源代码不可读或需要以不同的方式读取?我是 Maple 的新手,我有点困惑为什么可调用对象是 module 而不是 proc
    • 如果一个模块有一个名为ModuleApply 的本地名称,那么这个名称(整个模块所分配的名称)可以像一个过程一样被调用。这有时被称为“适用模块”。例如,f:=module()...end module 包含一个名为 ModuleApplylocal,它被定义为一个过程。在这种情况下,您可以调用f(2.1),就好像f 本身就是一个过程一样。一个人获得了可调用程序的好处,而且还能够在自己内部携带辅助数据/程序。很难在评论中完美解释。
    • 例如,在最近的 Maple 版本(例如 Maple 2019.0)中,命令 sqrt 被实现为适用模块。请参阅发出 op(2,eval(sqrt)); 的输出。然后您可以发出showstat(sqrt::ModuleApply); 来查看一个人在发出时获得的主要入口点,例如sqrt(256); 等。
    猜你喜欢
    • 1970-01-01
    • 2022-01-10
    • 2023-03-18
    相关资源
    最近更新 更多