Git Product home page Git Product logo

complex's Introduction

Complex

Codacy Badge License MIT CocoaPods Compatible Carthage Compatible Platform Linux Code Coverage

Swift Package Xcode Project Cocoapods Carthage

Complex is a lightweight framework designed for representing and working with complex numbers for iOS, macOS, tvOS, and watchOS.

Installation

Complex is available through CocoaPods, Carthage and the Swift Package Manager.

To install via CocoaPods, simply add the following line to your Podfile:

pod 'Complex'

To install via Carthage, simply add the following line to your Cartfile:

github "SomeRandomiOSDev/Complex"

To install via the Swift Package Manager add the following line to your Package.swift file's dependencies:

.package(url: "https://github.com/SomeRandomiOSDev/Complex.git", from: "1.0.0")

Usage

First import Complex at the top of your Swift file:

import Complex

After importing, use of complex numbers is as simple as can be:

let input = Complex<Double>(real: 4.31, imaginary: 2.0)
let scale = Complex<Double>(real: 1.5, imaginary: 2.718)

let output = input * scale

...

The Complex type also has builtin functionality specific to complex numbers, such as conjugates and modulus/angle (for converting to polar coordinates):

let complex = Complex<Double>(real: 7.0, imaginary: -4.1)

// Equal to 7.0 + 4.1i
let conjugate = ~complex // or complex.conjugate()

let (modulus, angle) = (complex.modulus, complex.angle)

...

Note

The Swift library team has released their own Complex type as part of the Swift Numerics library. This library is likely to be archived in the future unless there is a continued need for this library to continue to be maintained. You can find more information about the new Complex type here

Contributing

If you have need for a specific feature or you encounter a bug, please open an issue. If you extend the functionality of Complex yourself or you feel like fixing a bug yourself, please submit a pull request.

Author

Joe Newton, [email protected]

License

Complex is available under the MIT license. See the LICENSE file for more info.

complex's People

Contributors

somerandomiosdev avatar

Stargazers

Narcis avatar  avatar  avatar Aaron Brasington avatar Tim Kersey avatar Seif Kobrosly avatar Yaroslav avatar  avatar Indrajit Chakrabarty avatar AI avatar Parsia Hedayat avatar

Watchers

James Cloos avatar  avatar

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.