Skip to content

Commit

Permalink
Merge pull request #12 from matthewtoast/master
Browse files Browse the repository at this point in the history
Add constant i
  • Loading branch information
danielmorrison committed Dec 22, 2012
2 parents fe2bd08 + 57d5418 commit 76be397
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/unicode_math/constants.rb
Expand Up @@ -22,6 +22,12 @@ def self.included(base)
end
end

%w(𝐒 𝑖 π’Š 𝒾 𝓲 𝔦 π•š π–Ž 𝗂 𝗢 π˜ͺ π™ž πš’).each do |i|
define_method(i) do
Complex::I
end
end

define_method('∞') do
1.0 / 0
end
Expand Down
4 changes: 4 additions & 0 deletions spec/unicode_math/constants_spec.rb
Expand Up @@ -15,6 +15,10 @@
expect(𝑒).to be_within(0.00005).of(2.7183)
end

it 'defines 𝑖' do
expect(𝑖 * 𝑖).to eq(-1)
end

it 'defines ∞' do
expect(∞ + 1).to eq(∞)
end
Expand Down
9 changes: 9 additions & 0 deletions spec/unicode_math/equations/euler_spec.rb
@@ -0,0 +1,9 @@
# encoding: utf-8

require 'spec_helper'

describe "Euler's identity" do
it 'elegantly relates β„―, π’Š, Ο€, 1 and 0' do
expect((β„―.ⁿ(π’Š*Ο€)+1).real).to eq(0)
end
end

0 comments on commit 76be397

Please sign in to comment.