You can use the ROUTINE_INFO routine to find the location/source of routines:
IDL> ROUTINE_FILEPATH("demo")
C:\Program Files\Exelis\IDL85\lib\hook\demo.sav
"demo" is provided as a "sav" file (a pre-compiled program) and there does not come with source code. However, IDL does have a POLY_FIT routine that can be used to generate polynomial fits. A link to the documentation (with an example) is for this routine is shown below:
http://www.harrisgeospati...m/docs/POLY_FIT.html