MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

having trouble controling evaluation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg55878] having trouble controling evaluation
  • From: Chris Chiasson <chris.chiasson at gmail.com>
  • Date: Fri, 8 Apr 2005 01:37:13 -0400 (EDT)
  • Reply-to: Chris Chiasson <chris.chiasson at gmail.com>
  • Sender: owner-wri-mathgroup at wolfram.com

Dear MathGroup,

In solving for wet mole fractions from given pressures, I am having
trouble controlling evaluation of the Reduce command so that it
actually solves for the variables I intend. In this problem, there is
an anode and a cathode. The first "branch" in each list corresponds to
the anode and the second branch to the cathode.

After evaluating this the first time to see what the last statement is
trying to do, remove the Hold@ from just inside the last MapThread to
see what the current state of the output is.

***How can this code be made to feed Reduce the correct variables at
the correct time?***

To see what the result should be for the cathode case, overwrite
Thread@x[electrode,#3,wet,0] with
{x[cathode,g@o@2,wet,0],x[cathode,g@nn@2,wet,0],x[cathode,g@@{h@2,o@1},wet,0]}
. Notice how the answer for the anode didn't change...

------------Begin Code--------
xdef[P,electrode_,species_,status_,completion_]=
  Equal[x[electrode,species,status,completion],
    P[electrode,species,status,completion]/
      P[electrode,total,status,completion]]
specieslists={{g@h@2,g@@{c@1,o@2},g@@{h@2,o@1}},{g@o@2,g@nn@2,g@@{h@2,o@1}}};
inletmolfrac=
  MapThread[
    Function[{electrode,specieslist},
      Outer[xdef[P,electrode,#1,#2,0]&,specieslist,{wet,dry}]],{{anode,
        cathode},specieslists}]
inletpress=
  MapThread[
    Function[{electrode,
        specieslist},{P[electrode,#,wet,
                0]==(P[electrode,total,wet,0]-
                    P[electrode,g@@{h@2,o@1},wet,0])x[electrode,#,dry,0]&/@
          specieslist[[{1,2}]],
        P[electrode,total,wet,0]==P[electrode,total,dry,0],
        P[electrode,Last@specieslist,dry,0]==0}],{{anode,cathode},
      specieslists}]
(*below is the last command, which I refer to in the text above*)
MapThread[
  Hold@Reduce[
        Eliminate[
          Flatten[{inletpress[[#1]],inletmolfrac[[#1]]},
            Infinity],{P[#2,total,dry,0],P[#2,#3[[1]],dry,0],
            P[#2,#3[[2]],dry,0],P[#2,#3[[1]],wet,0],P[#2,#3[[2]],wet,0]}],
        Thread@x[electrode,#3,wet,0],Backsubstitution->True]&,{{1,2},{anode,
      cathode},specieslists}]
--------End Code-----------

Thank you for your valuable time,
-- 
Chris Chiasson
Kettering University
Mechanical Engineering
Graduate Student
1 810 265 3161


  • Prev by Date: Re: Newly Released Mathematica 5.1 Delivers Unmatched Performance for Handling Data
  • Next by Date: Re: Re: Re: Recommendations for a programming book?
  • Previous by thread: Re: Newly Released Mathematica 5.1 Delivers Unmatched Performance for Handling Data
  • Next by thread: Re: having trouble controling evaluation