I’m using Julia v0.6.0 and my old codes with √(x) where x is a Vector is giving warning as
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> √.(x)
ERROR: syntax: invalid identifier name "."
How can I use √ over a vector with new version of julia?
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.
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.