How to use computer algebra system

78 Views Asked by At

Consider the two vector-valued functions \begin{align} &f(x,y)=(x+y^2, y+x^3) \\ & g(x,y)=(2x+y^3, 2y+x^4). \end{align} Then \begin{align} f(g(x,y))&=((2x+y^3)+(2y+x^4)^2,(2y+x^4)+(2x+y^3)^3) \\ &= (2x+4y^2+y^3+4x^4y+x^8, 2y+8x^3+x^4+12x^2y^3+6xy^6+y^{27}) \end{align} gives vector substitution $f \circ g$.

By vector-substitution, I mean the vector composition $f \circ g=(f_1(g_1(x,y),g_2(x,y)), f_2(g_1(x,y),g_2(x,y))$, where $f(x,y)=(f_1(x,y),f_2(x,y))$ and $g(x,y)=(g_1(x,y),g_2(x,y))$.

Can you please suggest some computer algebra code (e.g., PARI/GP, SAGE, SymPy etc.) doing the above operation?

If it were one-variable functions like $f(x)=\sum_{i=1}^n a_ix^n$ and $g(x)=\sum_{j=1}^{m}b_jx^j$, then PARI/GP function subst(f,x,g) would compute $f \circ g$.

But in our case, these are vector-valued functions.

Indeed, I want to find some non-trivial $g(x,y)=(\cdots, \cdots)$ that commutes with $f(x,y)=(x+y^2, y+x^3)$.

2

There are 2 best solutions below

2
On BEST ANSWER

With GIAC you can do:

f(x,y):=(x+y^2, y+x^3)
g(x,y):=(2x+y^3, 2y+x^4)
h(x,y):=f(g(x,y))
simplify(h(x,y))

This gives:

x^8+4*x^4*y+2*x+y^3+4*y^2,x^4+8*x^3+12*x^2*y^3+6*x*y^6+y^9+2*y

GIAC is the general purpose symbolic algebra software powering the graphical interface Xcas. It is certainly possible to use it online, but I didn't search the website.

Personally, I use it in R with the help of the R package giacR:

library(giacR)
giac <- Giac$new()
giac$execute("f(x,y):=(x+y^2, y+x^3)")
giac$execute("g(x,y):=(2x+y^3, 2y+x^4)")
giac$execute("h(x,y):=f(g(x,y))")
giac$execute("simplify(h(x,y))")
giac$close()
0
On

In Mathematica or Wolfram language we have maps $$f,g : V_2\to V_2$$

     f[x_] := {x[[1]] + x[[2]]^2, x[[2]] + x[[1]]^3}
     g[x_] := {2 x[[1]] + x[[2]]^3, 2 x[[2]] + x[[1]]^4}


    f[g[{x, y}]] 
    {2 x + y^3 + (x^4 + 2 y)^2, x^4 + 2 y + (2 x + y^3)^3}

     f[g[{x, y}]] // Expand
     {2 x + x^8 + 4 x^4 y + 4 y^2 + y^3, 
           8 x^3 + x^4 + 2 y + 12 x^2 y^3 + 6 x y^6 + y^9}