Jensen's Device: Difference between revisions
Content deleted Content added
Line 89: | Line 89: | ||
on jsum(i, lo, hi, term) |
on jsum(i, lo, hi, term) |
||
set temp to 0 |
set {temp, i's contents} to {0, lo} |
||
⚫ | |||
set i to lo |
|||
⚫ | |||
set temp to temp + (term's f(i)) |
set temp to temp + (term's f(i)) |
||
set i's contents to (i's contents) + 1 |
|||
end repeat |
end repeat |
||
return temp |
return temp |
||
Line 103: | Line 103: | ||
end script |
end script |
||
return jsum(i, 1, 100, term_func)</lang> |
return jsum(a reference to i, 1, 100, term_func)</lang> |
||
Output: 5.18737751764 |
Output: 5.18737751764 |
||