This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Please enter the following parameters: | |
| Timestep /s: 0.1 | |
| Simulation length /timesteps: 100 | |
| Pendulum length /m: 1 | |
| Pendulum mass /kg: 0.25 | |
| Gravitational acceleration /m s^-2: 9.81 | |
| Damping constant /?: 0 | |
| Initial pendulum angle /rad: 1 | |
| Initial pendulum angular velocity /rad s^-1: -0.8 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Assumed that sin(x) ~ x | |
| 0.837900 | |
| 0.626022 | |
| 0.395107 | |
| 0.171615 | |
| -0.024014 | |
| -0.178162 | |
| -0.284002 | |
| -0.340814 | |
| -0.352829 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1.25@130.8127827 | |
| 0.25@174.6141157 | |
| 0.25@164.8137785 | |
| 0.25@174.6141157 | |
| 0.75@195.9977180 | |
| 0.25@207.6523488 | |
| 1.00@195.9977180 | |
| 1.25@0 | |
| 0.25@174.6141157 | |
| 0.25@195.9977180 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //The code that runs on the graphics card is included in the program here as a plaintext string | |
| //It's also possible to include it as a binary, but I don't know how to do that. | |
| const char* source= | |
| "__kernel \n" | |
| "void sum(__global float* source, __global float* dest, uint n) \n" | |
| " int idx = get_global_id(0); \n" | |
| " int iter = 2; \n" | |
| " \n" | |
| " while(iter < n && idx % iter == 0) { \n" | |
| " dest[min(iter*idx,n)] = source[min(iter*idx,n)] + source[(iter-1)*idx]; \n" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python3 | |
| from math import floor | |
| from math import pi | |
| def getExpansion(y): | |
| x = y | |
| while True: | |
| z = floor(x) | |
| yield z |
NewerOlder