Skip to content

Instantly share code, notes, and snippets.

@aopell
Last active February 16, 2017 22:49
Show Gist options
  • Select an option

  • Save aopell/7264446ac02e05b5e8f2964b3b8b79d8 to your computer and use it in GitHub Desktop.

Select an option

Save aopell/7264446ac02e05b5e8f2964b3b8b79d8 to your computer and use it in GitHub Desktop.
Calculated rate of reaction for Chem Lab 7 - Results and graph here: https://goo.gl/NlgIoD
#include <stdio.h>
#define RATE_CONSTANT 20 //in L/(mol*s)
#define TIME_STEP 0.001 //in s
double hso3minus = 0.01; //in mol /L
double io3minus = 0.015; //in mol/L
double time = 0.001; //in seconds
double rate = 0; //in mol/(L*s)
int main() {
while(hso3minus > 0.0025) {
rate = RATE_CONSTANT * hso3minus * io3minus * TIME_STEP;
hso3minus -= (rate * 3); //decreases 3 times as fast as IO3-
io3minus -= rate;
printf("%f\t%f\t%f\t%f\n",time,hso3minus,io3minus,rate);
time += TIME_STEP;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment