mattt/euler
Euler uses [custom operators in the "Math Symbols"](https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#ID418) character set to implement functions using traditional mathematical notation.
Example Usage
import Foundation
import Euler
import PlaygroundSupport
𝑒 // 2.718281828459045
¬true // false
3 × 4 // 12
let prime = [2, 3, 5, 7, 11]
let fibonacci = [1, 1, 2, 3, 5, 8, 13]
prime ∩ fibonacci // {2, 3, 5}
∑[1, 2, 3, 4, 5] // 15
[1, 2] ⋅ [3, 4] // 11
7 ≠ 9 // true
var f: (Double) -> Double = sin
let g: (Double) -> Double = cos
for x in stride(from: 0, to: 4 * π, by: π / 8) {
(f ∘ g)(x) // ∿∿∿
}
(f′)(π) // -1Inventory
Mathematical Constants
π- Pi𝝉- Tau𝑒- eε- Machine Epsilon
Logic
¬,~- Logical Negation∧- Logical Conjunction∨- Logical Disjunction⊻,⊕,↮,≢- Logical XOR⊼,↑- Logical NAND⊽,↓- Logical NOR⊦- Logical Assertion
Arithmetic
×- Multiplication÷,∕- Division√- Square Root∛- Cube Root∜- Tesseract Root±- Plus/Minus∓- Minus/Plus∣- Divides∤- Does Not Divide
Sets
∈- 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
Sequences
∑- Summation∏- Cartesian Product
Vectors
⋅- Dot Product×- Cross Product‖- Vector Norm⦡- Angle Between Vectors
Comparison
Calculus
′- Derivative∫- Integral
Functions
∘- Composition
License
MIT
Contact
Mattt (@mattt)
[ci status]: https://github.com/mattt/Euler/actions [ci status badge]: https://github.com/mattt/Euler/workflows/CI/badge.svg [license]: http://img.shields.io/badge/license-MIT-blue.svg?style=flat [license badge]: http://img.shields.io/badge/license-MIT-blue.svg?style=flat [swift version]: https://swift.org/download/ [swift version badge]: http://img.shields.io/badge/swift%20version-5.0-orange.svg?style=flat
Package Metadata
Repository: mattt/euler
Default branch: master
README: README.md