// create the function to graph
let f = system.function(withName: "f", variables: [system.variable(withSymbol: "x")])
f.value = try! Expression(string: "x + 1", system: system)
// create the graph itself
let graph = GraphScene(size: CGSize(width: 500, height: 500))
graph.functions.append((f, true, .red))
graph.update() // scene is now an SKView that displays the graph of f(x) = x + 1
MathKit
Features
Simplifies expressions
Factors expressions
Solves equations
Analytically finds derivitives of functions
Graphs functions
Installation
Swift Package Manager
Add
MathKit
as a dependency in yourPackage.swift
file:Manually
Simply download and drop
Sources/MathKit
into your project.Usage Example
Before we do anything, we have to import
MathKit
and set up aSystem
:Simplify or Factor an Expression
Solve an Equation
Find Derivative
Graph Function
Meta
William Stevenson – liam923@verizon.net
Distributed under the MIT license. See
LICENSE
for more information.https://github.com/liam923