|
-
Mar 2nd, 2004, 06:19 PM
#1
Thread Starter
Fanatic Member
Balancing Chemical Equations
Alright, I have no idea how to start to solve these things, take for example this:
K + Ca(OH)2 --> K(OH) + Ca
-
Mar 3rd, 2004, 06:19 AM
#2
Looking at it from the Math view the left side has (OH)2 which is 2 times (OH).
The rigth only has one of them, so there is something missing.
From the chemical point of view, I HAVE NO CLUE
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
-
Mar 3rd, 2004, 07:24 AM
#3
Frenzied Member
K + Ca(OH)2 --> KOH + Ca
is what's given right?
then you need to make 2 OH's on the other side too:
K + Ca(OH)2 --> 2KOH + Ca
Then you need 2 K's on the left again:
2K + Ca(OH)2 --> 2KOH + Ca
done, all elements balance. remember you can only change the big numbers, not the "sub numbers".
Have I helped you? Please Rate my posts. 
-
Mar 3rd, 2004, 07:43 AM
#4
Thread Starter
Fanatic Member
Sorry, I forgot to mention that I needed some help doing it programmatically, I already know how to do it by hand.
-
Mar 3rd, 2004, 07:48 AM
#5
Frenzied Member
firstly you have to make it parse all the coefficient, elements (also when they're in brackets) and "sub numbers". That's going to be the tricky part, after that simply mulitply until it balances.
Have I helped you? Please Rate my posts. 
-
Mar 3rd, 2004, 08:48 AM
#6
Thread Starter
Fanatic Member
I was thinking something like that would work, however, I was going to try to put the systems inside of a matrix, take the inverse of the matrix and multiply it by the right side of the equation i.e:
Given Equations:
0 = 2y - w
0 = z - x
0 = 3y - 2x
1 = y
Code:
w x y z
[-1 0 2 0 [w [0
0 -1 0 1 X x = 0
0 -2 3 0 y 0
0 0 1 0] z] 1]
Last edited by dsheller; Mar 3rd, 2004 at 03:05 PM.
-
Mar 3rd, 2004, 11:54 AM
#7
Junior Member
How were you planning to relate your matrix to the chemical formula? Are you going to have a system of equations that you want to balance simultaneously???
(BTW, it would look better if you edited your post, formatting the matrix using a fixwidth font. Should be the case if you mark it as code or something.)
Edit: Now it looks much better. Very nice!
Last edited by jskog; Mar 7th, 2004 at 08:28 AM.
-
Mar 3rd, 2004, 02:23 PM
#8
Frenzied Member
Once you've parsed the data, why not just go to the first item on the left, then find how many of those exist on the right, then multiply to match the sides up? Then loop through each element on left. Then loop this n times, where n is the number of elements on the left.
Only problem i see is when you have the same element on one side more than once.
Have I helped you? Please Rate my posts. 
-
Mar 3rd, 2004, 03:06 PM
#9
Thread Starter
Fanatic Member
jksog: Yes I am goign to use a system
Acidic: Yea, the exception case is the problem, there may be a point where there an element is on the right, or left, in 2 areas
-
Mar 3rd, 2004, 06:56 PM
#10
Honestly, you could try brute forcing it. On today's computers (and even yesterday's), only equations with insanely huge (chemically speaking) coefficients would hurt speed.
The time you enjoy wasting is not wasted time.
Bertrand Russell
<- Remember to rate posts you find helpful.
-
Mar 3rd, 2004, 08:59 PM
#11
Thread Starter
Fanatic Member
How would you brute it? Would you rather put random coefficients at random areas or loop through it sequentially and put stuff somewhere, because basically you need all combinations of numbers then add em.
-
Mar 4th, 2004, 12:15 AM
#12
I'd probably try sequential. You might do random; it may offer more optimization opportunities. Still, I have never seen a balanced equation using more than 20 as a coefficient, meaning you'd have to loop through it 20^3*19 (assuming 4 different molecules) or about 160,000 times (theoretical maximum). That really isn't much for a computer, especially if you optimize and pre parse.
The time you enjoy wasting is not wasted time.
Bertrand Russell
<- Remember to rate posts you find helpful.
-
Mar 4th, 2004, 06:17 AM
#13
-
Mar 8th, 2004, 10:34 PM
#14
Fanatic Member
No, he should design a neural network to do it... damn that would be cool.
Don't pay attention to this signature, it's contradictory.
-
Mar 9th, 2004, 04:50 AM
#15
Junior Member
alkatran:
yeah, that'd be cool! but how were you intending to use a NN in this case? it's not like we're dealing with a classification or clustering problem...
Let me know, I'm curious!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|