Euler

Swift Custom Operators for Mathematical Notation

Github星跟踪图

Euler

Build Status
License
Swift Version

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 letters e to denote the base of the natural logarithm & i to denote the imaginary unit, sin & cos for trigonometric functions, and f(x) to denote the function f with argument x.


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′)(π) // -1

Inventory

Mathematical Constants

Logic

Arithmetic

Sets

Sequences

Vectors

Comparison

Calculus

Functions


License

MIT

Contact

Mattt (@mattt)

主要指标

概览
名称与所有者mattt/Euler
主编程语言Swift
编程语言Swift (语言数: 1)
平台
许可证MIT License
所有者活动
创建于2014-08-05 21:33:35
推送于2021-04-20 16:53:44
最后一次提交2021-04-20 09:53:38
发布数2
最新版本名称1.0.0 (发布于 )
第一版名称0.1.0 (发布于 )
用户参与
星数1.2k
关注者数31
派生数60
提交数88
已启用问题?
问题数3
打开的问题数0
拉请求数2
打开的拉请求数0
关闭的拉请求数11
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?