Re: Problem with With
- To: mathgroup at smc.vnet.net
- Subject: [mg80664] Re: Problem with With
- From: Chris Chiasson <chris.chiasson at gmail.com>
- Date: Tue, 28 Aug 2007 02:15:41 -0400 (EDT)
- References: <fathcf$3s3$1@smc.vnet.net>
On Aug 26, 10:45 pm, Miguel <misv... at gmail.com> wrote:
> Let the matrix M={{Cos[alfa], -Sin[alfa], 0},{Sin[alfa], Cos[alfa],
> 0}, {0, 0, 1}}.
>
> In[]:
> With[{alfa=45=BA}, M]
>
> Out[]:
>
> Out[]: {{Cos[alfa], -Sin[alfa], 0},{Sin[alfa], Cos[alfa], 0}, {0, 0,
> 1}}
>
> Mathematica does'nt evaluate the matrix.
>
> But
>
> In[]:
> {{Cos[alfa], -Sin[alfa], 0},{Sin[alfa], Cos[alfa], 0}, {0, 0,
> 1}}/.alfa->45=BA
>
> works fine.
>
> Any idea?
With performs a replacement (not an assignment) before evaluating its
body. Use Block. Module won't work due to lexical scoping.