MathGroup Archive 1999

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

Search the Archive

Re: Q: ReplaceAll with pattern in pattern


Hi Christoph,

you must use replace repeated //.

matrix //. shorts /. values

to resolve the additional a.

Hope that helps
  Jens

Christoph wrote:
> 
>  howdy,
> 
> At the top of a notebook i want to define some constants like that:
> 
> shorts={a -> b^2,d -> a/f}
> values={b -> 42,f -> 27}
> 
> and now i want to do some calculations using a,b,d,f as symbols:
> 
> matrix={{a,b},{d,f}}
> 
> and now I need to show the matrix:
> 
> matrix //MatrixForm
> 
> and now I want to know numerical values.
> 
> matrix /.shorts /. values
> 
> but this won't do the job. When the shorts are done, there are still
> some a left, because they were introduced with the second replacement
> rule. Is there any way to do things like that?
> 
> Greetings
>         Christoph
>


  • Prev by Date: Re: "At long last, Sir, have you no shame?"
  • Next by Date: Re: col-vector * row-vector = matrix, how ?
  • Previous by thread: Q: ReplaceAll with pattern in pattern
  • Next by thread: Re: Q: ReplaceAll with pattern in pattern