# Mathematica does not completely evaluate expressions.

1. Jul 27, 2012

### Identity

I've defined A and B to be two affine transformations on $\mathbb{R}^2$. Then, I defined C and D to be some kinds of compositions of A and B, for example:
C = Composition[A,B,B,A,A][{x,y}]
D = Composition[B,A,B,A,B][{x,y}]

Now, I want to evaluate expressions like:
X = Composition[C,D,C,C,D,C][{x,y}]

I know this seems like a silly thing to do, but it is actually quite necessary for the problem I'm doing. However, X does not explicitly evaluate to a column vector, Mathematica just keeps it as Composition[C,D,C,C,D,C][{x,y}].

How can I FORCE mathematica to evaluate an expression to the end? Thanks

2. Jul 27, 2012

### Bill Simpson

If I assume the answer I gave you yesterday is similar to what you are doing today then

A[{x_,y_}]:={{1,-1},{-1,1}}.{x,y};
B[{x_,y_}]:={{0,1},{2,-1}}.{x,y}+{1,1};

Then this appears to work as expected because A and B are functions.

Composition[A,B,A][{x,y}]

It transforms vector to vector using the sequence of functions.

Now you want today

C = Composition[A,B,B,A,A][{x,y}]
D = Composition[B,A,B,A,B][{x,y}]
X = Composition[C,D,C,C,D,C][{x,y}]

but what are C and D and what is the Composition of them?

First, Mathematica reserves a vast number of names for itself. Those include C and D. Using either of those as an ordinary user variable almost certainly will give you nothing but grief.

Second, think a moment, what is Composition[C,D,C,C,D,C] exactly? Composition is expecting a sequence of functions and will compose those. But your C and D are both vectors, not functions. If I scribbled on the board C={1,2} and D={4,3} Compose those. What would you do?

So resolve both of those and we will see if we can get you where you need to go

Last edited: Jul 27, 2012
3. Jul 27, 2012

### Identity

Here's an example. You can keep shift+entering the output until it fully simplifies, but I can't get it to simplify immediately

#### Attached Files:

• ###### Example.nb
File size:
7.2 KB
Views:
95
4. Jul 27, 2012

### Bill Simpson

A general rule I try to remember: The more people try to desktop publish their math the more problems they have. I realize Mathematica makes it almost impossible for some people to resist this.

Carefully check this and see if it is correct after having removed the desktop publishing.

In[1]:= a[{x_,y_}]:={{1,0},{2,-1}}.{x,y};
b[{x_,y_}]:={{3,0},{-1,2}}.{x,y}+{1,1};
c[{x_,y_}]:=Simplify[Composition[a,b,a,b,a][{x,y}]];
d[{x_,y_}]:=Simplify[Composition[b,a,a,b,b][{x,y}]];

In[5]:= c[{x,y}]

Out[5]= {4+9 x,6+15 x-4 y}

In[6]:= d[{x,y}]

Out[6]= {13+27 x,1-19 x+8 y}

In[7]:= X = Composition[c,d,c,c,d,c,d][{x,y}]

Out[7]= {64570081+129140163 x,120307837+240270449 x+131072 y}

Note: Literally scrape and paste that into Mathematica without forcing it back into your 2-dimensional published form
Thank you
And I'm still not sure I understand what you mean by composition of two element vectors.

5. Jul 27, 2012

### Identity

Thx, that works. I guess it's a shortcoming of mathematica. Oh, and the vectors aren't like usual vectors, they're just maps from R^2 to R^2.

6. Jul 28, 2012

### Bill Simpson

You could spend hours or days and try to find a work around that will let you use the 2d format you were using. If you could make a very convincing case that it should work you could submit this to Wolfram and see if in a year or two they send you a note saying they have corrected this. But is probably very unlikely that they will change this.