Giter VIP home page Giter VIP logo

mathematicus's Introduction

Mathematicus

A swift library for mathematics, aiming at ease of use and average performance. Purely written in swift and makes use of swift's powerful features. This is currently a testing version of software. When the first version is published, I will add Carthage and Swift Package Manager support!

##Why Mathematicus

Swift is an industrial level language, and its protocol-oriented programming style, full support on functional programming and numerous modern features make it a great language. But there is something surely left, that is, a library for mathematics.

I'm working on a small mathematical library for swift to support commonly used math, for example, ordinary differential equations, complex numbers, and polynomials.

It employs a ,some how, strange design pattern to make full use of swift's all powerful protocol oriented programming style, namely, the Theoretical Protocols. This is just defining protocols, which has no actual contents. Doing this is because of mathematics is full of coincidence(maybe there is a better word for this since they are actually due to higher level theorems), and the compiler knows nothing about functional analysis or something like that. This trick aims at making the code as clear and expressive as possible.

##Basic Usage For example, I want to use Mathematicus for my 3-body simulation. I want record my particles' positions and velocities in a large vector, I simply do the following:

let v = Vector<Double>(contents: [])
v.contents.appendContentsOf(initialPositionsAndVelocities)

and then setup my gravitational field, by creating a function to evaluate the derivatives.

Finally, it is easy to solve ordinary differential equations:

let data = OrdinaryDifferentialEquation<Double>(dimension: 18, initial: v, equations: equationsFromPhysicalFormulas).solve(terminatingTime: 10, step: 0.001)

//data: [Vector<Double>]

##Present

Now it is a personal project, and many important features are missing due to the lack of time.

It is in swift 3.0 now. It makes no use of system frameworks so it can be used Linux and legacy apple platforms. ##Future

Mathematicus will adopt high performance algorithms. And it will(for the present plan) support matrices, signal processing, and symbolic expressions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.