# Error plotting array with exponential operation

**URL:** <https://discourse.julialang.org/t/error-plotting-array-with-exponential-operation/74171>\
**Category:** New to Julia\
**Created:** [January 7, 2022, 1:04am UTC](https://discourse.julialang.org/t/error-plotting-array-with-exponential-operation/74171 "2022-01-07T01:04:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![CentraCep](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/centracep/32/32454_2.png) [@CentraCep](https://discourse.julialang.org/u/CentraCep)\
**Post date:** [January 7, 2022, 1:04am UTC](https://discourse.julialang.org/t/error-plotting-array-with-exponential-operation/74171/1 "2022-01-07T01:04:30Z")

</div>

I am new to Julia and I am trying to create a plot with the following:

```julia
    xi2 = range(0,sqrt(6),step=1e-3)
    collect(xi2)
    plot(xi2, 1-xi2^2/6, label="n = 0")

```

When I try this though, I have the error:

```julia
MethodError: no method matching ^(::StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, ::Int64)
Closest candidates are:
  ^(::Union{AbstractChar, AbstractString}, ::Integer) at C:\Users\Acer\AppData\Local\Programs\Julia-1.7.0\share\julia\base\strings\basic.jl:721
  ^(::Rational, ::Integer) at C:\Users\Acer\AppData\Local\Programs\Julia-1.7.0\share\julia\base\rational.jl:475
  ^(::Complex{<:AbstractFloat}, ::Integer) at C:\Users\Acer\AppData\Local\Programs\Julia-1.7.0\share\julia\base\complex.jl:839
  ...

```

What am I missing here?

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [January 7, 2022, 1:11am UTC](https://discourse.julialang.org/t/error-plotting-array-with-exponential-operation/74171/2 "2022-01-07T01:11:59Z")

</div>

You need to use broadcasting to apply the `^` operation on all entries of the vector. The same for the `-` operation, that is:

```julia
1 .- xi2 .^ (2/6)

```
