# Raise the power of polynomials in polyjump

**URL:** <https://discourse.julialang.org/t/raise-the-power-of-polynomials-in-polyjump/41818>\
**Category:** General Usage\
**Tags:** jump\
**Created:** [June 21, 2020, 6:16pm UTC](https://discourse.julialang.org/t/raise-the-power-of-polynomials-in-polyjump/41818 "2020-06-21T18:16:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aliceee](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@aliceee](https://discourse.julialang.org/u/aliceee)\
**Post date:** [June 21, 2020, 6:16pm UTC](https://discourse.julialang.org/t/raise-the-power-of-polynomials-in-polyjump/41818/1 "2020-06-21T18:16:37Z")

</div>

Hi, I’m writing an SOS model using PolyJump:

```julia
@polyvar B[1:k,1:pp+1] 
@polyvar c0
k = transpose(p_train_var)*vec(B*vcat(x_train0[1,:],1))*gamma + c0

```

when I try to raise the power of polynomial k, by doing this:

```julia
k^2

```

I got:

```julia
MethodError: no method matching ^(::Array{Polynomial{true,Float64},1}, ::Int64)
Closest candidates are:
  ^(!Matched::Float16, ::Integer) at math.jl:862
  ^(!Matched::Regex, ::Integer) at regex.jl:712
  ^(!Matched::Missing, ::Integer) at missing.jl:151
  ...

Stacktrace:
 [1] macro expansion at ./none:0 [inlined]
 [2] literal_pow(::typeof(^), ::Array{Polynomial{true,Float64},1}, ::Val{2}) at ./none:0
 [3] top-level scope at In[107]:1

```

What should I do if I want to use a polynomial that takes the format of k^2 in my JuMP model?  
Thanks for your help in advance!

---

<div class="post-metadata">

**Author:** ![aliceee](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@aliceee](https://discourse.julialang.org/u/aliceee)\
**Post date:** [June 21, 2020, 6:24pm UTC](https://discourse.julialang.org/t/raise-the-power-of-polynomials-in-polyjump/41818/2 "2020-06-21T18:24:39Z")

</div>

I figured it out. It was a very stupid mistake. It should be  
`k.^2`  
instead of  
`k^2`
