# Logarithm of an array

**URL:** https://discourse.julialang.org/t/logarithm-of-an-array/22923
**Category:** New to Julia
**Created:** [April 8, 2019, 3:23pm UTC](https://discourse.julialang.org/t/logarithm-of-an-array/22923 "2019-04-08T15:23:20Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![ramonz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ramonz/32/548_2.png) [@ramonz](https://discourse.julialang.org/u/ramonz)
#### Post date: [April 8, 2019, 3:23pm UTC](https://discourse.julialang.org/t/logarithm-of-an-array/22923/1 "2019-04-08T15:23:20Z")

</div>

Hello

A very basic question.

This used to work without fuss:

A=rand(10)  
log(A)

But with Julia 1.1 it is not valid any more:

MethodError: no method matching log(::Array{Float64,1})  
Closest candidates are:  
log(!Matched::Float16) at math.jl:1018  
log(!Matched::Complex{Float16}) at math.jl:1019  
log(!Matched::Float64) at special/log.jl:254  
…

Stacktrace:  
[1] top-level scope at In[21]💯

My question is, It is necessary to use a loop to do it?  
Thanks

---

<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: [April 8, 2019, 3:25pm UTC](https://discourse.julialang.org/t/logarithm-of-an-array/22923/2 "2019-04-08T15:25:15Z")

</div>

Use `log.(A)`.

Also, please quote your code: [PSA: how to quote code with backticks](https://discourse.julialang.org/t/psa-how-to-quote-code-with-backticks/7530).

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [April 8, 2019, 3:33pm UTC](https://discourse.julialang.org/t/logarithm-of-an-array/22923/3 "2019-04-08T15:33:57Z")

</div>

> [@ramonz](#):
>
> But with Julia 1.1 it is not valid any more:

If you are upgrading old code, upgrade it to earlier Julia versions first so that you will see the deprecation messages. (`log(array)` was deprecated in Julia 0.6.)

(For example, if you have code that was written for Julia 0.5, first upgrade it to 0.6 and fix the deprecations, then upgrade it to 0.7 and fix the deprecations, then upgrade to 1.0 and 1.1. If you skip versions when upgrading, then you will get error messages instead of deprecation warnings … this is manageable, but requires more knowledge of how to fix things.)

---

<div class="post-metadata">

### Author: ![ramonz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ramonz/32/548_2.png) [@ramonz](https://discourse.julialang.org/u/ramonz)
#### Post date: [April 8, 2019, 4:17pm UTC](https://discourse.julialang.org/t/logarithm-of-an-array/22923/4 "2019-04-08T16:17:33Z")

</div>

Thank you all.

---

<div class="post-metadata">

### Author: ![jonathanBieler](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@jonathanBieler](https://discourse.julialang.org/u/jonathanBieler)
#### Post date: [April 8, 2019, 4:22pm UTC](https://discourse.julialang.org/t/logarithm-of-an-array/22923/5 "2019-04-08T16:22:17Z")

</div>

I also recommend this blog post for the rational between this change:

> **[More Dots: Syntactic Loop Fusion in Julia](https://julialang.org/blog/2017/01/moredots/)**
>
> More Dots: Syntactic Loop Fusion in Julia | After a lengthy design process (https://github.com/JuliaLang/julia/issues/8450) and preliminary foundations in Julia 0.5 (/blog/2016-10-11-julia-0.5-highlights#vectorized\_function\_calls), Julia 0.6 includes...

---

<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: [April 11, 2019, 3:14pm UTC](https://discourse.julialang.org/t/logarithm-of-an-array/22923/6 "2019-04-11T15:14:48Z")

</div>

5 posts were split to a new topic: [Performance of log.(x)](https://discourse.julialang.org/t/performance-of-log-x/23039)
