GithubHelp home page GithubHelp logo

a-stickan / chemical-equation-autobalancer Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 32 KB

Automatically balances chemical equations using C++ and linear algebra

License: MIT License

C++ 100.00%
cpp cpplibrary chemistry linear-algebra header-only

chemical-equation-autobalancer's Introduction

Chemical Equation Autobalancer

  • Greatly simplifies the process of balancing chemical formulas through the use of C++ and linear algebra
  • A console GUI provided on the latest release, making running the program simple and easy for beginners
  • For more advanced users, the single header library ("Balancer.h") has a great variety of functions in the "linear" namespace that can be used to easily enhance any chemistry-based project or repo

How it works (GUI)

  • Enter your chemical equation like in the example below

B2S3 + H2O ---> H3BO3 + H2S

  • In a few seconds, your balanced equation will be output to the screen

1.000000B2S3 + 2.000000H2O ---> 6.000000H3BO3 + 3.000000H2S

Basic Documentation

  • std::vector<std::vector> rref(std::vector<std::vector> matrix)

Converts any inputted 2D square vector matrix into its reduced row echelon form which is then returned (the result technically isn't in true RREF, moving the pivot rows into the correct diagonal formation would cause some issues with the later calculations).

  • std::vector doubleToInt(std::vector<std::vector> matrix)

Gets the long double solution values in a RREF matrix to integer values (or at least fairly close). Returns the solution set of of the RREF matrix with the integer approximations.

  • std::vector<std::vector> matrixInitializer(std::string input)

Creates and returns a 2D square vector matrix that fits the inputted chemical reaction in question. Each compound occupies a column, each unique element occupies a row.

  • std::string stoichSolver(std::string manual_input = "")

Pieces together many of the functions to give the user their solved chemical equation as a string. If avoiding using the GUI, a chemical equation can be entered as a parameter.

chemical-equation-autobalancer's People

Contributors

a-stickan avatar

Stargazers

 avatar

Watchers

 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.