spec/lib/integrand_spec.rb in dydx-0.1.0 vs spec/lib/integrand_spec.rb in dydx-0.1.1

- old
+ new

@@ -28,15 +28,29 @@ end it 'ex5' do $f = nil f(x) <= log(x) - expect(S(f(x), dx)[0, 1]).to eq(- Float::INFINITY) + expect(S(f(x), dx)[0, 1]).to eq(-oo) end - # TODO it 'ex6' do $f = nil - f(x) <= e ^ (- (x^2)) - expect(S(f(x), dx)[-100, 100]).to eq(1.672428604536991) + f(x) <= e ^ (- (x ^ 2)) + expect(f(0)).to eq(1) + expect(f(1)).to eq(1.0/Math::E) + expect(f(1000)).to eq(0) + expect(S(f(x), dx)[-1000, 1000, 3000]).to eq(1.7724538506374117) + end + + it 'ex7' do + $f = nil + f(x) <= (1.0 / ( ( 2.0 * Math::PI ) ^ 0.5 ) ) * ( e ^ (- (x ^ 2) / 2) ) + expect(S(f(x), dx)[-1000, 1000, 1000]).to eq(0.9952054164466917) + end + + it 'ex8' do + $f = nil + f(x) <= (1.0 / ( ( 2.0 * pi ) ^ 0.5 ) ) * ( e ^ (- (x ^ 2) / 2) ) + expect(S(f(x), dx)[-oo, oo, 1000]).to eq(0.9952054164466917) end end