Unexpected Behavior: SetDelayed versus Set
- To: mathgroup at smc.vnet.net
- Subject: [mg120303] Unexpected Behavior: SetDelayed versus Set
- From: blamm64 <blamm64 at charter.net>
- Date: Mon, 18 Jul 2011 06:13:00 -0400 (EDT)
Group,
Please consider the following:
gc = 3217*(10^-2)*12;
orificeCD=65*(10^-2);
kTorificeL=1/(orificeCD^2);
reyTorifice=12;
cLohm=(117*(10^-4))*1714*(385*(10^-2));
nuStd=19*155*(10^-5); rhoStd=3014*(10^-5);
aLinQS[area_]:=(kTorificeL*reyTorifice*nuStd*rhoStd)/
(2*area*2*Sqrt[area/Pi]*gc);
bQuadQS[area_]:=(kTorificeL*rhoStd)/(2*gc*area^2);
Clear[taSD,taS,area,l,q];
taSD[l_,q_] := area/.Solve[((l*q)/cLohm)^2==q*(aLinQS[area]
+bQuadQS[area]*q),area];
taS[l_,q_] = area/.Solve[((l*q)/cLohm)^2==q*(aLinQS[area]
+bQuadQS[area]*q),area];
{Dimensions[taSD[l,q]],Dimensions[taS[l,q]]}
{{4},{4}}
lm=485;qm=1925*(10^-3);
N[taSD[lm,qm]]//InputForm
{0.0015350502096417261}
N[taS[lm,qm]]//InputForm
{-0.0015301809337073798 - 4.86928826122106*^-6*I,
-0.0015301809337073798 + 4.86928826122106*^-6*I,
0.0015253116577730662, 0.0015350502096416934}
Now, this is really unexpected to me, especially in light of the of
the Dimensions result where Symbols are substituted in the rhs of both
definitions.
For some unknown to me reason the SetDelayed definition returns the
last member of the solution set when the rhs of the SetDelayed
definition has numerial values for <l> and <q>.
Obviously, again, I am missing something; but this time whatever it is
I am missing has me gasping for air.
-Brian L.
- Follow-Ups:
- Re: Unexpected Behavior: SetDelayed versus Set
- From: DrMajorBob <btreat1@austin.rr.com>
- Re: Unexpected Behavior: SetDelayed versus Set
- From: Leonid Shifrin <lshifr@gmail.com>
- Re: Unexpected Behavior: SetDelayed versus Set