June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
|
|
@ -1,17 +1,14 @@
|
|||
i = 0
|
||||
|
||||
macro sum(i, lo_byname, hi_byname, term)
|
||||
quote
|
||||
lo = $lo_byname
|
||||
hi = $hi_byname
|
||||
temp = 0.0
|
||||
|
||||
for i=lo:hi
|
||||
temp += $term
|
||||
macro sum(i, loname, hiname, term)
|
||||
return quote
|
||||
lo = $loname
|
||||
hi = $hiname
|
||||
tmp = 0.0
|
||||
for i in lo:hi
|
||||
tmp += $term
|
||||
end
|
||||
|
||||
temp
|
||||
return tmp
|
||||
end
|
||||
end
|
||||
|
||||
println(@sum(i, 1, 100, 1.0 / i))
|
||||
i = 0
|
||||
@sum(i, 1, 100, 1.0 / i)
|
||||
|
|
|
|||
16
Task/Jensens-Device/Ring/jensens-device.ring
Normal file
16
Task/Jensens-Device/Ring/jensens-device.ring
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# Project : Jensen's Device
|
||||
# Date : 2018/01/31
|
||||
# Author : Gal Zsolt [~ CalmoSoft ~]
|
||||
# Email : <calmosoft@gmail.com>
|
||||
|
||||
decimals(14)
|
||||
i = 100
|
||||
see sum(i,1,100,"1/n") + nl
|
||||
|
||||
func sum(i,lo,hi,term)
|
||||
temp = 0
|
||||
for n = lo to hi step 1
|
||||
eval("num = " + term)
|
||||
temp = temp + num
|
||||
next
|
||||
return temp
|
||||
Loading…
Add table
Add a link
Reference in a new issue