5.3 How to display source code of a function?

For integration use

infolevel[`evalf/int`]:=5;infolevel[int]:=5;
 

Another option

restart; 
interface(verboseproc=3) #(try 2 also)
 

then print(procedure); or eval(procedure_name); for example

restart: 
interface(verboseproc=3): 
print(LinearAlgebra:-GramSchmidt); 
print(lcm);
 

Also can use showstat, in this case interface(verboseproc=3) is not needed. Also showstat gives line numbers and I think it is easier to read. Some examples

showstat(`odsolve/2nd_order`) 
showstat(`evalf/hypergeom`); 
showstat(`evalf/exp/general`); 
showstat(`evalf/Psi`); 
showstat(`evalf/int`); 
showstat(`dsolve/SERIES`); 
 
#these 3 shows the main 3 functions by each solver 
showstat(`odeadv/dAlembert`);  #used by advisor 
showstat(`odsolve/dAlembert`);  # main API. 
showstat(`odsolve/dAlembert/integrate`); #used to integrate the ode 
 
showstat(`ODEtools/odeadv`); 
showstat(DEtools:-odeadvisor); 
showstat(`dsolve/series/froben/inhom`) 
showstat(`dsolve/series/froben`)
 

To stop at anyone of these functions in debugger do

stopat(`dsolve/series/froben/inhom`) 
#code here, say dsolve command.
 

The above will stop in the debugger in the above function.

There is also a function by Joe Riel here here is the post by Joe Riel:

"A disadvantage of showstat, particularly if you want to cut and paste the output, is that it includes line numbers. Here is a simple procedure I threw together to remove the line numbers."

PrintProc := proc(p::name,lines::{posint,posint..posint}) 
local width; 
option `Copyright (C) 2004 by Joseph S. Riel. All rights reserved.`; 
description "Print like showstat, but without line numbers"; 
width := interface('screenwidth'=200); 
try 
printf("%s", 
StringTools:-RegSubs( 
"\n ...." = "\n" 
,debugopts('procdump'= 
`if`(nargs=1,p,[args])))) 
catch "procedure name expected": 
error "%1 is not a procedure name",p 
finally interface('screenwidth'=width) 
end try; 
NULL 
end:
 

To print source code to file using the above, do the following

currentdir("C:\\data"); 
interface('prettyprint'=1): 
interface('verboseproc'=3): 
writeto("listing.txt") 
PrintProc('singular'); 
writeto('terminal'):
 

Now the output will show up in the file "listing.txt" and also no line wrapping. The above I found is the best solution so far to do this.