# General Usage

**URL:** https://discourse.julialang.org/c/usage/6.md?page=812

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

**Page:** 813

---

## [Strange behaviour of find\_zero() from Roots.jl](https://discourse.julialang.org/t/strange-behaviour-of-find-zero-from-roots-jl/31304)

<div class="topic-metadata">

**Author:** [@IljaK91](https://discourse.julialang.org/u/IljaK91)\
**Replies:** 5\
**Last updated:** [November 21, 2019, 6:25am UTC](https://discourse.julialang.org/t/strange-behaviour-of-find-zero-from-roots-jl/31304 "2019-11-21T06:25:47Z")

</div>

Hi everyone, I recently updated the version of Roots.jl I use in my package. I have some simple code that looks like this f = β -\> begin diff = mb(β, β, par, bpar = ConstructBPar(β, par)) - i…

---

## [Compat Issues Messing Me Up - Help needed](https://discourse.julialang.org/t/compat-issues-messing-me-up-help-needed/31330)

<div class="topic-metadata">

**Author:** [@anon92994695](https://discourse.julialang.org/u/anon92994695)\
**Replies:** 2\
**Last updated:** [November 21, 2019, 2:09am UTC](https://discourse.julialang.org/t/compat-issues-messing-me-up-help-needed/31330 "2019-11-21T02:09:52Z")

</div>

Hi everyone, I’m trying to keep my package a float(GitHub - caseykneale/ChemometricsTools.jl: A collection of tools for chemometrics and machine learning written in Julia.)… It was working fine then DSP.jl broke due to …

---

## [Help installing ApproxFun.jl?](https://discourse.julialang.org/t/help-installing-approxfun-jl/31285)

<div class="topic-metadata">

**Author:** [@longemen3000](https://discourse.julialang.org/u/longemen3000)\
**Replies:** 4\
**Last updated:** [November 20, 2019, 9:19pm UTC](https://discourse.julialang.org/t/help-installing-approxfun-jl/31285 "2019-11-20T21:19:29Z")

</div>

clean enviroment: julia\> using InteractiveUtils julia\> versioninfo() Julia Version 1.3.0-rc5.1 Commit 36c4eb251e (2019-11-17 19:04 UTC) Platform Info: OS: Windows (x86\_64-w64-mingw32) CPU: Intel(R) Core(TM) i7-4720H…

---

## [Comprehension vs map and filter unexpected speeds](https://discourse.julialang.org/t/comprehension-vs-map-and-filter-unexpected-speeds/31314)

<div class="topic-metadata">

**Author:** [@stakaz](https://discourse.julialang.org/u/stakaz)\
**Replies:** 22\
**Last updated:** [November 20, 2019, 4:27pm UTC](https://discourse.julialang.org/t/comprehension-vs-map-and-filter-unexpected-speeds/31314 "2019-11-20T16:27:11Z")

</div>

Hello, I have the following comparison and I wonder why the last way to achieve the result is the fastest as i should create an additional array whereas the fist two don’t. julia\> const A = rand(10000); WARNING: redefin…

---

## [Extending Base.:show for Array of types](https://discourse.julialang.org/t/extending-base-show-for-array-of-types/31289)

<div class="topic-metadata">

**Author:** [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Replies:** 3\
**Last updated:** [November 20, 2019, 4:20pm UTC](https://discourse.julialang.org/t/extending-base-show-for-array-of-types/31289 "2019-11-20T16:20:44Z")

</div>

OK, I have this type julia\> D 3-element Array{GMT.GMTdataset,1}: GMT.GMTdataset(\[1.0 0.0; 2.0 -1.4100124638881568; 3.0 -0.757574139629664\], String\[\], " -W,red,dashdot", String\[\], "", "") GMT.GMTdataset(\[1.0 0.0; 2.0 -…

---

## [Evaluating expressions in file](https://discourse.julialang.org/t/evaluating-expressions-in-file/31172)

<div class="topic-metadata">

**Author:** [@Ferran\_Mazzanti](https://discourse.julialang.org/u/Ferran_Mazzanti)\
**Replies:** 15\
**Last updated:** [November 20, 2019, 2:00pm UTC](https://discourse.julialang.org/t/evaluating-expressions-in-file/31172 "2019-11-20T14:00:24Z")

</div>

Hi, I’m hitting one of these eval() scope-related issue, that I don’t know how to solve… maybe you can help me. This is related to an old Julia 0.6.2 code of mine, which was reading initial data from an external file, w…

---

## [Introspection on comprehension expressions](https://discourse.julialang.org/t/introspection-on-comprehension-expressions/31311)

<div class="topic-metadata">

**Author:** [@stakaz](https://discourse.julialang.org/u/stakaz)\
**Replies:** 3\
**Last updated:** [November 20, 2019, 1:08pm UTC](https://discourse.julialang.org/t/introspection-on-comprehension-expressions/31311 "2019-11-20T13:08:12Z")

</div>

Hello, somehow I cannot introspect (@code\_lowered, @code\_warntype, …) on comprehension expressions. Is it somehow possible to achieve? E. g.: julia\> A = \[1,2,3,4,5\]; julia\> @code\_lowered \[a^2 for a in A\] ERROR: expres…

---

## [How to crop a given .osm file?](https://discourse.julialang.org/t/how-to-crop-a-given-osm-file/31305)

<div class="topic-metadata">

**Author:** [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Replies:** 0\
**Last updated:** [November 20, 2019, 8:55am UTC](https://discourse.julialang.org/t/how-to-crop-a-given-osm-file/31305 "2019-11-20T08:55:54Z")

</div>

I have been bothered with this for a while. I downloaded .osm.pbf file from the internet, it’s like 477MB. Then, I cropped it using the following command, osmium extract -b 10,10,25,40 map.osm.pbf -o map\_b.osm.pbf an…

---

## [Need help on how to start implementing reinforcement learning example using Julia](https://discourse.julialang.org/t/need-help-on-how-to-start-implementing-reinforcement-learning-example-using-julia/29362)

<div class="topic-metadata">

**Author:** [@Niti\_Rohilla](https://discourse.julialang.org/u/Niti_Rohilla)\
**Replies:** 5\
**Last updated:** [November 20, 2019, 7:11am UTC](https://discourse.julialang.org/t/need-help-on-how-to-start-implementing-reinforcement-learning-example-using-julia/29362 "2019-11-20T07:11:10Z")

</div>

Hi, I am new to Julia. I want to explore reinforcement learning using julia. But there are so many packages available for reinforcement learning using julia. https://github.com/JuliaReinforcementLearning https://githu…

---

## [How to dispatch on Type Vararg?](https://discourse.julialang.org/t/how-to-dispatch-on-type-vararg/31252)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 6\
**Last updated:** [November 20, 2019, 6:36am UTC](https://discourse.julialang.org/t/how-to-dispatch-on-type-vararg/31252 "2019-11-20T06:36:43Z")

</div>

julia\> Type{Vararg} ERROR: TypeError: in Type, in parameter, expected Type, got Vararg this seems to be known and explicitly forced https://github.com/JuliaLang/julia/issues/30995 Does someone know an alternative way h…

---

## [Float representation of the same number may not be equal?](https://discourse.julialang.org/t/float-representation-of-the-same-number-may-not-be-equal/31276)

<div class="topic-metadata">

**Author:** [@LarkyJulia](https://discourse.julialang.org/u/LarkyJulia)\
**Replies:** 10\
**Last updated:** [November 19, 2019, 9:42pm UTC](https://discourse.julialang.org/t/float-representation-of-the-same-number-may-not-be-equal/31276 "2019-11-19T21:42:44Z")

</div>

When programming before, I sometimes get problem like: a=3.1415926 b=3.1415926 a==b it output false, why? check it out and found b is actually 3.1415926000000001 something like that. so I always have to replace a==b…

---

## [Memory leak with BenchmarkTools?](https://discourse.julialang.org/t/memory-leak-with-benchmarktools/31282)

<div class="topic-metadata">

**Author:** [@LaurentPlagne](https://discourse.julialang.org/u/LaurentPlagne)\
**Replies:** 6\
**Last updated:** [November 19, 2019, 8:56pm UTC](https://discourse.julialang.org/t/memory-leak-with-benchmarktools/31282 "2019-11-19T20:56:42Z")

</div>

I make numerous calls to @belapsed within a loop and I see the memory consumption constantly increasing… Anybody experienced such problem ?\`

---

## [Shrinking array size](https://discourse.julialang.org/t/shrinking-array-size/31280)

<div class="topic-metadata">

**Author:** [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Replies:** 5\
**Last updated:** [November 19, 2019, 7:18pm UTC](https://discourse.julialang.org/t/shrinking-array-size/31280 "2019-11-19T19:18:31Z")

</div>

I have some vectors which are initially very big to do some computation, but which shrink afterwards and will stay small for the rest of the code’s execution. Unfortunately, it seems that Julia’s underlying arrays never …

---

## [A package for MCMC Bayesian inference](https://discourse.julialang.org/t/a-package-for-mcmc-bayesian-inference/31271)

<div class="topic-metadata">

**Author:** [@marouane1994](https://discourse.julialang.org/u/marouane1994)\
**Replies:** 2\
**Last updated:** [November 19, 2019, 12:02pm UTC](https://discourse.julialang.org/t/a-package-for-mcmc-bayesian-inference/31271 "2019-11-19T12:02:32Z")

</div>

i have a code where i want to use MCMC, for that i used to work with Klara but now since Klara is not available and Mamba doesn’t seem that it’s the package that i’m looking for are there any other ones?

---

## [Squaring the square algorithm in julia](https://discourse.julialang.org/t/squaring-the-square-algorithm-in-julia/30996)

<div class="topic-metadata">

**Author:** [@YongHee-Kim](https://discourse.julialang.org/u/YongHee-Kim)\
**Replies:** 2\
**Last updated:** [November 19, 2019, 9:41am UTC](https://discourse.julialang.org/t/squaring-the-square-algorithm-in-julia/30996 "2019-11-19T09:41:54Z")

</div>

I’m trying to solve Squaring the square problem and hope to find a reference algorithm written in Julia. But couldn’t find one (probably because I don’t know where to look for) I want to know if a given set of the squar…

---

## [\`\[I(2) rand(2,100)\]\` is sparse?](https://discourse.julialang.org/t/i-2-rand-2-100-is-sparse/31241)

<div class="topic-metadata">

**Author:** [@Paul\_Soderlind](https://discourse.julialang.org/u/Paul_Soderlind)\
**Replies:** 2\
**Last updated:** [November 19, 2019, 8:03am UTC](https://discourse.julialang.org/t/i-2-rand-2-100-is-sparse/31241 "2019-11-19T08:03:02Z")

</div>

\[I(2) rand(2,100)\] gives a sparse matrix. May I ask why?

---

## [Array{T, 1} where T\<:Real versus Array{T where T\<:Real, 1}](https://discourse.julialang.org/t/array-t-1-where-t-real-versus-array-t-where-t-real-1/31249)

<div class="topic-metadata">

**Author:** [@Sijun](https://discourse.julialang.org/u/Sijun)\
**Replies:** 5\
**Last updated:** [November 19, 2019, 7:53am UTC](https://discourse.julialang.org/t/array-t-1-where-t-real-versus-array-t-where-t-real-1/31249 "2019-11-19T07:53:07Z")

</div>

T1 = Array{T, 1} where T\<:Real represents all possible arrays of the form \[T, T, T, T, . . . \], i.e., any array of T1 consists of elements of the subtype of Real and they have to be of same type. On the other hand, T2 …

---

## [What role does bearing play in road network modelling?](https://discourse.julialang.org/t/what-role-does-bearing-play-in-road-network-modelling/31254)

<div class="topic-metadata">

**Author:** [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Replies:** 0\
**Last updated:** [November 19, 2019, 7:19am UTC](https://discourse.julialang.org/t/what-role-does-bearing-play-in-road-network-modelling/31254 "2019-11-19T07:19:44Z")

</div>

Hi. I understand that bearing is related to the direction / angle of the vehicle movement. Based on wiki, Trigonometry/Compass Bearings - Wikibooks, open books for an open world, I got what it is. After viewing this vide…

---

## [Registry dirty](https://discourse.julialang.org/t/registry-dirty/17989)

<div class="topic-metadata">

**Author:** [@greg\_plowman](https://discourse.julialang.org/u/greg_plowman)\
**Replies:** 30\
**Last updated:** [November 19, 2019, 5:58am UTC](https://discourse.julialang.org/t/registry-dirty/17989 "2019-11-19T05:58:42Z")

</div>

Apparently my registry is dirty; how should I clean it? Julia-1.0.2\> Pkg.update() Updating registry at \`C:\\Users\\plowman\\.julia\\registries\\General\` ┌ Warning: Some registries failed to update: │ — \`C:\\Users\\plowma…

---

## [Interpreting multiple lines on one level of ProfileView](https://discourse.julialang.org/t/interpreting-multiple-lines-on-one-level-of-profileview/31235)

<div class="topic-metadata">

**Author:** [@Ross\_Boylan](https://discourse.julialang.org/u/Ross_Boylan)\
**Replies:** 1\
**Last updated:** [November 19, 2019, 12:21am UTC](https://discourse.julialang.org/t/interpreting-multiple-lines-on-one-level-of-profileview/31235 "2019-11-19T00:21:15Z")

</div>

A handy feature of ProfileView is that hovering over the graph shows the line that goes with the bar one is over. However, for some of my results, I see multiple lines listed. What does this mean? @tim.holy I wasn’t…

---

## [Latex-friendly picture with Plots()](https://discourse.julialang.org/t/latex-friendly-picture-with-plots/31223)

<div class="topic-metadata">

**Author:** [@juliauser](https://discourse.julialang.org/u/juliauser)\
**Replies:** 9\
**Last updated:** [November 18, 2019, 11:54pm UTC](https://discourse.julialang.org/t/latex-friendly-picture-with-plots/31223 "2019-11-18T23:54:46Z")

</div>

Hi, What is the best/simplest to use package to create pictures with Plots() that can be exported to latex? Trying to avoid the regular png.

---

## [Automating a constructor for all subtypes](https://discourse.julialang.org/t/automating-a-constructor-for-all-subtypes/31240)

<div class="topic-metadata">

**Author:** [@andrewning](https://discourse.julialang.org/u/andrewning)\
**Replies:** 4\
**Last updated:** [November 18, 2019, 10:41pm UTC](https://discourse.julialang.org/t/automating-a-constructor-for-all-subtypes/31240 "2019-11-18T22:41:49Z")

</div>

MWE below. I have an abstract type (AbstractComponent) and when a user creates a subtype of this abstract type I need to convert that to something else entirely (Python). This converted object is actually a Python obje…

---

## [Alpha values in 3d plotting](https://discourse.julialang.org/t/alpha-values-in-3d-plotting/31236)

<div class="topic-metadata">

**Author:** [@Dom-Skinner](https://discourse.julialang.org/u/Dom-Skinner)\
**Replies:** 1\
**Last updated:** [November 18, 2019, 9:17pm UTC](https://discourse.julialang.org/t/alpha-values-in-3d-plotting/31236 "2019-11-18T21:17:51Z")

</div>

When using the pyplots backend for 3d scatter, the points have different alpha values even when you set alpha to be equal to 1. Anyone know how to control the alpha values? E.g. using Plots pyplot() P = \[rand(10) for …

---

## [Hack: AMD Ryzen/TR/Epyc + Intel Math Kernel Library (MKL)](https://discourse.julialang.org/t/hack-amd-ryzen-tr-epyc-intel-math-kernel-library-mkl/31226)

<div class="topic-metadata">

**Author:** [@ImreSamu](https://discourse.julialang.org/u/ImreSamu)\
**Replies:** 0\
**Last updated:** [November 18, 2019, 2:50pm UTC](https://discourse.julialang.org/t/hack-amd-ryzen-tr-epyc-intel-math-kernel-library-mkl/31226 "2019-11-18T14:50:37Z")

</div>

Interesting performance hack for Ryzen/TR CPU + MKL → “up to 250% performance gains” (based on reddit post ) in theory it should work with Julia+MKL ; Anybody can test / validate ? “The method provided here does e…

---

## [Why it is so slow to factor(BigInt) by Primes?](https://discourse.julialang.org/t/why-it-is-so-slow-to-factor-bigint-by-primes/31112)

<div class="topic-metadata">

**Author:** [@shenlixing](https://discourse.julialang.org/u/shenlixing)\
**Replies:** 5\
**Last updated:** [November 18, 2019, 9:30am UTC](https://discourse.julialang.org/t/why-it-is-so-slow-to-factor-bigint-by-primes/31112 "2019-11-18T09:30:06Z")

</div>

I add Primes into Julia today , it works well. But a little surprise, when factor(12346871234523845243095830496798990897706789), it takes 89 seconds, much longer than SageMath ( less than 1 second). I guess that Prime…

---

## [Please help me with my optimal power flow problem](https://discourse.julialang.org/t/please-help-me-with-my-optimal-power-flow-problem/31211)

<div class="topic-metadata">

**Author:** [@varun\_yaramasu](https://discourse.julialang.org/u/varun_yaramasu)\
**Replies:** 2\
**Last updated:** [November 18, 2019, 9:02am UTC](https://discourse.julialang.org/t/please-help-me-with-my-optimal-power-flow-problem/31211 "2019-11-18T09:02:25Z")

</div>

using JuMP,Ipopt m=Model(with\_optimizer(Ipopt.Optimizer)) from to r x b Max\_MVA(rate) branch=\[ 1 2 0.1 0.2 0.04 60 1 4 0.05 0.2 0.04 90 1 5 0.08 0.3 0…

---

## [How to document type properties defined with \`getproperty\`?](https://discourse.julialang.org/t/how-to-document-type-properties-defined-with-getproperty/31174)

<div class="topic-metadata">

**Author:** [@fverdugo](https://discourse.julialang.org/u/fverdugo)\
**Replies:** 3\
**Last updated:** [November 18, 2019, 7:20am UTC](https://discourse.julialang.org/t/how-to-document-type-properties-defined-with-getproperty/31174 "2019-11-18T07:20:00Z")

</div>

Consider the structs Foo and Bar: """ Doc for type \`Foo\`. """ struct Foo """ Doc for field Foo.x """ x::Int Foo() = new(2) end """ Doc for type \`Bar\`. """ struct Bar end Base.propertynames(::Bar) = (:x,) fu…

---

## [Using ProgressMeter with Optim.optimize?](https://discourse.julialang.org/t/using-progressmeter-with-optim-optimize/31115)

<div class="topic-metadata">

**Author:** [@bashonubuntu](https://discourse.julialang.org/u/bashonubuntu)\
**Replies:** 1\
**Last updated:** [November 17, 2019, 5:48am UTC](https://discourse.julialang.org/t/using-progressmeter-with-optim-optimize/31115 "2019-11-17T05:48:31Z")

</div>

Hello, I sometimes provide parallel functions and parallel gradients to Optim and was wondering if it’s possible to show one’s progress while the computation is mid-way. I am not taking about show\_trace = true because t…

---

## [Union vs intersection of version specifiers](https://discourse.julialang.org/t/union-vs-intersection-of-version-specifiers/31193)

<div class="topic-metadata">

**Author:** [@lostella](https://discourse.julialang.org/u/lostella)\
**Replies:** 3\
**Last updated:** [November 17, 2019, 11:51pm UTC](https://discourse.julialang.org/t/union-vs-intersection-of-version-specifiers/31193 "2019-11-17T23:51:02Z")

</div>

Hi dear fellow julians. The documentation for Pkg mentions here that The union of multiple version specifiers can be formed by comma separating individual version specifiers, e.g. \[compat\] Example = "1.2, 2" will res…

---

## [Correct way to populate an empty array in parallel in Julia?](https://discourse.julialang.org/t/correct-way-to-populate-an-empty-array-in-parallel-in-julia/31187)

<div class="topic-metadata">

**Author:** [@bashonubuntu](https://discourse.julialang.org/u/bashonubuntu)\
**Replies:** 2\
**Last updated:** [November 17, 2019, 10:19pm UTC](https://discourse.julialang.org/t/correct-way-to-populate-an-empty-array-in-parallel-in-julia/31187 "2019-11-17T22:19:34Z")

</div>

Hello, Often times in parallel code, I find myself in need of populating an empty array. I have gone back and forth between using a vcat operation versus a SharedArray. A typical pseudo-code would look like: function m…

[Previous page](https://discourse.julialang.org/c/usage/6.md?page=811)

[Next page](https://discourse.julialang.org/c/usage/6.md?page=813)
