Re: having trouble controling evaluation
- To: mathgroup at smc.vnet.net
- Subject: [mg55895] Re: [mg55878] having trouble controling evaluation
- From: Chris Chiasson <chris.chiasson at gmail.com>
- Date: Sat, 9 Apr 2005 03:55:40 -0400 (EDT)
- References: <200504080537.BAA25216@smc.vnet.net>
- Reply-to: Chris Chiasson <chris.chiasson at gmail.com>
- Sender: owner-wri-mathgroup at wolfram.com
I found my mistake. Thread@x[electrode,#3,wet,0] should be Thread@x[#2,#3,wet,0]
If anyone has already responded to my first email by the time he or
she has read this email, please accept my thanks.
On Apr 8, 2005 1:37 AM, Chris Chiasson <chris.chiasson at gmail.com> wrote:
> 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
>
>
--
Chris Chiasson
Kettering University
Mechanical Engineering
Graduate Student
1 810 265 3161
- References:
- having trouble controling evaluation
- From: Chris Chiasson <chris.chiasson@gmail.com>
- having trouble controling evaluation