diff --git a/contents/verlet_integration/code/asm-x64/verlet.s b/contents/verlet_integration/code/asm-x64/verlet.s index 0e0d031b3..87de6cb7a 100644 --- a/contents/verlet_integration/code/asm-x64/verlet.s +++ b/contents/verlet_integration/code/asm-x64/verlet.s @@ -4,9 +4,9 @@ zero: .double 0.0 two: .double 2.0 half: .double 0.5 - verlet_fmt: .string "[#] Time for Verlet integration is:\n%lf\n" - stormer_fmt: .string "[#] Time for Stormer Verlet Integration is:\n%lf\n[#] Velocity for Stormer Verlet Integration is:\n%lf\n" - velocity_fmt: .string "[#] Time for Velocity Verlet Integration is:\n%lf\n[#] Velocity for Velocity Verlet Integration is:\n%lf\n" + verlet_fmt: .string "[#]\nTime for Verlet integration is:\n%lf\n" + stormer_fmt: .string "[#]\nTime for Stormer Verlet Integration is:\n%lf\n[#]\nVelocity for Stormer Verlet Integration is:\n%lf\n" + velocity_fmt: .string "[#]\nTime for Velocity Verlet Integration is:\n%lf\n[#]\nVelocity for Velocity Verlet Integration is:\n%lf\n" pos: .double 5.0 acc: .double -10.0 dt: .double 0.01 diff --git a/contents/verlet_integration/code/c++/verlet.cpp b/contents/verlet_integration/code/c++/verlet.cpp index 946ddc618..ccceb0ff3 100644 --- a/contents/verlet_integration/code/c++/verlet.cpp +++ b/contents/verlet_integration/code/c++/verlet.cpp @@ -64,19 +64,19 @@ int main() { // each of these functions. double time = verlet(5.0, -10, 0.01); - std::cout << "[#] Time for Verlet integration is:\n" \ + std::cout << "[#]\nTime for Verlet integration is:\n" \ << time << std::endl; timestep timestep_sv = stormer_verlet(5.0, -10, 0.01); - std::cout << "[#] Time for Stormer Verlet integration is:\n" \ + std::cout << "[#]\nTime for Stormer Verlet integration is:\n" \ << timestep_sv.time << std::endl; - std::cout << "[#] Velocity for Stormer Verlet integration is:\n" \ + std::cout << "[#]\nVelocity for Stormer Verlet integration is:\n" \ << timestep_sv.vel << std::endl; timestep timestep_vv = velocity_verlet(5.0, -10, 0.01); - std::cout << "[#] Time for velocity Verlet integration is:\n" \ + std::cout << "[#]\nTime for velocity Verlet integration is:\n" \ << timestep_vv.time << std::endl; - std::cout << "[#] Velocity for velocity Verlet integration is:\n" \ + std::cout << "[#]\nVelocity for velocity Verlet integration is:\n" \ << timestep_vv.vel << std::endl; return 0; diff --git a/contents/verlet_integration/code/c/verlet.c b/contents/verlet_integration/code/c/verlet.c index c42254974..a5febb92c 100644 --- a/contents/verlet_integration/code/c/verlet.c +++ b/contents/verlet_integration/code/c/verlet.c @@ -46,19 +46,19 @@ int main() { double time, vel; verlet(&time, 5.0, -10, 0.01); - printf("[#] Time for Verlet integration is:\n"); + printf("[#]\nTime for Verlet integration is:\n"); printf("%lf\n", time); stormer_verlet(&time, &vel, 5.0, -10, 0.01); - printf("[#] Time for Stormer Verlet integration is:\n"); + printf("[#]\nTime for Stormer Verlet integration is:\n"); printf("%lf\n", time); - printf("[#] Velocity for Stormer Verlet integration is:\n"); + printf("[#]\nVelocity for Stormer Verlet integration is:\n"); printf("%lf\n", vel); velocity_verlet(&time, &vel, 5.0, -10, 0.01); - printf("[#] Time for velocity Verlet integration is:\n"); + printf("[#]\nTime for velocity Verlet integration is:\n"); printf("%lf\n", time); - printf("[#] Velocity for Stormer Verlet integration is:\n"); + printf("[#]\nVelocity for Stormer Verlet integration is:\n"); printf("%lf\n", vel); return 0; diff --git a/contents/verlet_integration/code/clisp/verlet.lisp b/contents/verlet_integration/code/clisp/verlet.lisp index f08f2a7e6..f8d4c6c14 100644 --- a/contents/verlet_integration/code/clisp/verlet.lisp +++ b/contents/verlet_integration/code/clisp/verlet.lisp @@ -34,17 +34,17 @@ while (> p 0) finally (return (list time vel)))) -(format T "[#] Time for Verlet integration:~%") +(format T "[#]~%Time for Verlet integration:~%") (format T "~d~%" (verlet 5 -10 0.01)) (defvar stormer-verlet-result (stormer-verlet 5 -10 0.01)) -(format T "[#] Time for Stormer Verlet integration is:~%") +(format T "[#]~%Time for Stormer Verlet integration is:~%") (format T "~d~%" (first stormer-verlet-result)) -(format T "[#] Velocity for Stormer Verlet integration is:~%") +(format T "[#]~%Velocity for Stormer Verlet integration is:~%") (format T "~d~%" (second stormer-verlet-result)) (defvar velocity-verlet-result (velocity-verlet 5 -10 0.01)) -(format T "[#] Time for velocity Verlet integration is:~%") +(format T "[#]~%Time for velocity Verlet integration is:~%") (format T "~d~%" (first velocity-verlet-result)) -(format T "[#] Velocity for velocity Verlet integration is:~%") +(format T "[#]~%Velocity for velocity Verlet integration is:~%") (format T "~d~%" (second velocity-verlet-result)) \ No newline at end of file diff --git a/contents/verlet_integration/code/fortran/verlet.f90 b/contents/verlet_integration/code/fortran/verlet.f90 index 6999df1e5..3fda9f950 100644 --- a/contents/verlet_integration/code/fortran/verlet.f90 +++ b/contents/verlet_integration/code/fortran/verlet.f90 @@ -91,16 +91,19 @@ SUBROUTINE velocity_verlet(pos, acc, dt, time, vel) ! Verlet CALL verlet(pos, acc, dt, time) - WRITE(*,*) '[#] Time for Verlet integration:' + WRITE(*,*) '[#]' + WRITE(*,*) 'Time for Verlet integration:' WRITE(*,*) time ! stormer Verlet pos = 5d0 CALL stormer_verlet(pos, acc, dt, time, vel) - WRITE(*,*) '[#] Time for Stormer Verlet integration:' + WRITE(*,*) '[#]' + WRITE(*,*) 'Time for Stormer Verlet integration:' WRITE(*,*) time - WRITE(*,*) '[#] Velocity for Stormer Verlet integration:' + WRITE(*,*) '[#]' + WRITE(*,*) 'Velocity for Stormer Verlet integration:' WRITE(*,*) vel @@ -109,9 +112,11 @@ SUBROUTINE velocity_verlet(pos, acc, dt, time, vel) pos = 5d0 CALL velocity_verlet(pos, acc, dt, time, vel) - WRITE(*,*) '[#] Time for velocity Verlet integration:' + WRITE(*,*) '[#]' + WRITE(*,*) 'Time for velocity Verlet integration:' WRITE(*,*) time - WRITE(*,*) '[#] Velocity for velocity Verlet integration:' + WRITE(*,*) '[#]' + WRITE(*,*) 'Velocity for velocity Verlet integration:' WRITE(*,*) vel END PROGRAM verlet_integration diff --git a/contents/verlet_integration/code/golang/verlet.go b/contents/verlet_integration/code/golang/verlet.go index a7cd1c86b..d4fc956a9 100644 --- a/contents/verlet_integration/code/golang/verlet.go +++ b/contents/verlet_integration/code/golang/verlet.go @@ -43,18 +43,18 @@ func velocityVerlet(pos, acc, dt float64) (time, vel float64) { func main() { time := verlet(5., -10., .01) - fmt.Println("[#] Time for Verlet integration is:") + fmt.Println("[#]\nTime for Verlet integration is:") fmt.Println(time) time, vel := stormerVerlet(5., -10., .01) - fmt.Println("[#] Time for Stormer Verlet integration is:") + fmt.Println("[#]\nTime for Stormer Verlet integration is:") fmt.Println(time) - fmt.Println("[#] Velocity for Stormer Verlet integration is:") + fmt.Println("[#]\nVelocity for Stormer Verlet integration is:") fmt.Println(vel) time, vel = velocityVerlet(5., -10., .01) - fmt.Println("[#] Time for velocity Verlet integration is:") + fmt.Println("[#]\nTime for velocity Verlet integration is:") fmt.Println(time) - fmt.Println("[#] Velocity for velocity Verlet integration is:") + fmt.Println("[#]\nVelocity for velocity Verlet integration is:") fmt.Println(vel) } diff --git a/contents/verlet_integration/code/haskell/verlet.hs b/contents/verlet_integration/code/haskell/verlet.hs index 675c7f39b..af964d4d7 100644 --- a/contents/verlet_integration/code/haskell/verlet.hs +++ b/contents/verlet_integration/code/haskell/verlet.hs @@ -52,13 +52,13 @@ main = do let (_, v, _, t) = last $ takeWhile aboveGround $ trajectory m freefall dt p0 in (show t, show v) - putStrLn "[#] Time for Verlet integration is:" + putStrLn "[#]\nTime for Verlet integration is:" putStrLn $ fst $ timeVelocity verlet - putStrLn "[#] Time for Stormer Verlet integration is:" + putStrLn "[#]\nTime for Stormer Verlet integration is:" putStrLn $ fst $ timeVelocity stormerVerlet - putStrLn "[#] Velocity for Stormer Verlet integration is:" + putStrLn "[#]\nVelocity for Stormer Verlet integration is:" putStrLn $ snd $ timeVelocity stormerVerlet - putStrLn "[#] Time for velocity Verlet integration is:" + putStrLn "[#]\nTime for velocity Verlet integration is:" putStrLn $ fst $ timeVelocity velocityVerlet - putStrLn "[#] Velocity for velocity Verlet integration is:" + putStrLn "[#]\nVelocity for velocity Verlet integration is:" putStrLn $ snd $ timeVelocity velocityVerlet diff --git a/contents/verlet_integration/code/java/Verlet.java b/contents/verlet_integration/code/java/Verlet.java index 35387cf8b..38283abed 100644 --- a/contents/verlet_integration/code/java/Verlet.java +++ b/contents/verlet_integration/code/java/Verlet.java @@ -65,19 +65,19 @@ static VerletValues velocity_verlet(double pos, double acc, double dt) { public static void main(String[] args) { double verletTime = verlet(5.0, -10, 0.01); - System.out.println("[#] Time for Verlet integration is:"); + System.out.println("[#]\nTime for Verlet integration is:"); System.out.println(verletTime); VerletValues stormerVerlet = stormer_verlet(5.0, -10, 0.01); - System.out.println("[#] Time for Stormer Verlet integration is:"); + System.out.println("[#]\nTime for Stormer Verlet integration is:"); System.out.println(stormerVerlet.time); - System.out.println("[#] Velocity for Stormer Verlet integration is:"); + System.out.println("[#]\nVelocity for Stormer Verlet integration is:"); System.out.println(stormerVerlet.vel); VerletValues velocityVerlet = velocity_verlet(5.0, -10, 0.01); - System.out.println("[#] Time for velocity Verlet integration is:"); + System.out.println("[#]\nTime for velocity Verlet integration is:"); System.out.println(velocityVerlet.time); - System.out.println("[#] Velocity for velocity Verlet integration is:"); + System.out.println("[#]\nVelocity for velocity Verlet integration is:"); System.out.println(velocityVerlet.vel); } diff --git a/contents/verlet_integration/code/javascript/verlet.js b/contents/verlet_integration/code/javascript/verlet.js index 7ea09e187..d406482d4 100644 --- a/contents/verlet_integration/code/javascript/verlet.js +++ b/contents/verlet_integration/code/javascript/verlet.js @@ -45,17 +45,17 @@ function velocityVerlet(pos, acc, dt) { } const time = verlet(5, -10, 0.01); -console.log(`[#] Time for Verlet integration is:`); +console.log(`[#]\nTime for Verlet integration is:`); console.log(`${time}`); const stormer = stormerVerlet(5, -10, 0.01); -console.log(`[#] Time for Stormer Verlet integration is:`); +console.log(`[#]\nTime for Stormer Verlet integration is:`); console.log(`${stormer.time}`); -console.log(`[#] Velocity for Stormer Verlet integration is:`); +console.log(`[#]\nVelocity for Stormer Verlet integration is:`); console.log(`${stormer.vel}`); const velocity = velocityVerlet(5, -10, 0.01); -console.log(`[#] Time for velocity Verlet integration is:`); +console.log(`[#]\nTime for velocity Verlet integration is:`); console.log(`${velocity.time}`); -console.log(`[#] Velocity for velocity Verlet integration is:`); +console.log(`[#]\nVelocity for velocity Verlet integration is:`); console.log(`${velocity.vel}`); diff --git a/contents/verlet_integration/code/julia/verlet.jl b/contents/verlet_integration/code/julia/verlet.jl index b9edcea98..2d50e5512 100644 --- a/contents/verlet_integration/code/julia/verlet.jl +++ b/contents/verlet_integration/code/julia/verlet.jl @@ -46,19 +46,19 @@ end function main() time = verlet(5.0, -10.0, 0.01); - println("[#] Time for Verlet integration is:") + println("[#]\nTime for Verlet integration is:") println("$(time)") time, vel = stormer_verlet(5.0, -10.0, 0.01); - println("[#] Time for Stormer Verlet integration is:") + println("[#]\nTime for Stormer Verlet integration is:") println("$(time)") - println("[#] Velocity for Stormer Verlet integration is:") + println("[#]\nVelocity for Stormer Verlet integration is:") println("$(vel)") time, vel = velocity_verlet(5.0, -10.0, 0.01); - println("[#] Time for velocity Verlet integration is:") + println("[#]\nTime for velocity Verlet integration is:") println("$(time)") - println("[#] Velocity for velocity Verlet integration is:") + println("[#]\nVelocity for velocity Verlet integration is:") println("$(vel)") end diff --git a/contents/verlet_integration/code/kotlin/verlet.kt b/contents/verlet_integration/code/kotlin/verlet.kt index 79bee7b6a..3b365451c 100644 --- a/contents/verlet_integration/code/kotlin/verlet.kt +++ b/contents/verlet_integration/code/kotlin/verlet.kt @@ -43,18 +43,18 @@ fun velocityVerlet(_pos: Double, acc: Double, dt: Double): VerletValues { fun main(args: Array) { val verletTime = verlet(5.0, -10.0, 0.01) - println("[#] Time for Verlet integration is:") + println("[#]\nTime for Verlet integration is:") println("$verletTime") val stormerVerlet = stormerVerlet(5.0, -10.0, 0.01) - println("[#] Time for Stormer Verlet integration is:") + println("[#]\nTime for Stormer Verlet integration is:") println("${stormerVerlet.time}") - println("[#] Velocity for Stormer Verlet integration is:") + println("[#]\nVelocity for Stormer Verlet integration is:") println("${stormerVerlet.vel}") val velocityVerlet = velocityVerlet(5.0, -10.0, 0.01) - println("[#] Time for Velocity Verlet integration is:") + println("[#]\nTime for Velocity Verlet integration is:") println("${velocityVerlet.time}") - println("[#] Velocity for Velocity Verlet integration is:") + println("[#]\nVelocity for Velocity Verlet integration is:") println("${velocityVerlet.vel}") } diff --git a/contents/verlet_integration/code/nim/verlet.nim b/contents/verlet_integration/code/nim/verlet.nim index 2e92b57c4..ff454b7ee 100644 --- a/contents/verlet_integration/code/nim/verlet.nim +++ b/contents/verlet_integration/code/nim/verlet.nim @@ -46,17 +46,17 @@ func velocityVerlet(pos_in, acc, dt: float): (float, float) = when isMainModule: let timeV = verlet(5.0, -10.0, 0.01) - echo "[#] Time for Verlet integration is:" + echo "[#]\nTime for Verlet integration is:" echo timeV let (timeSV, velSV) = stormerVerlet(5.0, -10.0, 0.01) - echo "[#] Time for Stormer Verlet integration is:" + echo "[#]\nTime for Stormer Verlet integration is:" echo timeSV - echo "[#] Velocity for Stormer Verlet integration is:" + echo "[#]\nVelocity for Stormer Verlet integration is:" echo velSV let (timeVV, velVV) = velocityVerlet(5.0, -10.0, 0.01) - echo "[#] Time for velocity Verlet integration is:" + echo "[#]\nTime for velocity Verlet integration is:" echo timeVV - echo "[#] Velocity for velocity Verlet integration is:" + echo "[#]\nVelocity for velocity Verlet integration is:" echo velVV diff --git a/contents/verlet_integration/code/python/verlet.py b/contents/verlet_integration/code/python/verlet.py index 18dc627d3..063e19666 100644 --- a/contents/verlet_integration/code/python/verlet.py +++ b/contents/verlet_integration/code/python/verlet.py @@ -35,19 +35,19 @@ def velocity_verlet(pos, acc, dt): def main(): time = verlet(5, -10, 0.01) - print("[#] Time for Verlet integration is:") + print("[#]\nTime for Verlet integration is:") print("{:.10f}".format(time)) time, vel = stormer_verlet(5, -10, 0.01) - print("[#] Time for Stormer Verlet integration is:") + print("[#]\nTime for Stormer Verlet integration is:") print("{:.10f}".format(time)) - print("[#] Velocity for Stormer Verlet integration is:") + print("[#]\nVelocity for Stormer Verlet integration is:") print("{:.10f}".format(vel)) time, vel = velocity_verlet(5, -10, 0.01) - print("[#] Time for velocity Verlet integration is:") + print("[#]\nTime for velocity Verlet integration is:") print("{:.10f}".format(time)) - print("[#] Velocity for velocity Verlet integration is:") + print("[#]\nVelocity for velocity Verlet integration is:") print("{:.10f}".format(vel)) diff --git a/contents/verlet_integration/code/ruby/verlet.rb b/contents/verlet_integration/code/ruby/verlet.rb index 4a6c38a48..d11243568 100644 --- a/contents/verlet_integration/code/ruby/verlet.rb +++ b/contents/verlet_integration/code/ruby/verlet.rb @@ -45,17 +45,17 @@ def velocity_verlet(pos, acc, dt) end -puts "[#] Time for Verlet integration is:" +puts "[#]\nTime for Verlet integration is:" p verlet(5.0, -10, 0.01) time, vel = stormer_verlet(5.0, -10, 0.01) -puts "[#] Time for Stormer Verlet integration is:" +puts "[#]\nTime for Stormer Verlet integration is:" p time -puts "[#] Velocity for Stormer Verlet integration is:" +puts "[#]\nVelocity for Stormer Verlet integration is:" p vel time, vel = velocity_verlet(5.0, -10, 0.01) -puts "[#] Time for velocity Verlet integration is:" +puts "[#]\nTime for velocity Verlet integration is:" p time -puts "[#] Velocity for velocity Verlet integration is:" +puts "[#]\nVelocity for velocity Verlet integration is:" p vel diff --git a/contents/verlet_integration/code/rust/verlet.rs b/contents/verlet_integration/code/rust/verlet.rs index f765da864..8901a3790 100644 --- a/contents/verlet_integration/code/rust/verlet.rs +++ b/contents/verlet_integration/code/rust/verlet.rs @@ -49,16 +49,16 @@ fn main() { let (time_sv, vel_sv) = stormer_verlet(5.0, -10.0, 0.01); let (time_vv, vel_vv) = velocity_verlet(5.0, -10.0, 0.01); - println!("[#] Time for Verlet integration is:"); + println!("[#]\nTime for Verlet integration is:"); println!("{}", time_v); - println!("[#] Time for Stormer Verlet integration is:"); + println!("[#]\nTime for Stormer Verlet integration is:"); println!("{}", time_sv); - println!("[#] Velocity for Stormer Verlet integration is:"); + println!("[#]\nVelocity for Stormer Verlet integration is:"); println!("{}", vel_sv); - println!("[#] Time for velocity Verlet integration is:"); + println!("[#]\nTime for velocity Verlet integration is:"); println!("{}", time_vv); - println!("[#] Velocity for velocity Verlet integration is:"); + println!("[#]\nVelocity for velocity Verlet integration is:"); println!("{}", vel_vv); } diff --git a/contents/verlet_integration/code/swift/verlet.swift b/contents/verlet_integration/code/swift/verlet.swift index 7991a0082..f7d1973bc 100644 --- a/contents/verlet_integration/code/swift/verlet.swift +++ b/contents/verlet_integration/code/swift/verlet.swift @@ -50,19 +50,19 @@ func velocityVerlet(pos: Double, acc: Double, dt: Double) -> (time: Double, vel: func main() { let verletTime = verlet(pos: 5.0, acc: -10.0, dt: 0.01) - print("[#] Time for Verlet integration is:") + print("[#]\nTime for Verlet integration is:") print("\(verletTime)") let stormer = stormerVerlet(pos: 5.0, acc: -10.0, dt: 0.01); - print("[#] Time for Stormer Verlet integration is:") + print("[#]\nTime for Stormer Verlet integration is:") print("\(stormer.time)") - print("[#] Velocity for Stormer Verlet integration is:") + print("[#]\nVelocity for Stormer Verlet integration is:") print("\(stormer.vel)") let velVerlet = velocityVerlet(pos: 5.0, acc: -10, dt: 0.01) - print("[#] Time for velocity Verlet integration is:") + print("[#]\nTime for velocity Verlet integration is:") print("\(velVerlet.time)") - print("[#] Velocity for velocity Verlet integration is:") + print("[#]\nVelocity for velocity Verlet integration is:") print("\(velVerlet.vel)") }