Jensen's Device: Difference between revisions
Content deleted Content added
Line 105: | Line 105: | ||
return jsum(i, 1, 100, term_func)</lang> |
return jsum(i, 1, 100, term_func)</lang> |
||
Output: 5.18737751764 |
|||
<lang AppleScript>set i to 0 |
|||
on jsum(i, lo, hi, term) |
|||
set temp to 0 |
|||
set i to lo |
|||
repeat while i ≤ hi |
|||
set termf to "on run(i)" & return & "return " & term & return & "end" |
|||
set temp to temp + (run script termf with parameters {i}) |
|||
set i to i + 1 |
|||
end repeat |
|||
return temp |
|||
end jsum |
|||
return jsum(i, 1, 100, "1/i")</lang> |
|||
Output: 5.18737751764 |
Output: 5.18737751764 |
||