MathGroup Archive 2007

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

Search the Archive

Re: Problem with With


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