Finding an Automated Algorithm to Solve Hess’ Law II

Update: You can see my current progress here. As of now, I have the modified Gaussian elimination completed, meaning part I is now done (unless more matrices break under it). It’s beta code and shouldn’t be considered complete until a battery of linear equations are run against it to check for validity.

Well, it’s been almost one week since I started working on this problem. To start off, I had several great answers from my question posted on LinkedIn, but it was shut down since someone flagged it as “commercial services”, which it really isn’t, but the person who shut down the problem clarified why it was, and that made sense.

Overall, I put out $100 because I wanted to put my money where my mouth was – it gave this problem value to others, and it also motivated me to work on it, as I was putting my own money on the line.

Anyways, I’ll be splitting the $100 to two people who were really helpful with providing their own pseudo-algorithms for this, Viacheslav Usov and Mkrtich Laziev, which helped me find a path towards developing an algorithm to do what I want.

I’ve spent probably over 15 hours on this program and managed to finish 99% of my initial code to solve the matrices that may represent Hess Law equations (I’ll explain why I said may at the end). I’ll never know if it’s possible to solve these problems until I run a lot of problems against the algorithm to see if I can get the expected values.

Then, there’s another issue once I feel I’m done with my algorithm. Although at first I thought I figured out how to translate a set of chemical equations to a matrix, there are some special cases where I cannot fit the equations into the rules that I use to form the matrix. Instead, I have to re-arrange it a bit to have a proper matrix that is solvable.

By the end of this, I hope to:

1. Have a PHP version of my own algorithm for Gaussian elimination with partial partitioning, backsubbing, as well as a least squares algorithm implemented. (99% done),

2. Be able to demonstrate that with any given Hess Law set of equations, that it can be applied to a matrix and that there will be one unique solution (assuming the set of equations has a solution, as textbooks tend to).

Needless to say, it’s been really fun doing this so far. I’ve never been so involved in working with algorithms or math for that matter. I had to do hours of research on linear algebera and figure out with my limited knowledge how to translate scary math notation into code.

Finding an Automated Algorithm to Solve Hess’ Law

Last week in my chemistry class, I was exposed to Hess’ Law and while doing some example problems in class, I immediately wondered if there was some way to apply linear algebra to automagically solve the equations. I asked my professor if he knew if linear algebra could be applied to solve them, but he said he was unsure since he’s actually not a math person.

I really hate throwing things like that out in class where it doesn’t really apply to what’s being taught (you know, those jerks that ask these stupid wiseguy questions in class just to look like they know more than everyone else), but I just had to get some affirmation if it was possible.

During the weekend I tried to see if I can do it with matrix operations, but I eventually realized that the linear algebra I know is too limited to find a solution. I’ve completely mapped out what the problem looks like, I know how it can be solved via human guess and check, but I really feel there’s a set of consistent mathematical operations that would just give me what I need (kind of like gaussian elimination to solve linear systems of equations).

If anyone knows the algorithm, I will give $100 USD to the first person who does. Note that I’ve also posted this on LinkedIn, meaning whoever is the first, gets it. The algorithm needs to be able to solve all matrices that can be assembled from problems found in Hess’ Law without human intervention (other than inputting initial and final values of the problem). What I’m looking for is an automatic generation of the intermediate Xn values that are required to multiply each row to get the final values.

Edit 1: Piyush Pant discovered that Wolfram Alpha can be used to solve these problems. However, it does not give the algorithm.

http://www95.wolframalpha.com/input/?i=Solve+{w,x,y,z}.{{1,0,0,-3,-1,3,0},+{0,2,3,0,-1,0,0},+{0,0,1,0.5,0,0,-1},{0,0,0,0,0,-1,1}}%3D{-2,4,0,3,0,0,0}

Here is an actual application of this possible algorithm:

Solution: http://www95.wolframalpha.com/input/?i=Solve+{w%2Cx}.{{1%2C3%2C-2%2C-3%2C0}%2C+{0%2C3%2C-2%2C-2%2C1}}%3D{-1%2C0%2C0%2C1%2C1}