Jump to content

Jensen's Device: Difference between revisions

Line 89:
 
on jsum(i, lo, hi, term)
set {temp, i's contents} to {0, lo}
repeat withwhile i's fromcontents lo to hi
set i to lo
repeat with i from lo to hi
set temp to temp + (term's f(i))
set i's contents to (i's contents) + 1
end repeat
return temp
Line 103:
end script
 
return jsum(a reference to i, 1, 100, term_func)</lang>
Output: 5.18737751764
 
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.