# Simultaneous equations

What is the concept behind solving simultaneous equations in visual basic?  I want to make a prgram to balance chemical equations, and this is part of it.  the maximum unknowns will probably be 5.  but i am not sure how to do it.  please help.

also, is there any good way of making this balancer?  any suggestions are welcomed.  thanks.
###### Who is Participating?

Commented:
I don't know if there's anything off the shelf to do this; however, solving simultaneous equations using computers is typically done using a technique called Gaussian elimination, which is programmable as compared with the intuitive method that's taught in school.

Here's a link to a page describing the technique:

http://mathworld.wolfram.com/GaussianElimination.html
0

Commented:
I suggest you to use matlab
It will be more fit to balance chemical equations
0

Commented:
yarr, it may call the technique of solving them: matricies

Its a pretty similar idea apart from matricies go on a lot further as to solving more unknowns... its a big thing we did in a maths unit for degree level Computer Science
0

Commented:
There are many ways to solve simultaneous equations.

1) Matrix method
2) Determinant method (Cramer's rule)
3) By direct solving (As we do for 2 unknowns)

Among these most effecient method is 2).
But it is unfortunate that you should use a good algorithm to get the determinant of the matrices of any order. Because you have stated that the number of unknowns may be upto 5.

If you succeed in getting the Determinant then your problem is solved. Determinant can be found by using Recursion Technique.

For ex:
ax + by + cz = p
dx + ey + fz = q
gx + hy + iz = r

can be solved as
x = &#916;1/&#916;
y = &#916;2/&#916;
z = &#916;3/&#916;

where
| a b c |          | p b c |         | a p c |           | a b p |
&#916; = | d e f |  &#916;1 = | q e f |  &#916;2 = | d q f |  &#916;3 =  | d e q |
| g h i |           | r h i |          | g r i |            | g h r |

Good Luck!
0

Commented:
The dotnet framework even has a Matrix class. Unfortunately it's only a 3 x 3 (it's intended for use in graphics processing) so it's not a solution for your problem, but worth a look just for interest's sake.

Also interesting:

http://www.euclideanspace.com/maths/algebra/matrix/

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.