Skip to content

Commit 39f8c1c

Browse files
authored
Use [#]\n instead of [#] for human readable output (algorithm-archivists#873)
1 parent 46bf5a3 commit 39f8c1c

File tree

16 files changed

+83
-78
lines changed

16 files changed

+83
-78
lines changed

‎contents/verlet_integration/code/asm-x64/verlet.s‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
zero: .double 0.0
55
two: .double 2.0
66
half: .double 0.5
7-
verlet_fmt: .string "[#] Time for Verlet integration is:\n%lf\n"
8-
stormer_fmt: .string "[#] Time for Stormer Verlet Integration is:\n%lf\n[#] Velocity for Stormer Verlet Integration is:\n%lf\n"
9-
velocity_fmt: .string "[#] Time for Velocity Verlet Integration is:\n%lf\n[#] Velocity for Velocity Verlet Integration is:\n%lf\n"
7+
verlet_fmt: .string "[#]\nTime for Verlet integration is:\n%lf\n"
8+
stormer_fmt: .string "[#]\nTime for Stormer Verlet Integration is:\n%lf\n[#]\nVelocity for Stormer Verlet Integration is:\n%lf\n"
9+
velocity_fmt: .string "[#]\nTime for Velocity Verlet Integration is:\n%lf\n[#]\nVelocity for Velocity Verlet Integration is:\n%lf\n"
1010
pos: .double 5.0
1111
acc: .double -10.0
1212
dt: .double 0.01

‎contents/verlet_integration/code/c++/verlet.cpp‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,19 @@ int main(){
6464
// each of these functions.
6565

6666
double time = verlet(5.0, -10, 0.01);
67-
std::cout << "[#] Time for Verlet integration is:\n" \
67+
std::cout << "[#]\nTime for Verlet integration is:\n" \
6868
<< time << std::endl;
6969

7070
timestep timestep_sv = stormer_verlet(5.0, -10, 0.01);
71-
std::cout << "[#] Time for Stormer Verlet integration is:\n" \
71+
std::cout << "[#]\nTime for Stormer Verlet integration is:\n" \
7272
<< timestep_sv.time << std::endl;
73-
std::cout << "[#] Velocity for Stormer Verlet integration is:\n" \
73+
std::cout << "[#]\nVelocity for Stormer Verlet integration is:\n" \
7474
<< timestep_sv.vel << std::endl;
7575

7676
timestep timestep_vv = velocity_verlet(5.0, -10, 0.01);
77-
std::cout << "[#] Time for velocity Verlet integration is:\n" \
77+
std::cout << "[#]\nTime for velocity Verlet integration is:\n" \
7878
<< timestep_vv.time << std::endl;
79-
std::cout << "[#] Velocity for velocity Verlet integration is:\n" \
79+
std::cout << "[#]\nVelocity for velocity Verlet integration is:\n" \
8080
<< timestep_vv.vel << std::endl;
8181

8282
return0;

‎contents/verlet_integration/code/c/verlet.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,19 @@ int main(){
4646
doubletime, vel;
4747

4848
verlet(&time, 5.0, -10, 0.01);
49-
printf("[#] Time for Verlet integration is:\n");
49+
printf("[#]\nTime for Verlet integration is:\n");
5050
printf("%lf\n", time);
5151

5252
stormer_verlet(&time, &vel, 5.0, -10, 0.01);
53-
printf("[#] Time for Stormer Verlet integration is:\n");
53+
printf("[#]\nTime for Stormer Verlet integration is:\n");
5454
printf("%lf\n", time);
55-
printf("[#] Velocity for Stormer Verlet integration is:\n");
55+
printf("[#]\nVelocity for Stormer Verlet integration is:\n");
5656
printf("%lf\n", vel);
5757

5858
velocity_verlet(&time, &vel, 5.0, -10, 0.01);
59-
printf("[#] Time for velocity Verlet integration is:\n");
59+
printf("[#]\nTime for velocity Verlet integration is:\n");
6060
printf("%lf\n", time);
61-
printf("[#] Velocity for Stormer Verlet integration is:\n");
61+
printf("[#]\nVelocity for Stormer Verlet integration is:\n");
6262
printf("%lf\n", vel);
6363

6464
return0;

‎contents/verlet_integration/code/clisp/verlet.lisp‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@
3434
while (> p 0)
3535
finally (return (listtime vel))))
3636

37-
(formatT"[#]Time for Verlet integration:~%")
37+
(formatT"[#]~%Time for Verlet integration:~%")
3838
(formatT"~d~%" (verlet 5-100.01))
3939

4040
(defvar stormer-verlet-result (stormer-verlet 5-100.01))
41-
(formatT"[#]Time for Stormer Verlet integration is:~%")
41+
(formatT"[#]~%Time for Stormer Verlet integration is:~%")
4242
(formatT"~d~%" (first stormer-verlet-result))
43-
(formatT"[#]Velocity for Stormer Verlet integration is:~%")
43+
(formatT"[#]~%Velocity for Stormer Verlet integration is:~%")
4444
(formatT"~d~%" (second stormer-verlet-result))
4545

4646
(defvar velocity-verlet-result (velocity-verlet 5-100.01))
47-
(formatT"[#]Time for velocity Verlet integration is:~%")
47+
(formatT"[#]~%Time for velocity Verlet integration is:~%")
4848
(formatT"~d~%" (first velocity-verlet-result))
49-
(formatT"[#]Velocity for velocity Verlet integration is:~%")
49+
(formatT"[#]~%Velocity for velocity Verlet integration is:~%")
5050
(formatT"~d~%" (second velocity-verlet-result))

‎contents/verlet_integration/code/fortran/verlet.f90‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,19 @@ SUBROUTINE velocity_verlet(pos, acc, dt, time, vel)
9191
! Verlet
9292
CALL verlet(pos, acc, dt, time)
9393

94-
WRITE(*,*) '[#] Time for Verlet integration:'
94+
WRITE(*,*) '[#]'
95+
WRITE(*,*) 'Time for Verlet integration:'
9596
WRITE(*,*) time
9697

9798
! stormer Verlet
9899
pos =5d0
99100
CALL stormer_verlet(pos, acc, dt, time, vel)
100101

101-
WRITE(*,*) '[#] Time for Stormer Verlet integration:'
102+
WRITE(*,*) '[#]'
103+
WRITE(*,*) 'Time for Stormer Verlet integration:'
102104
WRITE(*,*) time
103-
WRITE(*,*) '[#] Velocity for Stormer Verlet integration:'
105+
WRITE(*,*) '[#]'
106+
WRITE(*,*) 'Velocity for Stormer Verlet integration:'
104107
WRITE(*,*) vel
105108

106109

@@ -109,9 +112,11 @@ SUBROUTINE velocity_verlet(pos, acc, dt, time, vel)
109112
pos =5d0
110113
CALL velocity_verlet(pos, acc, dt, time, vel)
111114

112-
WRITE(*,*) '[#] Time for velocity Verlet integration:'
115+
WRITE(*,*) '[#]'
116+
WRITE(*,*) 'Time for velocity Verlet integration:'
113117
WRITE(*,*) time
114-
WRITE(*,*) '[#] Velocity for velocity Verlet integration:'
118+
WRITE(*,*) '[#]'
119+
WRITE(*,*) 'Velocity for velocity Verlet integration:'
115120
WRITE(*,*) vel
116121

117122
END PROGRAM verlet_integration

‎contents/verlet_integration/code/golang/verlet.go‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,18 @@ func velocityVerlet(pos, acc, dt float64) (time, vel float64){
4343

4444
funcmain(){
4545
time:=verlet(5., -10., .01)
46-
fmt.Println("[#] Time for Verlet integration is:")
46+
fmt.Println("[#]\nTime for Verlet integration is:")
4747
fmt.Println(time)
4848

4949
time, vel:=stormerVerlet(5., -10., .01)
50-
fmt.Println("[#] Time for Stormer Verlet integration is:")
50+
fmt.Println("[#]\nTime for Stormer Verlet integration is:")
5151
fmt.Println(time)
52-
fmt.Println("[#] Velocity for Stormer Verlet integration is:")
52+
fmt.Println("[#]\nVelocity for Stormer Verlet integration is:")
5353
fmt.Println(vel)
5454

5555
time, vel=velocityVerlet(5., -10., .01)
56-
fmt.Println("[#] Time for velocity Verlet integration is:")
56+
fmt.Println("[#]\nTime for velocity Verlet integration is:")
5757
fmt.Println(time)
58-
fmt.Println("[#] Velocity for velocity Verlet integration is:")
58+
fmt.Println("[#]\nVelocity for velocity Verlet integration is:")
5959
fmt.Println(vel)
6060
}

‎contents/verlet_integration/code/haskell/verlet.hs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ main = do
5252
let (_, v, _, t) =last$takeWhile aboveGround $ trajectory m freefall dt p0
5353
in (show t, show v)
5454

55-
putStrLn"[#] Time for Verlet integration is:"
55+
putStrLn"[#]\nTime for Verlet integration is:"
5656
putStrLn$fst$ timeVelocity verlet
57-
putStrLn"[#] Time for Stormer Verlet integration is:"
57+
putStrLn"[#]\nTime for Stormer Verlet integration is:"
5858
putStrLn$fst$ timeVelocity stormerVerlet
59-
putStrLn"[#] Velocity for Stormer Verlet integration is:"
59+
putStrLn"[#]\nVelocity for Stormer Verlet integration is:"
6060
putStrLn$snd$ timeVelocity stormerVerlet
61-
putStrLn"[#] Time for velocity Verlet integration is:"
61+
putStrLn"[#]\nTime for velocity Verlet integration is:"
6262
putStrLn$fst$ timeVelocity velocityVerlet
63-
putStrLn"[#] Velocity for velocity Verlet integration is:"
63+
putStrLn"[#]\nVelocity for velocity Verlet integration is:"
6464
putStrLn$snd$ timeVelocity velocityVerlet

‎contents/verlet_integration/code/java/Verlet.java‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,19 @@ static VerletValues velocity_verlet(double pos, double acc, double dt){
6565
publicstaticvoidmain(String[] args){
6666

6767
doubleverletTime = verlet(5.0, -10, 0.01);
68-
System.out.println("[#] Time for Verlet integration is:");
68+
System.out.println("[#]\nTime for Verlet integration is:");
6969
System.out.println(verletTime);
7070

7171
VerletValuesstormerVerlet = stormer_verlet(5.0, -10, 0.01);
72-
System.out.println("[#] Time for Stormer Verlet integration is:");
72+
System.out.println("[#]\nTime for Stormer Verlet integration is:");
7373
System.out.println(stormerVerlet.time);
74-
System.out.println("[#] Velocity for Stormer Verlet integration is:");
74+
System.out.println("[#]\nVelocity for Stormer Verlet integration is:");
7575
System.out.println(stormerVerlet.vel);
7676

7777
VerletValuesvelocityVerlet = velocity_verlet(5.0, -10, 0.01);
78-
System.out.println("[#] Time for velocity Verlet integration is:");
78+
System.out.println("[#]\nTime for velocity Verlet integration is:");
7979
System.out.println(velocityVerlet.time);
80-
System.out.println("[#] Velocity for velocity Verlet integration is:");
80+
System.out.println("[#]\nVelocity for velocity Verlet integration is:");
8181
System.out.println(velocityVerlet.vel);
8282

8383
}

‎contents/verlet_integration/code/javascript/verlet.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,17 @@ function velocityVerlet(pos, acc, dt){
4545
}
4646

4747
consttime=verlet(5,-10,0.01);
48-
console.log(`[#] Time for Verlet integration is:`);
48+
console.log(`[#]\nTime for Verlet integration is:`);
4949
console.log(`${time}`);
5050

5151
conststormer=stormerVerlet(5,-10,0.01);
52-
console.log(`[#] Time for Stormer Verlet integration is:`);
52+
console.log(`[#]\nTime for Stormer Verlet integration is:`);
5353
console.log(`${stormer.time}`);
54-
console.log(`[#] Velocity for Stormer Verlet integration is:`);
54+
console.log(`[#]\nVelocity for Stormer Verlet integration is:`);
5555
console.log(`${stormer.vel}`);
5656

5757
constvelocity=velocityVerlet(5,-10,0.01);
58-
console.log(`[#] Time for velocity Verlet integration is:`);
58+
console.log(`[#]\nTime for velocity Verlet integration is:`);
5959
console.log(`${velocity.time}`);
60-
console.log(`[#] Velocity for velocity Verlet integration is:`);
60+
console.log(`[#]\nVelocity for velocity Verlet integration is:`);
6161
console.log(`${velocity.vel}`);

‎contents/verlet_integration/code/julia/verlet.jl‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,19 @@ end
4646

4747
functionmain()
4848
time =verlet(5.0, -10.0, 0.01);
49-
println("[#] Time for Verlet integration is:")
49+
println("[#]\nTime for Verlet integration is:")
5050
println("$(time)")
5151

5252
time, vel =stormer_verlet(5.0, -10.0, 0.01);
53-
println("[#] Time for Stormer Verlet integration is:")
53+
println("[#]\nTime for Stormer Verlet integration is:")
5454
println("$(time)")
55-
println("[#] Velocity for Stormer Verlet integration is:")
55+
println("[#]\nVelocity for Stormer Verlet integration is:")
5656
println("$(vel)")
5757

5858
time, vel =velocity_verlet(5.0, -10.0, 0.01);
59-
println("[#] Time for velocity Verlet integration is:")
59+
println("[#]\nTime for velocity Verlet integration is:")
6060
println("$(time)")
61-
println("[#] Velocity for velocity Verlet integration is:")
61+
println("[#]\nVelocity for velocity Verlet integration is:")
6262
println("$(vel)")
6363

6464
end

0 commit comments

Comments
(0)