# I want to implement a normal log in julia and i'm new in and don't know how to do it

**URL:** https://discourse.julialang.org/t/i-want-to-implement-a-normal-log-in-julia-and-im-new-in-and-dont-know-how-to-do-it/38355
**Category:** New to Julia
**Tags:** question
**Created:** [April 28, 2020, 7:58am UTC](https://discourse.julialang.org/t/i-want-to-implement-a-normal-log-in-julia-and-im-new-in-and-dont-know-how-to-do-it/38355 "2020-04-28T07:58:26Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![Rezvious](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rezvious/32/14087_2.png) [@Rezvious](https://discourse.julialang.org/u/Rezvious)
#### Post date: [April 28, 2020, 7:58am UTC](https://discourse.julialang.org/t/i-want-to-implement-a-normal-log-in-julia-and-im-new-in-and-dont-know-how-to-do-it/38355/1 "2020-04-28T07:58:26Z")

</div>

hi all;  
i want to implement a normal log in Julia, I used “using Distributions” and i’m trying to run in it in Jupiter notebook but when I press TAB and write LogNormal it doesn’t show me anything like there doesn’t exist any LogNormal function. do you have any idea to help me, please?

here is the part of my code that I want to implement:

using Revise # lets you change A2funcs without restarting julia!  
includet(“A2\_src.jl”)  
using Plots  
using Statistics: mean  
using Zygote  
using Test  
using Logging  
using Distributions  
using .A2funcs: log1pexp # log(1 + exp(x)) stable  
using .A2funcs: factorized\_gaussian\_log\_density  
using .A2funcs: skillcontour!  
using .A2funcs: plot\_line\_equal\_skill!

function log\_prior(zs)  
return #TODO  
end

---

<div class="post-metadata">

### Author: ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)
#### Post date: [April 28, 2020, 8:26am UTC](https://discourse.julialang.org/t/i-want-to-implement-a-normal-log-in-julia-and-im-new-in-and-dont-know-how-to-do-it/38355/3 "2020-04-28T08:26:43Z")

</div>

`includet` is a function of Revise, making Revise track the included file for changes and reloading on the fly. It’s not related to the question in general.

---

<div class="post-metadata">

### Author: ![Rezvious](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rezvious/32/14087_2.png) [@Rezvious](https://discourse.julialang.org/u/Rezvious)
#### Post date: [April 28, 2020, 8:26am UTC](https://discourse.julialang.org/t/i-want-to-implement-a-normal-log-in-julia-and-im-new-in-and-dont-know-how-to-do-it/38355/4 "2020-04-28T08:26:56Z")

</div>

that is another source file. it’s not important here, main problem is don’t know how to implement a log normal as a prior, as i’ve mentioned it in the question as #todo

---

<div class="post-metadata">

### Author: ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)
#### Post date: [April 28, 2020, 8:28am UTC](https://discourse.julialang.org/t/i-want-to-implement-a-normal-log-in-julia-and-im-new-in-and-dont-know-how-to-do-it/38355/5 "2020-04-28T08:28:50Z")

</div>

You can find the documentation for `LogNormal` [here](https://juliahub.com/docs/Distributions/xILW0/0.23.2/univariate/#Distributions.LogNormal):

```julia
LogNormal() # Log-normal distribution with zero log-mean and unit scale
LogNormal(mu) # Log-normal distribution with log-mean mu and unit scale
LogNormal(mu, sig) # Log-normal distribution with log-mean mu and scale sig

params(d) # Get the parameters, i.e. (mu, sig)
meanlogx(d) # Get the mean of log(X), i.e. mu
varlogx(d) # Get the variance of log(X), i.e. sig^2
stdlogx(d) # Get the standard deviation of log(X), i.e. sig

```

---

<div class="post-metadata">

### Author: ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)
#### Post date: [April 28, 2020, 8:32am UTC](https://discourse.julialang.org/t/i-want-to-implement-a-normal-log-in-julia-and-im-new-in-and-dont-know-how-to-do-it/38355/6 "2020-04-28T08:32:25Z")

</div>

Thanks, didn’t know. To keep it clean, I removed my post. You may consider removing your clarifications too.

Could you try your code in a plain Julia REPL (no jupiter?), just to be sure, it’s not something which comes with combination Jupiter+Revise.

A MWE would also be nice. which reproduces your problem. Maybe with some minimal code from A2\_src.jl. ([Please read: make it easier to help you](https://discourse.julialang.org/t/psa-make-it-easier-to-help-you/14757))

---

<div class="post-metadata">

### Author: ![Rezvious](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rezvious/32/14087_2.png) [@Rezvious](https://discourse.julialang.org/u/Rezvious)
#### Post date: [April 28, 2020, 8:32am UTC](https://discourse.julialang.org/t/i-want-to-implement-a-normal-log-in-julia-and-im-new-in-and-dont-know-how-to-do-it/38355/7 "2020-04-28T08:32:57Z")

</div>

i am writing this code on my jupyter notebook and when i press TAB in order to see what choices i have for the Distributions, it doesn’t mention LogNormal.

---

<div class="post-metadata">

### Author: ![Rezvious](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rezvious/32/14087_2.png) [@Rezvious](https://discourse.julialang.org/u/Rezvious)
#### Post date: [April 28, 2020, 8:34am UTC](https://discourse.julialang.org/t/i-want-to-implement-a-normal-log-in-julia-and-im-new-in-and-dont-know-how-to-do-it/38355/8 "2020-04-28T08:34:38Z")

</div>

i have had problem installing juno in my laptop, by trying several times unfortunately. so i was forced to use jupyter notebook.

---

<div class="post-metadata">

### Author: ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)
#### Post date: [April 28, 2020, 8:39am UTC](https://discourse.julialang.org/t/i-want-to-implement-a-normal-log-in-julia-and-im-new-in-and-dont-know-how-to-do-it/38355/9 "2020-04-28T08:39:16Z")

</div>

How are you trying to use the TAB completion? Like `Distributions.<TAB>`? Which version of Distributions.jl are you on?

Try directly creating the `LogNormal` object like in the example I copied from the docs - does that work?

---

<div class="post-metadata">

### Author: ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)
#### Post date: [April 28, 2020, 10:00am UTC](https://discourse.julialang.org/t/i-want-to-implement-a-normal-log-in-julia-and-im-new-in-and-dont-know-how-to-do-it/38355/10 "2020-04-28T10:00:41Z")

</div>

For me it works, with Revise and without. The only thing to pay attention is for me, that the kernel is idle when trying to TAB complete.  
Tried with Julia 1.3.1  
The version of the notebook server is: **5.6.0** -9de07b7, Python 3.7.0 (default, Jun 28 2018, 13:15:42) [GCC 7.2.0]

```julia
    Status `~/.julia/environments/v1.3/Project.toml`
  [8f4d0f93] Conda v1.4.1
  [31c24e10] Distributions v0.23.2
  [7073ff75] IJulia v1.21.1
  [2bd173c7] NodeJS v1.1.1
  [295af30f] Revise v2.6.4

```

---

<div class="post-metadata">

### Author: ![Rezvious](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rezvious/32/14087_2.png) [@Rezvious](https://discourse.julialang.org/u/Rezvious)
#### Post date: [April 28, 2020, 10:42am UTC](https://discourse.julialang.org/t/i-want-to-implement-a-normal-log-in-julia-and-im-new-in-and-dont-know-how-to-do-it/38355/11 "2020-04-28T10:42:18Z")

</div>

i understood i didn’t install the pkg on jupyter, now just installing it. hope it works.

---

<div class="post-metadata">

### Author: ![Rezvious](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rezvious/32/14087_2.png) [@Rezvious](https://discourse.julialang.org/u/Rezvious)
#### Post date: [April 28, 2020, 10:45am UTC](https://discourse.julialang.org/t/i-want-to-implement-a-normal-log-in-julia-and-im-new-in-and-dont-know-how-to-do-it/38355/12 "2020-04-28T10:45:52Z")

</div>

great, thank you and did you run it as “LogNormal(mu, sig)” ??

---

<div class="post-metadata">

### Author: ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)
#### Post date: [April 28, 2020, 11:23am UTC](https://discourse.julialang.org/t/i-want-to-implement-a-normal-log-in-julia-and-im-new-in-and-dont-know-how-to-do-it/38355/13 "2020-04-28T11:23:17Z")

</div>

No I didn’t, but now I did:

 ![lognormal](https://global.discourse-cdn.com/julialang/original/3X/a/3/a3ec9304bd4484632c8402d32860ab4cd1cca40e.jpeg)

Seems to work.

---

<div class="post-metadata">

### Author: ![Rezvious](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rezvious/32/14087_2.png) [@Rezvious](https://discourse.julialang.org/u/Rezvious)
#### Post date: [April 28, 2020, 1:06pm UTC](https://discourse.julialang.org/t/i-want-to-implement-a-normal-log-in-julia-and-im-new-in-and-dont-know-how-to-do-it/38355/14 "2020-04-28T13:06:18Z")

</div>

Thank you a lot. 😀
