# How to call some special functions in julia v0.6?

**URL:** <https://discourse.julialang.org/t/how-to-call-some-special-functions-in-julia-v0-6/5127>\
**Category:** Numerics\
**Created:** [July 29, 2017, 8:00pm UTC](https://discourse.julialang.org/t/how-to-call-some-special-functions-in-julia-v0-6/5127 "2017-07-29T20:00:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![BVPs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bvps/32/2190_2.png) [@BVPs](https://discourse.julialang.org/u/BVPs)\
**Post date:** [July 29, 2017, 8:00pm UTC](https://discourse.julialang.org/t/how-to-call-some-special-functions-in-julia-v0-6/5127/1 "2017-07-29T20:00:41Z")

</div>

Hello. Apparently, some of the special functions are moved to SpecialFunctions.jl in julia v0.6, e.g., `besselj0`. When I call this function, it generates the following warning:

```julia
julia> using SpecialFunctions
julia> x=0.01:0.001:5; y=besselj0(x);
WARNING: besselj0{T <: Number}(x::AbstractArray{T}) is deprecated, use ($(Expr(:globalref, Compat, Symbol("@compat"))))(besselj0.(x)) instead.

```

Well, at this point, I still got the correct output array, but I also try to run what the warning message suggested. Then, I got the error:

```julia
julia> ($(Expr(:globalref, Compat, Symbol("@compat"))))(besselj0.(x))
ERROR: unsupported or misplaced expression $

```

What should I call for those special functions like `besselj`? Interestingly enough, some of the other special functions such as `gamma` was not moved to `SpecialFunctions.jl`, and worked without any warning and error messages:

```julia
julia> z=gamma(x);

```

Thanks for your help!  
BVPs

---

<div class="post-metadata">

**Author:** ![dlfivefifty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlfivefifty/32/1959_2.png) [@dlfivefifty](https://discourse.julialang.org/u/dlfivefifty)\
**Post date:** [July 29, 2017, 8:07pm UTC](https://discourse.julialang.org/t/how-to-call-some-special-functions-in-julia-v0-6/5127/2 "2017-07-29T20:07:22Z")

</div>

You should use broadcast notation: `besselj0.(x)` and `gamma.(x)`.

---

<div class="post-metadata">

**Author:** ![BVPs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bvps/32/2190_2.png) [@BVPs](https://discourse.julialang.org/u/BVPs)\
**Post date:** [July 29, 2017, 8:08pm UTC](https://discourse.julialang.org/t/how-to-call-some-special-functions-in-julia-v0-6/5127/3 "2017-07-29T20:08:50Z")

</div>

I just did some further experiments and got the following:

```julia
julia> x=0.01:0.001:5; y=besselj0.(x);
julia> z=gamma.(x);
julia> z=gamma(x);

```

All of them worked correctly now without any errors. Then, why `gamma` accepts `.(x)` and `(x)` as its argument and why `besselj0` does accept `.(x)` and tries to deprecate `(x)` argument?

---

<div class="post-metadata">

**Author:** ![BVPs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bvps/32/2190_2.png) [@BVPs](https://discourse.julialang.org/u/BVPs)\
**Post date:** [July 29, 2017, 8:12pm UTC](https://discourse.julialang.org/t/how-to-call-some-special-functions-in-julia-v0-6/5127/4 "2017-07-29T20:12:51Z")

</div>

Thanks a lot, dlfivefifty! I just found out that and posted it before reading your message. However, a question remains. Why some of the special functions not moved to `SpecialFunctions.jl`, such as `gamma` does not issue the deprecated warning? It still accepts both `gamma(x)` and `gamma.(x)`, but the former doesn’t generate any warning unlike `besselj0`.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [July 29, 2017, 8:13pm UTC](https://discourse.julialang.org/t/how-to-call-some-special-functions-in-julia-v0-6/5127/5 "2017-07-29T20:13:53Z")

</div>

The deprecation is for functions that typically evaluate scalars when called with vectors. This required that functions was specifically defined for `f(x::AbstractArray)`. This is now solved with the dot call notation, you can read about it here: [More Dots: Syntactic Loop Fusion in Julia](https://julialang.org/blog/2017/01/moredots).

---

<div class="post-metadata">

**Author:** ![kishor\_kumar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kishor_kumar/32/9658_2.png) [@kishor\_kumar](https://discourse.julialang.org/u/kishor_kumar)\
**Post date:** [September 14, 2019, 5:56am UTC](https://discourse.julialang.org/t/how-to-call-some-special-functions-in-julia-v0-6/5127/6 "2019-09-14T05:56:10Z")

</div>

Thanks for suggesting the element wise operation!
