kasonchan / equations   0.1.1

Apache License 2.0 GitHub

Solve equations.

Scala versions: 2.11

Equations

Build Status codecov.io Codacy Badge

Equations is a thin layer library for calculating one unknown equations. Its mission is to provide the developers simple and robust API primitives to build their mass balance equations.

Modules

Equations uses multi-project structure and contains of the following modules:

Installation

Every Equations module is published at Maven Central. Use the following sbt snippet ...

  • for the stable release:
libraryDependencies ++= Seq(
  "com.kasonchan" %% "[equations-module]" % "0.1.1"
)
  • for the SNAPSHOT version:
resolvers += Resolver.sonatypeRepo("snapshots")

libraryDependencies ++= Seq(
  "com.kasonchan" %% "[equations-module]" % "0.1.1-SNAPSHOT" changing()
)

Hello World

This "Hello World!" example is built with the 0.1.1 version.

import equations.massbalance.MassBalance._

// 10 * 20 + 5 * 40 = x * 15
svala> val inputs = List(MX(Some(10), Some(20)), MX(None, Some(40)))
scala> val outputs = List(MX(None, Some(15)))
scala> solveMX(inputs, outputs)
Some(26.7)

// 50 * 10 * (100 - 15) / 100 = y * 25
scala> inputs = List(MX(Some(50), Some(10), Some(15)))
scala> outputs = List(MX(None, Some(25)))
scala> solveMX(inputs, outputs)
Some(17)
import equations.monooperation.MonoOperation._

// x = 3 + 4
scala> solveM(List(None), List(Some(3), Some(4)), 'add)
Some(7.0)

// 25 = x * 5
scala> solveM(List(Some(25)), List(None, Some(5)), 'multiple)
Some(5.0)

Documentation

License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this software except in compliance with the License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.