perdanax.blogg.se

Chemical equation balancer alum
Chemical equation balancer alum






For example: (H 2O) 6, (C(OH) 3) 2.Ī Term object is a list of ChemElem or Group objects, with an integer electric charge for the whole term. For example: Fe, H 2.Ī Group object is a parenthesized list of ChemElem or Group objects, with a positive integer repetition count for the whole group. The exception is that e by itself represents an electron.Īn ChemElem object is a chemical element with a positive integer repetition count. For example, these are elements: H, Na, Uuq. How it works Data representationĪ raw chemical element is a string of letters that begins with an uppercase letter and is followed by any number of lowercase letters. In this case, each term that has a negative coefficient should be put on the other side of the equation, and its new coefficient should be the absolute value of the negative coefficient. Note: For simplicity of implementation, if the equation is successfully balanced but one or more terms have a negative coefficient, the program doesn’t consider this outcome to be an error condition. This error should not happen, but if it does please contact me. The author/programmer made a serious logic mistake.

#Chemical equation balancer alum code#

There is no workaround the code would need to be rewritten to use bigints. I don’t expect this error to occur for real-world chemical formulas, only deliberately contrived ones. Your equation used numbers that are too big, or a term has an element that occurs too many times, or the internal calculation used numbers that are too big. Furthermore, the equation can be separated as H → H 2 and O → O 2, each of which does have a unique solution. For example, H + O → H 2 + O 2 has no unique solution because two solutions are 2H + 4O → H 2 + 2O 2 and 6H + 2O → 3H 2 + O 2, which are not multiples of each other. Your equation can be considered as two or more independent equations added together. There exist multiple solutions to your equation that are not simply multiples of each other. For example, C → N 2 has no solution because the only solution is 0C → 0N 2. The only mathematical solution to your equation has all coefficients set to zero, which is a trivial solution for every chemical equation. Check each letter carefully, and follow the examples as a guide to the correct syntax. Your input does not describe a proper chemical equation. Syntax guide Feature & demoįoo 5+ + Bar 3− → FooBar 2 + FooBar − The source TypeScript code and compiled JavaScript code are available for viewing. This program was hand-written in JavaScript in year 2011, received minor feature updates and clarifications and refactorings throughout the years, and was ported to TypeScript in 2018. Because the program is entirely client-side JavaScript code, this web page can be saved and used offline. The algorithm used is Gauss-Jordan elimination, slightly modified to operate using only integer coefficients (not fractions). The program calculates the coefficients to balance your given chemical equation. This is an easy-to-use, no-nonsense chemical equation balancer. Please let us know how we can improve this web app.Chemical equation balancer (JavaScript) Program Input:

  • calcium hydroxide + carbon dioxide = calcium carbonate + waterĮxamples of the chemical equations reagents (a complete equation will be suggested):.
  • PhCH 3 + KMnO 4 + H 2SO 4 = PhCOOH + K 2SO 4 + MnSO 4 + H 2O.
  • To enter an electron into a chemical equation use + H 2O.
  • Compare: Co - cobalt and CO - carbon monoxide
  • Always use the upper case for the first character in the element name and the lower case for the second character.Ğxamples: Fe, Au, Co, Br, C, O, N, F.
  • Enter an equation of a chemical reaction and click 'Balance'.
  • Instructions on balancing chemical equations:






    Chemical equation balancer alum