Group Abstract Group Abstract

Message Boards Message Boards

0
|
6.5K Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Why does this simple substitution (ReplaceAll) fail?

Posted 12 years ago
POSTED BY: Jerry
2 Replies
POSTED BY: Nasser M. Abbasi
Posted 12 years ago

Many thanks, Nasser, for your clear answer.

I’m obviously a bit of a noob with Mathematica which is maybe why I got confused. I think another explanation would be to render the desired result without the postfix notation, that is,

ReplaceAll[Product[Sin[aList[[i]]], {i, 1, Length[aList]}], aList -> {1, 1/2}]

which more clearly indicates that Length will be evaluated before ReplaceAll.

Oddly, (or not so oddly once you see the pattern with some of the Mathematica documentation), the ReplaceAll function syntax is not provided in the Mathtematica documentation, only the postfix /. .

POSTED BY: Jerry
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard