# General Usage

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

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

**Page:** 420

---

## [SDEProblem with mutliple independent Wiener Processes](https://discourse.julialang.org/t/sdeproblem-with-mutliple-independent-wiener-processes/84610)

<div class="topic-metadata">

**Author:** [@olliethurston](https://discourse.julialang.org/u/olliethurston)\
**Replies:** 4\
**Last updated:** [July 22, 2022, 9:48am UTC](https://discourse.julialang.org/t/sdeproblem-with-mutliple-independent-wiener-processes/84610 "2022-07-22T09:48:02Z")

</div>

I am trying to solve a 4D chemical Langevin SDE problem with multiplicative noise in the form of independent wiener processes (WPs). Since my system is built upon 4 states and 8 reactions, my drift function F returns a (…

---

## [Making Sure the Graphs I Plot is Correct](https://discourse.julialang.org/t/making-sure-the-graphs-i-plot-is-correct/84626)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 2\
**Last updated:** [July 22, 2022, 9:37am UTC](https://discourse.julialang.org/t/making-sure-the-graphs-i-plot-is-correct/84626 "2022-07-22T09:37:56Z")

</div>

Hi all, I just want to make sure that the graphs plot I made are correct. It is a limit problems in Calculus. I am just doubting if the graphs of mine are correct. I want t know whether we can automatically plot the: …

---

## [Julia 1.7.3 returns incorrect result in compiled mode, not in interpreted mode](https://discourse.julialang.org/t/julia-1-7-3-returns-incorrect-result-in-compiled-mode-not-in-interpreted-mode/84572)

<div class="topic-metadata">

**Author:** [@dleather](https://discourse.julialang.org/u/dleather)\
**Replies:** 2\
**Last updated:** [July 22, 2022, 4:39am UTC](https://discourse.julialang.org/t/julia-1-7-3-returns-incorrect-result-in-compiled-mode-not-in-interpreted-mode/84572 "2022-07-22T04:39:55Z")

</div>

I’ve written up a numeric function that computes the log-likelihood of a discrete-time hidden Markov model, which involves Gauss quadrature and an optimization step. The function using Julia 1.6.2 gives the same exact re…

---

## [Allocation help - preforming computations over loops](https://discourse.julialang.org/t/allocation-help-preforming-computations-over-loops/84607)

<div class="topic-metadata">

**Author:** [@cosmia](https://discourse.julialang.org/u/cosmia)\
**Replies:** 7\
**Last updated:** [July 21, 2022, 10:33pm UTC](https://discourse.julialang.org/t/allocation-help-preforming-computations-over-loops/84607 "2022-07-21T22:33:19Z")

</div>

I am trying to optimize my code and I’ve tried to follow all performance tips in the manual and browsing the forum. I’ve avoided slicing arrays with @views, made sure to pre-allocate arrays, etc. However, I don’t really …

---

## [Is there a matrix/array equivalent of \[a,b,c\]?](https://discourse.julialang.org/t/is-there-a-matrix-array-equivalent-of-a-b-c/84597)

<div class="topic-metadata">

**Author:** [@JonasWickman](https://discourse.julialang.org/u/JonasWickman)\
**Replies:** 7\
**Last updated:** [July 21, 2022, 9:31pm UTC](https://discourse.julialang.org/t/is-there-a-matrix-array-equivalent-of-a-b-c/84597 "2022-07-21T21:31:57Z")

</div>

I often find myself in a situation where it is convenient to create matrices or arrays with various objects in them. For vectors, the syntax \[a,b,c\] will create a vector that holds variables a, b, and c, no matter what t…

---

## [Generating a sysimage from running julia system](https://discourse.julialang.org/t/generating-a-sysimage-from-running-julia-system/84464)

<div class="topic-metadata">

**Author:** [@aleReimondo](https://discourse.julialang.org/u/aleReimondo)\
**Replies:** 6\
**Last updated:** [July 21, 2022, 8:57pm UTC](https://discourse.julialang.org/t/generating-a-sysimage-from-running-julia-system/84464 "2022-07-21T20:57:01Z")

</div>

My system is running, some of the functions has run many times (are actually optimized), there are functions that has been added/overwritten by humman interaction during runtime. I want to generate a sysimage with all f…

---

## [Everything precompiling when opening new notebook](https://discourse.julialang.org/t/everything-precompiling-when-opening-new-notebook/84581)

<div class="topic-metadata">

**Author:** [@Andy2K11](https://discourse.julialang.org/u/Andy2K11)\
**Replies:** 8\
**Last updated:** [July 21, 2022, 4:52pm UTC](https://discourse.julialang.org/t/everything-precompiling-when-opening-new-notebook/84581 "2022-07-21T16:52:32Z")

</div>

Yesterday I was in the machine learning workshop and following along having successfully followed all the setup instructions. At some point we were asked to open a new notebook and it took over 11 minutes before I’d done…

---

## [Indexing (relatively) large nested list causes unintended mutation; doesn't occur after deepcopy](https://discourse.julialang.org/t/indexing-relatively-large-nested-list-causes-unintended-mutation-doesnt-occur-after-deepcopy/84582)

<div class="topic-metadata">

**Author:** [@johnabs](https://discourse.julialang.org/u/johnabs)\
**Replies:** 3\
**Last updated:** [July 21, 2022, 4:10pm UTC](https://discourse.julialang.org/t/indexing-relatively-large-nested-list-causes-unintended-mutation-doesnt-occur-after-deepcopy/84582 "2022-07-21T16:10:55Z")

</div>

I generated a large amount of data from a simulation I’m working on, and was extracting values from the final list of structs via map. It only behaves after making a deepcopy, as you’ll see. Basically: My function gener…

---

## [Operators and functions](https://discourse.julialang.org/t/operators-and-functions/84502)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 7\
**Last updated:** [July 21, 2022, 12:57pm UTC](https://discourse.julialang.org/t/operators-and-functions/84502 "2022-07-21T12:57:31Z")

</div>

How come these work ==(2).(1:5) ≠(2).(1:5) \>(2).(1:5) and these don’t ? +(2).(1:5) \*(2).(1:5) ^(2).(1:5)

---

## [Constructor with Varargs](https://discourse.julialang.org/t/constructor-with-varargs/84568)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 2\
**Last updated:** [July 21, 2022, 12:09pm UTC](https://discourse.julialang.org/t/constructor-with-varargs/84568 "2022-07-21T12:09:15Z")

</div>

This works using Pipe, Parameters @with\_kw struct X A B end x = (A=1, B=2 ) X( x... ) but this fails x = (A=1, B=2, C=3 ) X( x... ) unless you manually filter x to only contain the fields of X. or manually…

---

## [Optimising switching algorithms based on value of struct field](https://discourse.julialang.org/t/optimising-switching-algorithms-based-on-value-of-struct-field/84404)

<div class="topic-metadata">

**Author:** [@f.ij](https://discourse.julialang.org/u/f.ij)\
**Replies:** 19\
**Last updated:** [July 21, 2022, 9:46am UTC](https://discourse.julialang.org/t/optimising-switching-algorithms-based-on-value-of-struct-field/84404 "2022-07-21T09:46:23Z")

</div>

I’m working on a simulation in Julia, where the “centrepiece” is some struct, which can have a few boolean properties associated with it. mutable struct Sim """ data """ prop\_a::Bool prop\_b::Bool ... en…

---

## [What is the difference between map(f, v) and \[f(x) for x in v\]?](https://discourse.julialang.org/t/what-is-the-difference-between-map-f-v-and-f-x-for-x-in-v/84580)

<div class="topic-metadata">

**Author:** [@dodoplus](https://discourse.julialang.org/u/dodoplus)\
**Replies:** 2\
**Last updated:** [July 21, 2022, 7:59am UTC](https://discourse.julialang.org/t/what-is-the-difference-between-map-f-v-and-f-x-for-x-in-v/84580 "2022-07-21T07:59:25Z")

</div>

Hi, Take a look at the following code: using BenchmarkTools s = \["$n" for n in 1:10000\]; @btime map(x-\>parse(Int, x), s); # 174.666 μs (3 allocations: 78.19 KiB) @btime \[x-\>parse(Int, x) for x in s\]; # 3.401 μs (2 allo…

---

## [Can the result of @time measure the spatial complexity of the algorithm?](https://discourse.julialang.org/t/can-the-result-of-time-measure-the-spatial-complexity-of-the-algorithm/84509)

<div class="topic-metadata">

**Author:** [@F-YF](https://discourse.julialang.org/u/F-YF)\
**Replies:** 10\
**Last updated:** [July 21, 2022, 3:16am UTC](https://discourse.julialang.org/t/can-the-result-of-time-measure-the-spatial-complexity-of-the-algorithm/84509 "2022-07-21T03:16:24Z")

</div>

julia\> function myfunc(n::Int64) D=20 a=rand(D,D) for i in 1:n a\*a end end myfunc (generic function with 1 method) julia\> @time myfunc(100) 0.000193 se…

---

## [Previewing Documentation from Documenter.jl](https://discourse.julialang.org/t/previewing-documentation-from-documenter-jl/84560)

<div class="topic-metadata">

**Author:** [@liamfdoherty](https://discourse.julialang.org/u/liamfdoherty)\
**Replies:** 2\
**Last updated:** [July 20, 2022, 11:41pm UTC](https://discourse.julialang.org/t/previewing-documentation-from-documenter-jl/84560 "2022-07-20T23:41:58Z")

</div>

Does anybody know if there is a way to preview package documentation from Documenter.jl (i.e., locally before pushing to GitHub)? I am looking for something similar to the serve() functionality in Franklin.jl, and I have…

---

## [MLStyle.jl difficult pattern](https://discourse.julialang.org/t/mlstyle-jl-difficult-pattern/84561)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 0\
**Last updated:** [July 20, 2022, 11:38pm UTC](https://discourse.julialang.org/t/mlstyle-jl-difficult-pattern/84561 "2022-07-20T23:38:59Z")

</div>

Is it possible to do something like this? using MLStyle @match 1:10 begin \[a, o1..., 5, o2..., b, c\] =\> (a,o1,o2,b,c) end

---

## [Iterating through rows in julia Dataframe](https://discourse.julialang.org/t/iterating-through-rows-in-julia-dataframe/84475)

<div class="topic-metadata">

**Author:** [@ayodyas](https://discourse.julialang.org/u/ayodyas)\
**Replies:** 15\
**Last updated:** [July 20, 2022, 10:08pm UTC](https://discourse.julialang.org/t/iterating-through-rows-in-julia-dataframe/84475 "2022-07-20T22:08:51Z")

</div>

df=DataFrame(p1 = \[1, 2, 3, 4, 5\],p1 = \[10,20,30,40,50\]) df2=DataFrame(q1 = \[1, 12, 13,14, 15\],q2 = \[100,200,300,400,500\]) datas=Dict() for data1 in eachrow(df2) for data in eachrow(df) print("H",data\[1\]," " ,da…

---

## [Error in bulid MPI](https://discourse.julialang.org/t/error-in-bulid-mpi/43948)

<div class="topic-metadata">

**Author:** [@Ke\_Gao](https://discourse.julialang.org/u/Ke_Gao)\
**Replies:** 4\
**Last updated:** [July 20, 2022, 6:38pm UTC](https://discourse.julialang.org/t/error-in-bulid-mpi/43948 "2022-07-20T18:38:41Z")

</div>

Hi, I had an error when I built MPI on my MacBook: (@v1.4) pkg\> build MPI Building MPI → \`~/.julia/packages/MPI/k7f4E/deps/build.log\` ┌ Error: Error building \`MPI\`: │ \[ Info: using system MPI │ ERROR: LoadError: li…

---

## [Error building MPI---ERROR: LoadError: libmpi could not be found](https://discourse.julialang.org/t/error-building-mpi-error-loaderror-libmpi-could-not-be-found/65016)

<div class="topic-metadata">

**Author:** [@QuanlingDeng](https://discourse.julialang.org/u/QuanlingDeng)\
**Replies:** 3\
**Last updated:** [July 20, 2022, 5:54pm UTC](https://discourse.julialang.org/t/error-building-mpi-error-loaderror-libmpi-could-not-be-found/65016 "2022-07-20T17:54:40Z")

</div>

I was trying to build MPI and had the following error (after several searches/tries, see below) (@v1.6) pkg\> build MPI Building MPI → ~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/00488c6fcaf828685c2bc513…

---

## [How to parse an form data with HTTP.jl?](https://discourse.julialang.org/t/how-to-parse-an-form-data-with-http-jl/84523)

<div class="topic-metadata">

**Author:** [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Replies:** 3\
**Last updated:** [July 20, 2022, 5:45pm UTC](https://discourse.julialang.org/t/how-to-parse-an-form-data-with-http-jl/84523 "2022-07-20T17:45:11Z")

</div>

HTTP.Form can take a dictionary of key-value pairs and produce an encoded form string for making POST requests with "Content-Type", "application/x-www-form-urlencoded". How can I take such a request in my server and pars…

---

## [Is there a way to deepcopy a module?](https://discourse.julialang.org/t/is-there-a-way-to-deepcopy-a-module/84094)

<div class="topic-metadata">

**Author:** [@danielw2904](https://discourse.julialang.org/u/danielw2904)\
**Replies:** 1\
**Last updated:** [July 20, 2022, 3:08pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-deepcopy-a-module/84094 "2022-07-20T15:08:36Z")

</div>

using DeepcopyModules module M; x = 1; f() = (global x += 1); end M2 = deepcopy\_module(M) The package is on github. However, this code crashes. Is there any other way? The error is: main at /buildworker/worker/pack…

---

## [Overloading zeros](https://discourse.julialang.org/t/overloading-zeros/84540)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 2\
**Last updated:** [July 20, 2022, 2:39pm UTC](https://discourse.julialang.org/t/overloading-zeros/84540 "2022-07-20T14:39:53Z")

</div>

I find the error message here unclear, it seems to me that the zeros for this new type is clearly defined. What is going on here? Is there any reason not to define new methods to zeros explicitly? julia\> struct A …

---

## [Combining @show with display](https://discourse.julialang.org/t/combining-show-with-display/84522)

<div class="topic-metadata">

**Author:** [@b-fg](https://discourse.julialang.org/u/b-fg)\
**Replies:** 2\
**Last updated:** [July 20, 2022, 1:07pm UTC](https://discourse.julialang.org/t/combining-show-with-display/84522 "2022-07-20T13:07:27Z")

</div>

Hi, I have been looking for a way to output values with their variable name. @show does exactly this, except the output is not as pretty as when using display. Is there a way I can combine both of them and have somethin…

---

## [I got an unknown memory error when using Zygote](https://discourse.julialang.org/t/i-got-an-unknown-memory-error-when-using-zygote/84507)

<div class="topic-metadata">

**Author:** [@F-YF](https://discourse.julialang.org/u/F-YF)\
**Replies:** 0\
**Last updated:** [July 20, 2022, 5:51am UTC](https://discourse.julialang.org/t/i-got-an-unknown-memory-error-when-using-zygote/84507 "2022-07-20T05:51:09Z")

</div>

I don’t know how to describe the problem in my project, but I got the following two simple examples after a series of tests. First of all, the first test looks like this: #test1.jl using Integrals using SciMLSensitivit…

---

## [Failed to precompile DifferentialEquations and DiffEqFlux Julia 1.7.1](https://discourse.julialang.org/t/failed-to-precompile-differentialequations-and-diffeqflux-julia-1-7-1/82551)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 8\
**Last updated:** [July 20, 2022, 12:24pm UTC](https://discourse.julialang.org/t/failed-to-precompile-differentialequations-and-diffeqflux-julia-1-7-1/82551 "2022-07-20T12:24:40Z")

</div>

Hi, I just updated all packages \]up and out of a sudden precompilation failed which worked before. Precompiling failed after \]up julia\> import Pkg; Pkg.precompile() Precompiling project... ✗ OrdinaryDiffEq ✗ Trebuc…

---

## [Benchmarking all() vs for-loop](https://discourse.julialang.org/t/benchmarking-all-vs-for-loop/84483)

<div class="topic-metadata">

**Author:** [@RobertGregg](https://discourse.julialang.org/u/RobertGregg)\
**Replies:** 4\
**Last updated:** [July 20, 2022, 1:02am UTC](https://discourse.julialang.org/t/benchmarking-all-vs-for-loop/84483 "2022-07-20T01:02:00Z")

</div>

Is it possible to get the same performance from the all() function compared to the for-loop equivalent? v = rand(1:2,1\_000\_000) idx = findall(isequal(1),v) function f1(v,idx) @inbounds for i in idx if v\[i\] …

---

## [Parse types from string](https://discourse.julialang.org/t/parse-types-from-string/84518)

<div class="topic-metadata">

**Author:** [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Replies:** 2\
**Last updated:** [July 20, 2022, 11:12am UTC](https://discourse.julialang.org/t/parse-types-from-string/84518 "2022-07-20T11:12:03Z")

</div>

If I have a string of a function how can I parse the types from it? str = """ foo( bar::Bar, baz::AbstractVector{Baz}, var::Dict{Symbol,Var}=d, zar::Dict{Symbol,Zar} = k, rar::Dict{Symbol,Rar}, rar::Dict{S…

---

## [About StatsKit and Reexport](https://discourse.julialang.org/t/about-statskit-and-reexport/84519)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 1\
**Last updated:** [July 20, 2022, 10:00am UTC](https://discourse.julialang.org/t/about-statskit-and-reexport/84519 "2022-07-20T10:00:37Z")

</div>

I just want to know the example of using StatsKit for DataFrames… why would someone install StatsKit if they already have the packages like Distributions.jl or DataFrames.jl ? Why we need StatsKit with Reexport. A new…

---

## [Creating a function that does not import outer scope variables](https://discourse.julialang.org/t/creating-a-function-that-does-not-import-outer-scope-variables/84481)

<div class="topic-metadata">

**Author:** [@raphaelchinchilla](https://discourse.julialang.org/u/raphaelchinchilla)\
**Replies:** 7\
**Last updated:** [July 20, 2022, 9:52am UTC](https://discourse.julialang.org/t/creating-a-function-that-does-not-import-outer-scope-variables/84481 "2022-07-20T09:52:26Z")

</div>

Julia allows functions to see variables outside of their scope, something like y=2 function f(x) x+y end I agree this can often be useful, but for me this is generally a source of bugs. A typical error that I do is …

---

## [Question about String index?](https://discourse.julialang.org/t/question-about-string-index/84520)

<div class="topic-metadata">

**Author:** [@Raymond](https://discourse.julialang.org/u/Raymond)\
**Replies:** 3\
**Last updated:** [July 20, 2022, 9:32am UTC](https://discourse.julialang.org/t/question-about-string-index/84520 "2022-07-20T09:32:04Z")

</div>

Dear all, julia\> s = "abcdefg" "abcdefg" julia\> s\[end-4, end\] ERROR: MethodError: no method matching axes(::String, ::Int64) Closest candidates are: axes(::AbstractDataFrame, ::Integer) at ~/.julia/packages/DataFrame…

---

## [Unpacking from a collection](https://discourse.julialang.org/t/unpacking-from-a-collection/84276)

<div class="topic-metadata">

**Author:** [@uje](https://discourse.julialang.org/u/uje)\
**Replies:** 5\
**Last updated:** [July 20, 2022, 6:27am UTC](https://discourse.julialang.org/t/unpacking-from-a-collection/84276 "2022-07-20T06:27:56Z")

</div>

In python I could do this and the result will be as follows \>\>\> a, b, \*c, d = \[1, 2, 3, 4, 5, 6\] \>\>\>a 1 \>\>\>b 2 \>\>\>c \[3, 4, 5\] \>\>\>d 6 I know there’s unpacking in Julia and know how to use it. But the part where I can pa…

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

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