Euler uses custom operators in the "Math Symbols" character set to implement functions using traditional mathematical notation.
Please keep in mind that this is not intended or recommended for production. Custom operators of any breed are ripe for misuse and abuse, and should be used with as much care and caution as you would something like method swizzling or complex macros.
Euler is much better-suited to a Playground, where it could be used for teaching and learning logic and mathematics using a more vernacular notation.
Euler is named after Leonhard Euler, the Swiss mathematician credited for the popularization of modern mathematical notation such as the Greek letters
Σ
for summation &π
for the ratio of a circle's circumference to its diameter, the letterse
to denote the base of the natural logarithm &i
to denote the imaginary unit,sin
&cos
for trigonometric functions, andf(x)
to denote the functionf
with argumentx
.
The infrastructure and best practices for distributing Swift libraries is currently being developed by the developer community during this beta period of the language and Xcode. In the meantime, you can simply add Euler as a git submodule, and drag the Euler.swift
file into your Xcode project.
¬
,~
- Logical Negation∧
- Logical Conjunction∨
- Logical Disjunction⊻
,⊕
,↮
,≢
- Logical XOR⊼
,↑
- Logical NAND⊽
,↓
- Logical NOR⊦
- Logical Assertion
×
- Multiplication÷
,∕
- Division√
- Square Root∛
- Cube Root∜
- Tesseract Root±
- Plus/Minus∓
- Minus/Plus∣
- Divides∤
- Does Not Divide
∈
- Set Membership∉
- Set Non-Membership∋
- Converse Set Membership∌
- Converse Set Membership∩
- Set Intersection∪
- Set Union⊆
- Subset⊂
- Proper Subset⊄
- Not A Subset Of⊇
- Superset⊃
- Proper Superset⊅
- Not A Superset Of
∑
- Summation∏
- Cartesian Product
⋅
- Dot Product×
- Cross Product‖
- Vector Norm⦡
- Angle Between Vectors
⩵
- Equality≠
- Inequality≤
- Less Than Or Equal To≨
- Less Than And Not Equal To≥
- Greater Than Or Equal To≩
- Greater Than And Not Equal To≬
- Between≈
- Approximate Equality≉
- Approximate Inequality
∘
- Composition
Mattt Thompson
Euler is available under the MIT license. See the LICENSE file for more info.