Posted to tcl by kbk at Sun May 17 23:17:15 GMT 2009view pretty
package require math package require math::calculus for {set x 0.5} {$x <= 7.0} {set x [expr {$x + 0.5}]} { set g1 [math::calculus::romberg \ [list apply {{x t} {expr {$t ** ($x-1) * exp(-$t)}}} $x] \ 0 1] set g2 [math::calculus::romberg_infinity \ [list apply {{x t} {expr {$t ** ($x-1) * exp(-$t)}}} $x] \ 1 Inf] set gamma [expr {[lindex $g1 0] + [lindex $g2 0]}] set libgamma [expr {exp([math::ln_Gamma $x])}] puts [list $x $gamma $libgamma] }