RE: built in routine id's for Rolf

new topic     » topic index » view thread      » older message » newer message

Rolf Schröder wrote:
> ----------------------------------------------------------------------
> -- MAIN program area: examples for qgauss() function. 
> -- ****
> -- Nunerical integration of sin(x) over (0,PI) and x*x over (0,3).
> --
>     printf(1,"I(sin)[0,PI] = %15.10f (2 exactly)\n\n",
> 						qgauss("SIN",0,PI))
>     printf(1,"I(x*x)[0,3] = %15.10f (9 exactly)\n", 
> 						qgauss("quad",0,3))
>     abort(0)
> ----------------------------------------------------------------------



Doctor Rolf:

----------------------------------------------------------------------
      -- 10 point Gauss integration of 'func' over interval (a,b).
      -- (after 'Numerical Recipes (FORTRAN), W.H.Press et al., 1988, 
p122)
----------------------------------------------------------------------
      include misc.e -- PI
----------------------------------------------------------------------

      constant X = { .1488743389,
             .4333953941,
             .6794095682,
             .8650633666,
             .9739065285}
      constant W = { .2955242247,
             .2692667193,
             .2190863625,
             .1494513491,
             .0666713443}
----------------------------------------------------------------------

-------- This has to appear at the beginning
  
      function oldsin(object n)
      	return sin(n)
      end function

-------- Note if you want to use oldsin call it with oldsin()
      -- because the old sin appears first it will call the old sin.  
      -- The secret is to turn off warning before the function
      -- and turn on the warning after it. 
      --
      without warning -- shuts off built-in complaint
  
      function sin(atom x)    -- new equivalent withsame name
      --       ***            --  of build in sin()
      --       ***
          return oldsin(x)
      end function    

      with warning -- turn warning back on back on


Bernie

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu