MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Problem with With

  • To: mathgroup at smc.vnet.net
  • Subject: [mg80659] Re: Problem with With
  • From: Szabolcs <szhorvat at gmail.com>
  • Date: Tue, 28 Aug 2007 02:13:05 -0400 (EDT)
  • Organization: University of Bergen
  • References: <fathcf$3s3$1@smc.vnet.net>

Miguel 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 With[], the replacement is done *before* M is evaluated.
Try using With[{alfa = A}, Evaluate[M]].

Szabolcs


  • Prev by Date: Re: More on "save as PDF" page size issues
  • Next by Date: Save notebooks as hierarchy of Web pages in V6?
  • Previous by thread: Problem with With
  • Next by thread: Re: Problem with With