Re: Iterative constants and variables definitions
- To: mathgroup at smc.vnet.net
- Subject: [mg69710] Re: Iterative constants and variables definitions
- From: dimmechan at yahoo.com
- Date: Thu, 21 Sep 2006 07:30:15 -0400 (EDT)
- References: <eeqpsj$ofu$1@smc.vnet.net>
Very good your attempt.
I do not have anything to suggest/comment apart from
that you could do all these using Block.
Block[{a = 1, c = 2, b = 7*a}, a*b*c]
14
Module cannot be applied here
Module[{a = 1, c = 2, b = 7*a}, a*b*c]
14*a
Use Trace to see why
Trace[With[{a=1,c=2,b=7 a},a b c]]
{With[{a=1,c=2,b=7 a},a b c],(7 a) 2,2 (7 a),2 7 a,14 a}
Trace[Block[{a=1,c=2,b=7 a},a b c]]
{Block[{a=1,c=2,b=7 a},a b c],{a=1,1},{c=2,2},{b=7 a,7 a,{a,1},7 1,7},
{{a,1},{b,7 a,{a,1},7 1,7},{c,2},7 2,14},14}
Trace[Module[{a=1,c=2,b=7 a},a b c]]
{Module[{a=1,c=2,b=7 a},a b c],{a$17=1,1},{c$17=2,2},{b$17=7 a,7 a},
{{a$17,1},{b$17,7 a},{c$17,2},(7 a) 2,2 (7 a),2 7 a,14 a},14 a}
Regards
Dimitris