# Using "√" with a vector

**URL:** <https://discourse.julialang.org/t/using-with-a-vector/6025>\
**Category:** General Usage\
**Created:** [September 21, 2017, 2:57pm UTC](https://discourse.julialang.org/t/using-with-a-vector/6025 "2017-09-21T14:57:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![v-i-s-h](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/v-i-s-h/32/46152_2.png) [@v-i-s-h](https://discourse.julialang.org/u/v-i-s-h)\
**Post date:** [September 21, 2017, 2:57pm UTC](https://discourse.julialang.org/t/using-with-a-vector/6025/1 "2017-09-21T14:57:53Z")

</div>

I’m using Julia v0.6.0 and my old codes with √(x) where x is a Vector is giving warning as

```julia
julia> √(x)
WARNING: sqrt{T <: Number}(x::AbstractArray{T}) is deprecated, use sqrt.(x) instead.
Stacktrace:
 [1] depwarn(::String, ::Symbol) at ./deprecated.jl:70
 [2] sqrt(::Array{Float64,1}) at ./deprecated.jl:57
 [3] eval(::Module, ::Any) at ./boot.jl:235
 [4] eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:66
 [5] macro expansion at ./REPL.jl:97 [inlined]
 [6] (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at ./event.jl:73
while loading no file, in expression starting on line 0

```

As expeceted, `sqrt.(x)` works without warning.

However using dot with squareroot symbol raises error

```julia
julia> √.(x)
ERROR: syntax: invalid identifier name "."

```

How can I use `√` over a vector with new version of julia?

---

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [September 21, 2017, 3:04pm UTC](https://discourse.julialang.org/t/using-with-a-vector/6025/2 "2017-09-21T15:04:59Z")

</div>

`(√).(x)` and `@. √(x)` work, but I don’t completely understand why `√.(x)` isn’t parsed so that it does what you want.

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [September 21, 2017, 3:44pm UTC](https://discourse.julialang.org/t/using-with-a-vector/6025/3 "2017-09-21T15:44:20Z")

</div>

The `√` is actually a prefix operator (and not just a function name) so you can do things like `√2`. This means that it gets dotted like all the other operators — with a dot prefix.

```julia
julia> .√[1,2,3]
3-element Array{Float64,1}:
 1.0
 1.41421
 1.73205

julia> .![true,false,true]
3-element BitArray{1}:
 false
  true
 false

julia> .-[1,2,3]
3-element Array{Int64,1}:
 -1
 -2
 -3

```

---

<div class="post-metadata">

**Author:** ![Keno](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/keno/32/285_2.png) [@Keno](https://discourse.julialang.org/u/Keno)\
**Post date:** [September 21, 2017, 3:46pm UTC](https://discourse.julialang.org/t/using-with-a-vector/6025/4 "2017-09-21T15:46:40Z")

</div>

Operators can take their dot before the operator (this is inherited from binary operators (.+ .\*), etc, so  
`.√(x)` works I believe (as does `.√x`) . Still, there should be no problem with making the `√.(x)` syntax work. Do file an issue about it.

---

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [September 22, 2017, 2:15am UTC](https://discourse.julialang.org/t/using-with-a-vector/6025/5 "2017-09-22T02:15:57Z")

</div>

See [https://github.com/JuliaLang/julia/issues/23814](https://github.com/JuliaLang/julia/issues/23814).
