# General Usage

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

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

**Page:** 745

---

## [ODE: no method matching similar](https://discourse.julialang.org/t/ode-no-method-matching-similar/40764)

<div class="topic-metadata">

**Author:** [@99dB](https://discourse.julialang.org/u/99dB)\
**Replies:** 6\
**Last updated:** [June 4, 2020, 9:57pm UTC](https://discourse.julialang.org/t/ode-no-method-matching-similar/40764 "2020-06-04T21:57:29Z")

</div>

Hi All, I try to compile an ODE model of 1 variable u but I need an if statement based on t. like something: function dudt!(du,u,p,t) if rem(t,10) \< 5 pp = p\[1\]\*t; end du = pp\*u end But I get the following message: M…

---

## [PyJulia Custom Package](https://discourse.julialang.org/t/pyjulia-custom-package/40697)

<div class="topic-metadata">

**Author:** [@Lucas\_Liu](https://discourse.julialang.org/u/Lucas_Liu)\
**Replies:** 1\
**Last updated:** [June 4, 2020, 7:39pm UTC](https://discourse.julialang.org/t/pyjulia-custom-package/40697 "2020-06-04T19:39:31Z")

</div>

Hi I am new to PyJulia. Is it possible to add custom package in a custom system image for Pyjulia?

---

## [10x slowdown when passing function as argument](https://discourse.julialang.org/t/10x-slowdown-when-passing-function-as-argument/40382)

<div class="topic-metadata">

**Author:** [@jlchan](https://discourse.julialang.org/u/jlchan)\
**Replies:** 15\
**Last updated:** [June 4, 2020, 6:04pm UTC](https://discourse.julialang.org/t/10x-slowdown-when-passing-function-as-argument/40382 "2020-06-04T18:04:41Z")

</div>

I’m trying to understand why passing a function as an argument is sometimes 10x slower than inheriting it via closure. Here’s a contrived MWE: function outer1(f) out = zeros(1000) for i = 1:1000 function…

---

## [ODE solver takes long time](https://discourse.julialang.org/t/ode-solver-takes-long-time/40741)

<div class="topic-metadata">

**Author:** [@AhmedAlreweny](https://discourse.julialang.org/u/AhmedAlreweny)\
**Replies:** 4\
**Last updated:** [June 4, 2020, 5:52pm UTC](https://discourse.julialang.org/t/ode-solver-takes-long-time/40741 "2020-06-04T17:52:05Z")

</div>

I have an ODE that I am trying to solve as follows: L = 39 c = 0.0 Δx = 0.2 Δt = 0.1 Tspan = 100 t\_vec = 0:Δt:Tspan x\_vec = 0:Δx:L N = length(x\_vec) p = c …

---

## [Structured display for Julia objects](https://discourse.julialang.org/t/structured-display-for-julia-objects/40700)

<div class="topic-metadata">

**Author:** [@pauljurczak](https://discourse.julialang.org/u/pauljurczak)\
**Replies:** 2\
**Last updated:** [June 4, 2020, 5:48pm UTC](https://discourse.julialang.org/t/structured-display-for-julia-objects/40700 "2020-06-04T17:48:37Z")

</div>

I find the structured display for arbitrary objects in Juno very convenient: Is there anything similar available for VS Code plugin, Jupyter notebooks or any other Julia IDE? I know about Base.dump, but I prefer a GU…

---

## [Channel is closed error when trying to put! objects in LibCURL write callback](https://discourse.julialang.org/t/channel-is-closed-error-when-trying-to-put-objects-in-libcurl-write-callback/40705)

<div class="topic-metadata">

**Author:** [@bluesmoon](https://discourse.julialang.org/u/bluesmoon)\
**Replies:** 1\
**Last updated:** [June 4, 2020, 1:20pm UTC](https://discourse.julialang.org/t/channel-is-closed-error-when-trying-to-put-objects-in-libcurl-write-callback/40705 "2020-06-04T13:20:23Z")

</div>

Solved by wrapping curl\_easy\_perform in @async Julia version: 1.0.5 LibCURL: \[b27032c2\] LibCURL v0.5.2 julia\> unsafe\_string(LibCURL.curl\_version()) "libcurl/7.64.1 mbedTLS/2.6.1 zlib/1.2.11" When I use a write callba…

---

## [Why upper bounds in Project.toml?](https://discourse.julialang.org/t/why-upper-bounds-in-project-toml/40725)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 1\
**Last updated:** [June 4, 2020, 12:55pm UTC](https://discourse.julialang.org/t/why-upper-bounds-in-project-toml/40725 "2020-06-04T12:55:03Z")

</div>

I have not clear the meaning of mandate an upper bound for dependent packages in Project.toml. I normally require the functionality of a package, I know this functionality in package X has been added at version Y.Y.Y, s…

---

## [Precompilation](https://discourse.julialang.org/t/precompilation/40723)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 0\
**Last updated:** [June 4, 2020, 12:31pm UTC](https://discourse.julialang.org/t/precompilation/40723 "2020-06-04T12:31:25Z")

</div>

I am using Atom with Julia v1.4; I keep my libraries precompiled at the beginning of the day and did some great work yesterday. This morning, after leaving Atom open overnight, I find that everything must be recompiled. …

---

## [Efficient merging of large dictionaries](https://discourse.julialang.org/t/efficient-merging-of-large-dictionaries/40687)

<div class="topic-metadata">

**Author:** [@racinmat](https://discourse.julialang.org/u/racinmat)\
**Replies:** 4\
**Last updated:** [June 4, 2020, 10:39am UTC](https://discourse.julialang.org/t/efficient-merging-of-large-dictionaries/40687 "2020-06-04T10:39:03Z")

</div>

Hi, I have few (tens, max. hundreds) Dict{String, Int} dictionaries which I want to merge together using merge(+, dicts…). The dictionaries are fairly large (up to 100k keys), and have lots of common keys. It’s working…

---

## [Coverage test is extremely slow on multiple threads](https://discourse.julialang.org/t/coverage-test-is-extremely-slow-on-multiple-threads/40682)

<div class="topic-metadata">

**Author:** [@erik-f](https://discourse.julialang.org/u/erik-f)\
**Replies:** 6\
**Last updated:** [June 4, 2020, 9:36am UTC](https://discourse.julialang.org/t/coverage-test-is-extremely-slow-on-multiple-threads/40682 "2020-06-04T09:36:43Z")

</div>

Running Pkg.test("MyModule", coverage=true) on more than one thread is extremely slow. I measured the time on my machine using 1, 2, 8 and 16 threads: 1 thread: 339 seconds 2 threads: 3106 seconds 8 threads: 6401 sec…

---

## [Clearing variables in Jupyter Lab](https://discourse.julialang.org/t/clearing-variables-in-jupyter-lab/40709)

<div class="topic-metadata">

**Author:** [@fusion809](https://discourse.julialang.org/u/fusion809)\
**Replies:** 1\
**Last updated:** [June 4, 2020, 8:08am UTC](https://discourse.julialang.org/t/clearing-variables-in-jupyter-lab/40709 "2020-06-04T08:08:42Z")

</div>

I’m running a computation in Julia (specifically via Jupyter Lab) that uses up over half of my RAM, and I find if I do not clear my workspace before running it again by shutting down and then restarting the kernel my PC …

---

## [Revise.jl with Distributed and pmap -- why does this behavior not work?](https://discourse.julialang.org/t/revise-jl-with-distributed-and-pmap-why-does-this-behavior-not-work/35944)

<div class="topic-metadata">

**Author:** [@torgo](https://discourse.julialang.org/u/torgo)\
**Replies:** 6\
**Last updated:** [June 3, 2020, 10:11pm UTC](https://discourse.julialang.org/t/revise-jl-with-distributed-and-pmap-why-does-this-behavior-not-work/35944 "2020-06-03T22:11:55Z")

</div>

\# ModuleA.jl module ModuleA using Distributed function foo() # a = 5 r = pmap((x -\> myid()), fill(1, 10)) end export foo end First I run this: using Distributed addprocs(4) @everywhere push!(LOAD\_PATH, pwd(…

---

## [Segfault wrapping GNU multiprecision library MPFR](https://discourse.julialang.org/t/segfault-wrapping-gnu-multiprecision-library-mpfr/40066)

<div class="topic-metadata">

**Author:** [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Replies:** 7\
**Last updated:** [June 3, 2020, 6:28pm UTC](https://discourse.julialang.org/t/segfault-wrapping-gnu-multiprecision-library-mpfr/40066 "2020-06-03T18:28:56Z")

</div>

I would like to wrap the GNU multiprecision library MPFR to do in-place operations, and I get a segfault on Windows10 (and Julia 1.4.0 and 1.4.1) when running include("test.jl"). The file test.jl (code below) wraps the t…

---

## [Sparse to dense matrix](https://discourse.julialang.org/t/sparse-to-dense-matrix/8380)

<div class="topic-metadata">

**Author:** [@IljaK91](https://discourse.julialang.org/u/IljaK91)\
**Replies:** 15\
**Last updated:** [June 3, 2020, 5:34pm UTC](https://discourse.julialang.org/t/sparse-to-dense-matrix/8380 "2020-06-03T17:34:15Z")

</div>

For some numerical optimization I need to get the inverse of a sparse matrix. How do I compute it efficiently? Julia throws me an error when I try to use either inv() or A\\B and tells me to convert my sparse matrix first…

---

## [Wrapping a recursive struct with Clang.jl](https://discourse.julialang.org/t/wrapping-a-recursive-struct-with-clang-jl/40680)

<div class="topic-metadata">

**Author:** [@KajWiik](https://discourse.julialang.org/u/KajWiik)\
**Replies:** 1\
**Last updated:** [June 3, 2020, 3:38pm UTC](https://discourse.julialang.org/t/wrapping-a-recursive-struct-with-clang-jl/40680 "2020-06-03T15:38:59Z")

</div>

I am trying to wrap a C library containing several recursive structs like this: struct B; typedef struct A { int foo; struct B \*b; } A; typedef struct B { int faa; A \*a; } B; produces wrapper like this # Aut…

---

## [How to extend different internal methods based on the module I load?](https://discourse.julialang.org/t/how-to-extend-different-internal-methods-based-on-the-module-i-load/40661)

<div class="topic-metadata">

**Author:** [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Replies:** 4\
**Last updated:** [June 3, 2020, 3:38pm UTC](https://discourse.julialang.org/t/how-to-extend-different-internal-methods-based-on-the-module-i-load/40661 "2020-06-03T15:38:05Z")

</div>

For example, if I have a function outer that has an internal implementation inner, and I want to extend inner in different modules. module Outer export outer function outer(a, b) # do something print(methods(inne…

---

## [The right mental model of \`@threads\`?](https://discourse.julialang.org/t/the-right-mental-model-of-threads/40651)

<div class="topic-metadata">

**Author:** [@scheidan](https://discourse.julialang.org/u/scheidan)\
**Replies:** 6\
**Last updated:** [June 3, 2020, 2:32pm UTC](https://discourse.julialang.org/t/the-right-mental-model-of-threads/40651 "2020-06-03T14:32:40Z")

</div>

Hi, After reading this blog about multi-threading I’ve tried to parallelize a recursive algorithm. The problem is that it used modifying functions and the docs warn us that “we might get a wrong answer”. And indeed, in …

---

## [Correct way to include a Distributed workflow in a module](https://discourse.julialang.org/t/correct-way-to-include-a-distributed-workflow-in-a-module/40672)

<div class="topic-metadata">

**Author:** [@ianshmean](https://discourse.julialang.org/u/ianshmean)\
**Replies:** 0\
**Last updated:** [June 3, 2020, 2:18pm UTC](https://discourse.julialang.org/t/correct-way-to-include-a-distributed-workflow-in-a-module/40672 "2020-06-03T14:18:10Z")

</div>

I want to produce a private package that fully manages and runs a series of distributed processes on private workers, but I’m seeing unstable code loading & scope issues. The kind of approach below errors most of the tim…

---

## [Could not load library "libanco-ratip2013.so" The specified module could not be found](https://discourse.julialang.org/t/could-not-load-library-libanco-ratip2013-so-the-specified-module-could-not-be-found/35415)

<div class="topic-metadata">

**Author:** [@Mehran\_Baki](https://discourse.julialang.org/u/Mehran_Baki)\
**Replies:** 8\
**Last updated:** [June 3, 2020, 10:59am UTC](https://discourse.julialang.org/t/could-not-load-library-libanco-ratip2013-so-the-specified-module-could-not-be-found/35415 "2020-06-03T10:59:43Z")

</div>

I have a problem with opening a library using JuliaPro\_v1.3.1-1 on Windows 10. the error is “could not load library “C:\\Users\\username.juliapro\\JuliaPro\_v1.3.1-1\\packages\\JAC\\ztL1S\\deps\\bin\\libanco-ratip2013.so” The spec…

---

## [How to name a dataframe based on a value in a comprehension list](https://discourse.julialang.org/t/how-to-name-a-dataframe-based-on-a-value-in-a-comprehension-list/40655)

<div class="topic-metadata">

**Author:** [@HelgavonLichtenstein](https://discourse.julialang.org/u/HelgavonLichtenstein)\
**Replies:** 1\
**Last updated:** [June 3, 2020, 9:24am UTC](https://discourse.julialang.org/t/how-to-name-a-dataframe-based-on-a-value-in-a-comprehension-list/40655 "2020-06-03T09:24:33Z")

</div>

Hello, is there a way to name a dataframe using the value of x in a comprehension list? I hoped using $variable\_I\_am\_interested would take the value of that variable and put it into the name, similar to using $ in a stri…

---

## [Collection of Examples and Packages ready for App (executables) creation](https://discourse.julialang.org/t/collection-of-examples-and-packages-ready-for-app-executables-creation/40648)

<div class="topic-metadata">

**Author:** [@uwechsler](https://discourse.julialang.org/u/uwechsler)\
**Replies:** 0\
**Last updated:** [June 3, 2020, 7:51am UTC](https://discourse.julialang.org/t/collection-of-examples-and-packages-ready-for-app-executables-creation/40648 "2020-06-03T07:51:10Z")

</div>

After watching the Webinar on the PackagCompiler and skimming through the documentation, I am really excited about the progress made towards creating an executable from a Julia module. From my understanding, once conditi…

---

## [Organisation into submodules and multiple dispatch](https://discourse.julialang.org/t/organisation-into-submodules-and-multiple-dispatch/40641)

<div class="topic-metadata">

**Author:** [@sparrowhawk](https://discourse.julialang.org/u/sparrowhawk)\
**Replies:** 7\
**Last updated:** [June 3, 2020, 6:15am UTC](https://discourse.julialang.org/t/organisation-into-submodules-and-multiple-dispatch/40641 "2020-06-03T06:15:29Z")

</div>

I want to have a supermodule that contains a function, which carries out different operations depending on the input type. Depending on the type, this function is defined in various submodules. The submodules can be supe…

---

## [How to make a wind rose in Julia](https://discourse.julialang.org/t/how-to-make-a-wind-rose-in-julia/40229)

<div class="topic-metadata">

**Author:** [@scone](https://discourse.julialang.org/u/scone)\
**Replies:** 22\
**Last updated:** [June 3, 2020, 6:10am UTC](https://discourse.julialang.org/t/how-to-make-a-wind-rose-in-julia/40229 "2020-06-03T06:10:05Z")

</div>

Hi, I am trying to just make a wind rose. Its a pretty basic thing, and I can’t find any implementation of it in Julia. The closest I have come is to use the plotlyjs backend, but I can’t figure out how to reverse a…

---

## [Two question on Channel operation](https://discourse.julialang.org/t/two-question-on-channel-operation/40626)

<div class="topic-metadata">

**Author:** [@zhangliye](https://discourse.julialang.org/u/zhangliye)\
**Replies:** 4\
**Last updated:** [June 3, 2020, 4:22am UTC](https://discourse.julialang.org/t/two-question-on-channel-operation/40626 "2020-06-03T04:22:41Z")

</div>

Qestion1: Because the max size of chnl is 0, the following code should be blocked. Why the following code is not blocked? chnl = Channel() do ch foreach(i -\> put!(ch, i), 1:4) # not blocked end; The following is…

---

## [Use an external variable inside a loop](https://discourse.julialang.org/t/use-an-external-variable-inside-a-loop/40453)

<div class="topic-metadata">

**Author:** [@HuascarOk](https://discourse.julialang.org/u/HuascarOk)\
**Replies:** 11\
**Last updated:** [June 3, 2020, 3:15am UTC](https://discourse.julialang.org/t/use-an-external-variable-inside-a-loop/40453 "2020-06-03T03:15:50Z")

</div>

Hello, i need help to use an external variable inside a loop. I’ve been trying for days and i still don’t have an idea of how to use something outside a for inside it, change it and then use it’s new value outside. Here’…

---

## [ERROR in adding a package](https://discourse.julialang.org/t/error-in-adding-a-package/40623)

<div class="topic-metadata">

**Author:** [@xinzhicaishu](https://discourse.julialang.org/u/xinzhicaishu)\
**Replies:** 3\
**Last updated:** [June 3, 2020, 12:40am UTC](https://discourse.julialang.org/t/error-in-adding-a-package/40623 "2020-06-03T00:40:30Z")

</div>

---

## [Vector of Vectors with different size to one Vector](https://discourse.julialang.org/t/vector-of-vectors-with-different-size-to-one-vector/40534)

<div class="topic-metadata">

**Author:** [@BMval](https://discourse.julialang.org/u/BMval)\
**Replies:** 9\
**Last updated:** [June 2, 2020, 8:26pm UTC](https://discourse.julialang.org/t/vector-of-vectors-with-different-size-to-one-vector/40534 "2020-06-02T20:26:59Z")

</div>

I am sorry for the easy questions. Would you suggest how to convert: Vector of Vectors with different size to one Vector

---

## [Apparently incorrect error when going out of bounds on a dataframe](https://discourse.julialang.org/t/apparently-incorrect-error-when-going-out-of-bounds-on-a-dataframe/40622)

<div class="topic-metadata">

**Author:** [@klaff](https://discourse.julialang.org/u/klaff)\
**Replies:** 2\
**Last updated:** [June 2, 2020, 6:31pm UTC](https://discourse.julialang.org/t/apparently-incorrect-error-when-going-out-of-bounds-on-a-dataframe/40622 "2020-06-02T18:31:41Z")

</div>

julia\> df=DataFrame(rand(3,3)) 3×3 DataFrame │ Row │ x1 │ x2 │ x3 │ │ │ Float64 │ Float64 │ Float64 │ ├─────┼──────────┼──────────┼──────────┤ │ 1 │ 0.505311 │ 0.327654 │ 0.761537 │ │ 2 │ 0.6…

---

## [How would I check for unique values across many arrays without for loops?](https://discourse.julialang.org/t/how-would-i-check-for-unique-values-across-many-arrays-without-for-loops/40341)

<div class="topic-metadata">

**Author:** [@Julia1](https://discourse.julialang.org/u/Julia1)\
**Replies:** 7\
**Last updated:** [June 2, 2020, 5:21pm UTC](https://discourse.julialang.org/t/how-would-i-check-for-unique-values-across-many-arrays-without-for-loops/40341 "2020-06-02T17:21:16Z")

</div>

Hi how’s it going? Say I have 3 arrays: X = \[1,2,3,4,5\] Y = \[1,2,3,4\] Z = \[1,2,3,4\] I want to return that of the 5 unique values across X, Y and Z, only the number 5 is truly unique, because it only occurs in 1 arr…

---

## [Protocols/Interfaces/Traits... or: The "what to implement problem"](https://discourse.julialang.org/t/protocols-interfaces-traits-or-the-what-to-implement-problem/40137)

<div class="topic-metadata">

**Author:** [@FHell](https://discourse.julialang.org/u/FHell)\
**Replies:** 10\
**Last updated:** [June 2, 2020, 2:22pm UTC](https://discourse.julialang.org/t/protocols-interfaces-traits-or-the-what-to-implement-problem/40137 "2020-06-02T14:22:35Z")

</div>

Hello everyone, I am interested in picking up the “what to implement problem” of defining interfaces/protocols in Julia. In my view the broad issue is: How do I encode invariants and expectations of my code. This is cri…

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

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