Problems with With/Block/Module functions
- To: mathgroup at smc.vnet.net
- Subject: [mg64259] Problems with With/Block/Module functions
- From: "Mukhtar Bekkali" <mbekkali at gmail.com>
- Date: Wed, 8 Feb 2006 03:53:53 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Hi:
I want to use local assignment done for a subscripted variable, where
x1 is ought to be read as x subscript 1, and evaluate at local values
function g[x1] and use the result later on. My code (not actual, just
an example) is as follows:
x1=0;
With[{x1=1},y=g[x1]] (* is some specific arbitrary function, say x1^2
*)
y
My error message is "Local variable specification {x1=0} contains x1=0
which is an assignment to x1; only assignments to symbols are allowed"
Where on earth does Mathematica see a function in x1. To me this is
just a symbol. Please advise on a workaround. Thanks.