Created
December 2, 2015 22:29
-
-
Save hankliu5/f38f33f9e9b1502f8772 to your computer and use it in GitHub Desktop.
First time I wrote a code to deal with complicated computation for my homework. Just for a souvenir.
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 first time I write a code to deal with my homework. | |
forces_of_experiment = [1.33, 3.33, 4.80, 7.13, 8.00, 6.60, 5.07, 4.53] | |
frequencies_of_experiment = [0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.20, 0.21] | |
density_of_experiment = 800 | |
length_of_experiment = 250 | |
viscosity_of_experiment = 0.000018 | |
y = Array.new | |
x = Array.new | |
forces_of_experiment.length.times do |i| | |
y[i] = (forces_of_experiment[i] * density_of_experiment / viscosity_of_experiment ** 2) | |
x[i] = (frequencies_of_experiment[i] * viscosity_of_experiment / (density_of_experiment * length_of_experiment ** 2)) | |
end | |
puts y | |
puts | |
puts x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment