Matice
Reaktanty | Produkty | ||||||
C2H2 | KMnO4 | H2SO4 | CO2 | MnSO4 | KHSO4 | H2O | |
a | b | c | p | q | r | s | |
C | 2 | 1 | |||||
H | 2 | 2 | 1 | 2 | |||
K | 1 | 1 | |||||
Mn | 1 | 1 | |||||
O | 4 | 4 | 2 | 4 | 4 | 1 | |
S | 1 | 1 | 1 | ||||
náboj |
Bilance prvků
|
+ 2·a | = | + 1·p |
|
+ 2·a + 2·c | = | + 1·r + 2·s |
|
+ 1·b | = | + 1·r |
|
+ 1·b | = | + 1·q |
|
+ 4·b + 4·c | = | + 2·p + 4·q + 4·r + 1·s |
|
+ 1·c | = | + 1·q + 1·r |
Bilance elektronů (náboje)
Zadání pro program Mathematica
eqns = { + 2*a== + 1*p, + 2*a + 2*c== + 1*r + 2*s, + 1*b== + 1*r, + 1*b== + 1*q, + 4*b + 4*c== + 2*p + 4*q + 4*r + 1*s, + 1*c== + 1*q + 1*r, +0*a +0*b +0*c== +0*p +0*q +0*r +0*s} Solve[eqns]
Neznámých koeficientů je: 7, počet nezávislých rovnic je: 6. Počet stupňů volnosti je tedy: 7 - 6 = 1. Jedno z možných řešení je:
a = 1; b = 2; c = 4; p = 2; q = 2; r = 2; s = 4Zadání (program Octave/Matlab) reaction_id-1-3.m
% % Jiri Jirat % Prague Institute of Chemical Technology % % % matice - 1. sloupec naboj, dalsi sloupce prvky % a = [ 0,2,2,0,0,0,0; 0,0,0,1,1,4,0; 0,0,2,0,0,4,1; 0,1,0,0,0,2,0; 0,0,0,0,1,4,1; 0,0,1,1,0,4,1; 0,0,2,0,0,1,0] hodnost = rank(a) % hodnost matice = pocet nezavislych rovnic b = a' % transpozice matice c = null(b) % nalezeni baze nuloveho prostoru matice b reseni = rref(c') % upravy na "row reduced echelon form"
Řešení (program Octave/Matlab)
a = 0 2 2 0 0 0 0 0 0 0 1 1 4 0 0 0 2 0 0 4 1 0 1 0 0 0 2 0 0 0 0 0 1 4 1 0 0 1 1 0 4 1 0 0 2 0 0 1 0 hodnost = 6 b = 0 0 0 0 0 0 0 2 0 0 1 0 0 0 2 0 2 0 0 1 2 0 1 0 0 0 1 0 0 1 0 0 1 0 0 0 4 4 2 4 4 1 0 0 1 0 1 1 0 c = -0.14286 -0.28571 -0.57143 0.28571 0.28571 0.28571 0.57143 reseni = 1.0000 2.0000 4.0000 -2.0000 -2.0000 -2.0000 -4.0000
Zadání (program Mathematica)
m = { {0,2,2,0,0,0,0}, {0,0,0,1,1,4,0}, {0,0,2,0,0,4,1}, {0,1,0,0,0,2,0}, {0,0,0,0,1,4,1}, {0,0,1,1,0,4,1}, {0,0,2,0,0,1,0}} NullSpace[Transpose[m]]