Mathematica does not completely evaluate expressions.

In summary: They have a lot invested in what they are doing now and they seem to be satisfied with what they have.It might be more efficient to just work with the simplified code and format it in a way that is readable for you. That way, you can still achieve your desired result without having to spend extra time trying to find a workaround.
  • #1
Identity
152
0
I've defined A and B to be two affine transformations on [itex]\mathbb{R}^2[/itex]. 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
  • #2
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:
  • #3
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

  • Example.nb
    7.2 KB · Views: 390
  • #4
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
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
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.
 

1. Why does Mathematica not completely evaluate my expression?

Mathematica uses a set of rules and algorithms to evaluate expressions. It may not be able to evaluate certain types of expressions or may require additional information or assumptions to do so.

2. How can I force Mathematica to completely evaluate my expression?

You can use the command FullSimplify to explicitly tell Mathematica to simplify an expression as much as possible. You can also provide additional assumptions or use specific functions, such as Simplify, Expand, or Factor, to manipulate the expression.

3. What are some common reasons for Mathematica not being able to completely evaluate an expression?

Some common reasons include the expression being undefined or containing symbolic variables, the expression being too complex for Mathematica to handle, or the expression involving special functions that Mathematica does not have a rule for.

4. Are there any options or settings that can affect Mathematica's ability to evaluate expressions?

Yes, Mathematica has various options and settings that can affect its evaluation process, such as the Assumptions option, which allows you to provide additional assumptions for the expressions, and the ComplexityFunction option, which determines how "complex" an expression is considered to be.

5. Is there a way to get more information about why Mathematica cannot completely evaluate an expression?

Yes, you can use the Trace function to see the step-by-step evaluation process of an expression. This can help you identify where the evaluation is getting stuck or what assumptions are being made. You can also check the documentation for specific functions or options to understand their behavior in more detail.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
Replies
8
Views
1K
  • Calculus and Beyond Homework Help
Replies
6
Views
562
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Back
Top