[LON-CAPA-cvs] cvs: modules /gerd/texas/samples midRange.txt

www lon-capa-cvs@mail.lon-capa.org
Fri, 17 Nov 2006 20:03:19 -0000


www		Fri Nov 17 15:03:19 2006 EDT

  Added files:                 
    /modules/gerd/texas/samples	midRange.txt 
  Log:
  Mid-range complexity problem sample
  
  

Index: modules/gerd/texas/samples/midRange.txt
+++ modules/gerd/texas/samples/midRange.txt
/* Molar Mass 01
ATKINS 301 %keywords

The E[] array contains the compounds

The N[][6] array contains compound information:
1 -- element 1 atomic number
2 -- no of moles of element 1
3 -- element 2 atomic number
4 -- no of moles of element 2
5 -- element 3 atomic number
6 -- no of moles of element 3

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% quest 1
Find the molar mass of @CS.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% expl 1
The formula weight of a compound is based on the atomic
weights of the elements in the compound.

Each mole of @CS contains @n1 of @ES1, @n2 of @ES2, and @n3
of @ES3.
We know the atomic masses of each of these elements from the
periodic table.
Using these atomic masses we calculate the grams of each of
these elements in one mole of @CS:
$$\eqalignno{?\hbox{ g from @ES1}
&= @n1\hbox{ @ES1} \times {@aw1\hbox{ @ES1}\over
1\hbox{ mol @ES1}}\cr
&= @a1\hbox{ @ES1}\cr
?\hbox{ g from @ES2}
&= @n2\hbox{ @ES2}
\times {@aw2\hbox{ @ES2}\over 1\hbox{ mol @ES2}}\cr
&= @a2\hbox{ @ES2}\cr
?\hbox{ g from @ES3}
&= @n3\hbox{ @ES3} \times {@aw3\hbox{ @ES3}\over
1\hbox{ mol @ES3}}\cr
&= @a3\hbox{ @ES3}\cr
}$$
To obtain the mass of one mole of @CS we add the masses
of the component parts.
This is the formula weight:

? g/mol @CS \hfil\break\strut\hfill
$\eqalign{
&= @a1 + @a2+ @a3\cr
&= {@af\hbox{ @CS}\over\hbox{mol @CS}}
}$
*/

void answer(void) {
/* global char * CS */
/* global char * ES1 */
/* global char * ES2 */
/* global char * ES3 */
/* global double n1 u=mol */
/* global double n2 u=mol */
/* global double n3 u=mol */
/* global double aw1 u=g */
/* global double aw2 u=g */
/* global double aw3 u=g */
/* global double a1 u=g */
/* global double a2 u=g */
/* global double a3 u=g */
/* global double af u=g */
/* global double ans1 u={g/mol} */

int esize,i,e1,e2,e3;
double esizef;

static
char *E[]={
  "${\\rm Al(NO_3)_3}$",           //0
  "${\\rm Al_2(SO_4)_3}$",         //1
  "${\\rm Ba(NO_3)_2}$",           //2
  "${\\rm Ba_3(PO_4)_2}$",         //3
  "${\\rm Ba(NO_3)_2}$",           //4
  "${\\rm Bi(NO_3)_3}$",           //5
  "${\\rm Bi_2(SO_4)_3}$",         //6
  "${\\rm Ca_3(PO_4)_2}$",         //7
  "${\\rm (C_2H_5)_2N_2}$",        //8
  "${\\rm (C_2H_5)_2(NH)_2}$",     //9
  "${\\rm (C_2H_5)_3N}$",          //10
  "${\\rm (CH_3)_3N}$",            //11
  "${\\rm (CH_3)_2NH}$",           //12
  "${\\rm CH_3(CH_2)_{10}COOH}$",  //13
  "${\\rm CH_3(CH_2)_{14}COOH}$",  //14
  "${\\rm CH_3(CH_2)_{16}COOH}$",  //15
  "${\\rm (CH_3CH_2)_3N}$",        //16
  "${\\rm (CH_3)_4Pb}$",           //17
  "${\\rm Co_3(AsO_4)_2}$",        //18
  "${\\rm Co(ClO_4)_2}$",          //19
  "${\\rm Cr(NO_3)_3}$",           //20
  "${\\rm Cu(NO_3)_2}$",           //21
  "${\\rm Fe(NO_3)_3}$",           //22
  "${\\rm Mg(NO_3)_2}$",           //23
  "${\\rm Mg_3(PO_4)_2}$",         //24
  "${\\rm Mn(NO_3)_2}$",           //25
  "${\\rm (NH_4)_2S}$",            //26
  "${\\rm (NH_4)_2Se}$",           //27
  "${\\rm Pb(NO_3)_2}$",           //28
  "${\\rm Pb_3(PO_4)_2}$",         //29
  "${\\rm Zn(NO_3)_2}$",           //30
  "${\\rm Zn_3(PO_4)_2}$"          //31
};

int N[][6]={
  13,1,7,3,8,9,     //0
  13,2,16,3,8,12,   //1
  56,1,7,2,8,6,     //2
  56,3,15,2,8,8,    //3
  56,1,7,2,8,6,     //4
  83,1,7,3,8,9,     //5
  83,2,16,3,8,12,   //6
  20,3,15,2,8,8,    //7
  6,4,1,10,7,2,     //8
  6,4,1,12,7,2,     //9
  6,6,1,15,7,1,     //10
  6,3,1,9,7,1,      //11
  6,2,1,7,7,1,      //12
  6,12,1,24,8,2,    //13
  6,16,1,32,8,2,    //14
  6,18,1,36,8,2,    //15
  6,6,1,15,7,1,     //16
  6,4,1,12,82,1,    //17
  27,3,33,2,8,8,    //18
  27,1,17,2,8,8,    //19
  24,1,7,3,8,9,     //20
  29,1,7,2,8,6,     //21
  26,1,7,3,8,9,     //22
  12,1,7,2,8,6,     //23
  12,3,15,2,8,8,    //24
  25,1,7,2,8,6,     //25
  7,2,1,8,16,1,     //26
  7,2,1,8,34,1,     //27
  82,1,7,2,8,6,     //28
  82,3,15,2,8,8,    //29
  30,1,7,2,8,6,     //30
  30,3,15,2,8,8     //31
};

esize=sizeof(E)/sizeof(char*);
esizef=esize-0.00001;

i=(int)random(0.0,esizef,5.0,1.0);

   CS = E[i];
   e1 = N[i][0];
   e2 = N[i][2];
   e3 = N[i][4];
  ES1 = ATSY(e1);
  ES2 = ATSY(e2);
  ES3 = ATSY(e3);
   n1 = N[i][1];
   n2 = N[i][3];
   n3 = N[i][5];
  aw1 = ATWT(e1);
  aw2 = ATWT(e2);
  aw3 = ATWT(e3);
   a1 = n1 * aw1;
   a2 = n2 * aw2;
   a3 = n3 * aw3;
   af = a1 + a2 + a3;
   ans1 = af;
}