Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
6
Task/Jensens-Device/Zkl/jensens-device-1.zkl
Normal file
6
Task/Jensens-Device/Zkl/jensens-device-1.zkl
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
fcn sum(ri, lo,hi, term){
|
||||
temp:=0.0; ri.set(lo);
|
||||
do{ temp+=term(ri); } while(ri.inc()<hi); // inc return previous value
|
||||
return(temp);
|
||||
}
|
||||
sum(Ref(0), 1,100, fcn(ri){ 1.0/ri.value }).println();
|
||||
7
Task/Jensens-Device/Zkl/jensens-device-2.zkl
Normal file
7
Task/Jensens-Device/Zkl/jensens-device-2.zkl
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
fcn sum2(ri, lo,hi, term){
|
||||
temp:=0.0; ri.set(lo);
|
||||
do{ temp=term + temp; } while(ri.inc()<hi); // inc return previous value
|
||||
return(temp);
|
||||
}
|
||||
ri:=Ref(0);
|
||||
sum2(ri, 1,100, 'wrap(){ 1.0/ri.value }).println();
|
||||
2
Task/Jensens-Device/Zkl/jensens-device-3.zkl
Normal file
2
Task/Jensens-Device/Zkl/jensens-device-3.zkl
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fcn sum3(lo,hi, term){ [lo..hi].reduce('wrap(sum,i){ sum + term(i) },0.0) }
|
||||
sum3(1,100, fcn(i){ 1.0/i }).println();
|
||||
Loading…
Add table
Add a link
Reference in a new issue