Mathematica does not completely evaluate expressions.

  • Context: Mathematica 
  • Thread starter Thread starter Identity
  • Start date Start date
  • Tags Tags
    Expressions Mathematica
Click For Summary

Discussion Overview

The discussion revolves around the challenges of evaluating expressions in Mathematica, specifically regarding the composition of affine transformations defined as functions and their subsequent evaluation. Participants explore issues related to the behavior of the Composition function when applied to vectors instead of functions.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant describes defining two affine transformations, A and B, and attempts to evaluate a composition of these transformations, leading to an expression that does not simplify as expected.
  • Another participant suggests that the issue arises because C and D are vectors rather than functions, which may lead to confusion in how Composition is expected to operate.
  • A different participant provides an example of using Simplify to force evaluation, noting that repeated execution may be necessary to achieve full simplification.
  • One participant mentions a general rule regarding the use of desktop publishing formats in Mathematica, suggesting that it can complicate the evaluation process.
  • Another participant acknowledges that the vectors in question are not typical vectors but rather mappings from R^2 to R^2, indicating a potential misunderstanding of the underlying mathematical structures.
  • A later reply discusses the possibility of submitting feedback to Wolfram regarding the limitations encountered, although skepticism is expressed about the likelihood of a resolution.

Areas of Agreement / Disagreement

Participants express differing views on the nature of the problem, with some attributing the issue to the use of vectors instead of functions, while others highlight the limitations of Mathematica itself. No consensus is reached regarding a definitive solution to the evaluation problem.

Contextual Notes

Participants note that the use of certain variable names (C and D) may conflict with Mathematica's reserved names, which could lead to unexpected behavior. Additionally, there is an acknowledgment of the complexity involved in composing transformations and the need for careful handling of mathematical expressions.

Identity
Messages
151
Reaction score
0
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
 
Physics news on Phys.org
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:
Here's an example. You can keep shift+entering the output until it fully simplifies, but I can't get it to simplify immediately
 

Attachments

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.
 
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.
 
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.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K