Re: Reduce bug report
- To: mathgroup at smc.vnet.net
- Subject: [mg56293] Re: Reduce bug report
- From: Peter Pein <petsie at arcor.de>
- Date: Thu, 21 Apr 2005 05:36:11 -0400 (EDT)
- References: <d45aqd$ij2$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Chris Chiasson wrote:
> I am sending this to MathGroup first in the hope that I am wrong.
>
> In the code below, I give two sets of equations. On Mathematica 5.0
> for Windows, the Reduce command does not finish evaluation if Most@ is
> removed from the second equation set.
>
> I have done my best to make sure the problem is well posed by making
> sure there are exactly as many equations as unknowns (less unit
> variables) and by telling Mathematica that all units are nonzero.
>
> Reduce can easily handle it if the last equation of the "defining
> equations" (prob2[defineqns]) is separate system from the rest of the
> equations, but this should be unnecessary.
>
> I realize that it is possible I have made a mistake in posing the
> problem to Mathematica; if so, please enlighten me.
>
> prob2[given]={\[ScriptCapitalN][3600]\[Equal](3600*Circle)/Minute,
> BT[max,3600]\[Equal](236*Meter*Newton)/Radian,\[ScriptCapitalN][
> 5500]\[Equal](5500*Circle)/Minute,BP[max,5500]\[Equal]100*Kilo*Watt,
> z\[Equal](2*Circle)/Cycle,Vd\[Equal]3*Liter,\[Eta][mech]\[Equal]9/10,
> sfc\[Equal](9*Kilogram)/(100*Joule*Mega),
> LHV\[Equal](44*Joule*Mega)/Kilogram,CR\[Equal]89/10,k\[Equal]7/5}
>
> prob2[defineqns]=
> Most@{BP[max,3600]\[Equal]BT[max,3600]*\[ScriptCapitalN][3600],
> BP[max,5500]\[Equal]BT[max,5500]*\[ScriptCapitalN][5500],
> BMEP[max,3600]\[Equal](2*Pi*Radian*z*BT[max,3600])/(Circle*Vd),
> BMEP[max,3600]/IMEP[max,3600]\[Equal]\[Eta][mech],
> BMEP[max,5500]\[Equal](2*Pi*Radian*z*BT[max,5500])/(Circle*Vd),
> BMEP[max,5500]/IMEP[max,5500]\[Equal]\[Eta][mech],\[Eta][
> ind]\[Equal]1/(LHV*sfc),\[Eta][otto]\[Equal]1-(CR^(-1))^(-1+k)}
>
> prob2[units]={Circle,Cycle,Joule,Kilo,Kilogram,Liter,Mega,Meter,Minute,Newton,
> Radian,Watt}
>
> prob2[redvars]={CR,k,LHV,sfc,Vd,z,BMEP[max,3600],BMEP[max,5500],BP[max,3600],
> BP[max,5500],BT[max,3600],BT[max,5500],IMEP[max,3600],
> IMEP[max,5500],\[ScriptCapitalN][3600],\[ScriptCapitalN][5500],\[Eta][
> ind],\[Eta][mech],\[Eta][otto]}
>
> prob2[numsoln]=
> Refine[Reduce[Flatten@{prob2[given],prob2[defineqns]},prob2[redvars],
> Backsubstitution->True],#!=0&/@prob2[units]]
>
> Regards,
Hi Chris,
Reduce does too much work and uses too much time and memory in this
case. Simply try in place of your assignment to prob2[numsoln]:
prob2[presoln] = Solve[Flatten[{prob2[given], Most[prob2[defineqns]]}],
Most[prob2[redvars]]];
prob2[numsoln] = {Join[prob2[presoln][[1]],
Simplify[First[Solve[Last[prob2[defineqns] /. prob2[presoln]],
Last[prob2[redvars]]]]]]}
This ends almost immediately and the memory usage is moderate compared
to Refine/Reduce.
--
Peter Pein
Berlin