Composition of Vector Functions in Mathematica

Click For Summary
SUMMARY

The discussion focuses on defining and composing vector functions in Mathematica, specifically using matrix operations. The user aims to create functions A and B that can be composed efficiently, encountering issues with output formats. The solution involves defining matrices A and B as nested lists and using a dot product for composition, allowing for the inclusion of translation vectors. The final syntax provided for composition is Composition[A,B,A][{x,y}], which successfully evaluates the desired function.

PREREQUISITES
  • Understanding of matrix operations in Mathematica
  • Familiarity with vector representation as lists
  • Knowledge of function composition in programming
  • Basic syntax of Mathematica for defining functions
NEXT STEPS
  • Research "Mathematica matrix operations" for advanced techniques
  • Learn about "Mathematica function composition" for more complex scenarios
  • Explore "Mathematica list manipulation" to handle different data structures
  • Investigate "Mathematica graphics" for visualizing vector transformations
USEFUL FOR

Mathematica users, mathematicians, and programmers interested in linear algebra applications and function composition techniques.

Identity
Messages
151
Reaction score
0
I want to define something like:
A\left(\begin{matrix} x \\ y\end{matrix}\right) = \left(\begin{matrix} 1 & -1 \\ -1 & 1 \end{matrix}\right)\left(\begin{matrix} x \\ y\end{matrix}\right)
B\left(\begin{matrix} x \\ y\end{matrix}\right) = \left(\begin{matrix} 0 & 1 \\ 2 & -1 \end{matrix}\right)\left(\begin{matrix} x \\ y\end{matrix}\right)+\left(\begin{matrix} 1 \\ 1\end{matrix}\right)
And then I want to be able to evaluate compositions such as A \circ B \circ A\left(\begin{matrix} x \\ y\end{matrix}\right) quickly and easily.

Currently I'm using this syntax:
A[x_,y_] = {{1,-1},{-1,1}}.{{x},{y}}

However, when I define such a function, the output is a column vector, not a list, and I can't input a column vector into the next function. How do I do ths?
 
Physics news on Phys.org
If I understand your syntax correctly, you have too many brackets in the column vector definition. A column vector should be just a simple list, and a matrix should be a nested list. Instead of:
A[x_,y_] = {{1,-1},{-1,1}}.{{x},{y}}

Just define:

A = {{1,-1},{-1,1}}
B = {{0,1},{2,-1}}
X = {x,y}

Then you can simply compose them with the dot product, such as:

(A.(B.A)).X
 
I can't do that, because B has a translation vector
 
Is this what you are looking for?

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

Out[3]= {-2 x-2 (x-y)+2 y,2 x+2 (x-y)-2 y}
 
I'll have to try it out when i get back tonight, but that looks very promising, thanks :)
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 10 ·
Replies
10
Views
4K
  • · Replies 33 ·
2
Replies
33
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K