def get_sequence_nonlinear(count, start = 0, stop = 1, curvature: 1)
step = 1 / (count - 1).to_f
linear_steps = 0.step(by: step, to: 1)
sequence = if curvature.positive?
linear_steps.map { |num| 1 - Math.exp(num * -curvature.abs) }
else
linear_steps.map { |num| Math.exp(num * curvature.abs) - 1 }
end
max = sequence.max
require "benchmark/ips"
require 'numo/narray'
Benchmark.ips do |x|
arr_nums = Array.new(10) { |i| rand(1..100.0) }
x.report "each_cons + map" do
arr_nums.each_cons(2).map{|a, b| b - a}
end
This file contains 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
-- Select SQL Engine: MySQL | |
-- | |
-- | |
-- ================================================================== | |
-- SELECT basics | |
-- ================================================================== | |
-- 1. Modify it to show the population of Germany | |
SELECT population | |
FROM world | |
WHERE name = 'Germany' |