The Mathematica Journal
Departments
Current Issue
Tricks of the Trade
In and Out
Riemann Surfaces IIc
The Mathematica Programmer
New Products
New Publications
Classifieds
Calendar
News Bulletins
Library
Editor's Pick
Mailbox
FAQ
Write Us
About the Journal
Staff and Contributors
Submissions
Subscriptions
Advertising
Back Issues
Home
Download This Issue

Associativity

Q: I have defined the operator in the following way:

When I type in

I get the correct result. But when I try to compute

the input is returned. How can I specify the operator in a general way?

A: Hartmut Wolf (hwolf@debis.com) writes: If you consult Section A.2.7 of The Mathematica Book, you will find that the operator is fully associative. Definitions respecting associativity will work without problem. Noting that , an associative definition that works for any number of arguments is

Another natural extension of the original definition is the sequence

This will, in general, lead to different results than the definition above. An associative definition for an arbitrary number of arguments is immediate.

David Park (djmp@earthlink.net) writes: Either use parentheses, since your definition only accommodates two arguments,

or extend the definition of to more than two arguments by adding the (right-association) rule

Now the desired result is obtained without using parentheses.

Note that is the addition formula for capacitors in series or resistors in parallel.

As another example, the following approach makes it straightforward to implement the velocity addition formula of special relativity for an arbitrary number of velocities, where is the speed of light.

Relativistic addition of to gives .

Ordinary addition of the following three velocities exceeds .

However, relativistic addition leads to a result less than .

In special relativity, the rapidity parameter is defined by , where , and is the relative velocity between the moving reference frames. The benefit of the rapidity representation is the simple formula for the addition of rapidities (in the same spatial direction).


Copyright © 2002 Wolfram Media, Inc. All rights reserved.

[Article Index][Prev Page][Next Page]