# Substitutions for powers with new symbolic variables

**URL:** https://discourse.julialang.org/t/substitutions-for-powers-with-new-symbolic-variables/89540
**Category:** General Usage
**Tags:** package
**Created:** [October 31, 2022, 5:08am UTC](https://discourse.julialang.org/t/substitutions-for-powers-with-new-symbolic-variables/89540 "2022-10-31T05:08:12Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![xyli](https://avatars.discourse-cdn.com/v4/letter/x/d78d45/32.png) [@xyli](https://discourse.julialang.org/u/xyli)
#### Post date: [October 31, 2022, 5:08am UTC](https://discourse.julialang.org/t/substitutions-for-powers-with-new-symbolic-variables/89540/1 "2022-10-31T05:08:12Z")

</div>

Does anyone know if there are other Julia functions that can substitute “x\*y” by “a”? I had a discussion with Symbolics developers about it, but it seems to be a deadlock now. Please kindly see the discussion here,

> <https://github.com/JuliaSymbolics/Symbolics.jl/issues/773#issuecomment-1296390624>
>
> I have a vector "g" with high order polynomial elements x^alpha. I want to repla…ce the high order polynomials x^alpha with first order variables "phi".
> Here is my Julia code using Symbolics.jl,
> 
> phi = Symbolics.variables(:phi, 1:3)
> 
> g = Symbolics.variables(:g, 1:3)
> g\[1\] = a \* x^2 + b \* y^2 + d \* x\*y + 1
> g\[2\] = b \* x^2 + a \* y^2 + d \* x\*y + 1
> g\[3\] = 0
> 
> m = Symbolics.variables(:m, 1:3)
> m\[1\] = x^2
> m\[2\] = y^2
> m\[3\] = xy
> 
> expr = Symbolics.variables(:x, 1:3)
> for i = 1:3
> expr\[i\] = substitute(g\[i\], Dict(m\[i\]=\>phi\[i\]))
> end
> 
> This returns,
> julia\> expr
> 3-element Vector{Num}:
> g₁
> g₂
> g₃
> 
> This is not right because it should be
> 
> a\*phi1 + b\*phi2 + d \*phi3 +1
> b\*phi1 + a\*phi2 + d \*phi3+1
> 0
