# General Usage

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

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

**Page:** 345

---

## [Operational calculus in julia?](https://discourse.julialang.org/t/operational-calculus-in-julia/24415)

<div class="topic-metadata">

**Author:** [@xtalax](https://discourse.julialang.org/u/xtalax)\
**Replies:** 4\
**Last updated:** [January 12, 2023, 4:00pm UTC](https://discourse.julialang.org/t/operational-calculus-in-julia/24415 "2023-01-12T16:00:02Z")

</div>

If it were possible to give functions types in Julia, it would ease the implementation of operational calculus in the language. I’m thinking about ways to implement differential operators in julia, so that it would be p…

---

## [Performance measurement of floating number division vs multiplication](https://discourse.julialang.org/t/performance-measurement-of-floating-number-division-vs-multiplication/92874)

<div class="topic-metadata">

**Author:** [@linwaytin](https://discourse.julialang.org/u/linwaytin)\
**Replies:** 3\
**Last updated:** [January 12, 2023, 3:30pm UTC](https://discourse.julialang.org/t/performance-measurement-of-floating-number-division-vs-multiplication/92874 "2023-01-12T15:30:55Z")

</div>

I want to know how expensive the floating number division is, compared to the multiplication. Using BenchmarkTools, I found they are the same. julia\> @benchmark $(Ref(a))\[\] \* $(Ref(b))\[\] BenchmarkTools.Trial: 10000 samp…

---

## [Writing my own callbacks](https://discourse.julialang.org/t/writing-my-own-callbacks/92871)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 5\
**Last updated:** [January 12, 2023, 3:22pm UTC](https://discourse.julialang.org/t/writing-my-own-callbacks/92871 "2023-01-12T15:22:24Z")

</div>

I thought I finally understood the various subtleties of scope and closure in Julia, but obviously not! Here is a self-contained MWE that demonstrates a callback that does not work and I do not know how to fix: iter = 8…

---

## [Very long time to compile system image with v1.9beta2](https://discourse.julialang.org/t/very-long-time-to-compile-system-image-with-v1-9beta2/92870)

<div class="topic-metadata">

**Author:** [@mcreel](https://discourse.julialang.org/u/mcreel)\
**Replies:** 5\
**Last updated:** [January 12, 2023, 3:12pm UTC](https://discourse.julialang.org/t/very-long-time-to-compile-system-image-with-v1-9beta2/92870 "2023-01-12T15:12:15Z")

</div>

Using julia v1.9beta2, I have tried to compile a system image for a project with many dependencies. This takes around 10-12 minutes with v1.8.x. With 1.9b2, I interrupted it at the 2 hour point. Perhaps I should clear ou…

---

## [Is it possible to get coefficients from interpolation function?](https://discourse.julialang.org/t/is-it-possible-to-get-coefficients-from-interpolation-function/92862)

<div class="topic-metadata">

**Author:** [@Tatiana\_P](https://discourse.julialang.org/u/Tatiana_P)\
**Replies:** 3\
**Last updated:** [January 12, 2023, 2:46pm UTC](https://discourse.julialang.org/t/is-it-possible-to-get-coefficients-from-interpolation-function/92862 "2023-01-12T14:46:40Z")

</div>

I use method ‘interpolate’ from Interpolation.jl library with interpmode=FritschCarlsonMonotonicInterpolation, for example, y\_spline = interpolate(x, y\_initial\_curve.(x), FritschCarlsonMonotonicInterpolation()) How to …

---

## [ForwardDiff.derivative pointwise](https://discourse.julialang.org/t/forwarddiff-derivative-pointwise/92867)

<div class="topic-metadata">

**Author:** [@c\_sell](https://discourse.julialang.org/u/c_sell)\
**Replies:** 2\
**Last updated:** [January 12, 2023, 1:15pm UTC](https://discourse.julialang.org/t/forwarddiff-derivative-pointwise/92867 "2023-01-12T13:15:48Z")

</div>

Hello, is it possible to use ForwardDiff in the following way. I have a function (a forward diff through a neural network). I want to take the second derivative of the output with respect to the input. If I use n input…

---

## [How do I initialize an empty array / vector of strings, and then push strings into](https://discourse.julialang.org/t/how-do-i-initialize-an-empty-array-vector-of-strings-and-then-push-strings-into/56980)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [March 11, 2021, 11:32pm UTC](https://discourse.julialang.org/t/how-do-i-initialize-an-empty-array-vector-of-strings-and-then-push-strings-into/56980 "2021-03-11T23:32:43Z")

</div>

How do I initialize an empty array / vector of strings, and then push strings into it? When I do t = Vector{String} , I get this error when I then push into it: push!(t, "a") ERROR: MethodError: no method matching push!…

---

## [Symbolics.jl, ModelingToolkit.jl, DifferentialEquations.jl and the Lagrangian approach](https://discourse.julialang.org/t/symbolics-jl-modelingtoolkit-jl-differentialequations-jl-and-the-lagrangian-approach/89629)

<div class="topic-metadata">

**Author:** [@Sh\_166](https://discourse.julialang.org/u/Sh_166)\
**Replies:** 6\
**Last updated:** [January 12, 2023, 10:36am UTC](https://discourse.julialang.org/t/symbolics-jl-modelingtoolkit-jl-differentialequations-jl-and-the-lagrangian-approach/89629 "2023-01-12T10:36:57Z")

</div>

So, as I mentioned in this topic, I was trying to implement the Lagrangian approach from scratch in Julia, and inquired for existing ways to do that. As the comments on that discussion point out, nothing of the sort exis…

---

## [How can I use \`get\` with a subtype of a Dict key?](https://discourse.julialang.org/t/how-can-i-use-get-with-a-subtype-of-a-dict-key/92857)

<div class="topic-metadata">

**Author:** [@gleyland](https://discourse.julialang.org/u/gleyland)\
**Replies:** 4\
**Last updated:** [January 12, 2023, 9:48am UTC](https://discourse.julialang.org/t/how-can-i-use-get-with-a-subtype-of-a-dict-key/92857 "2023-01-12T09:48:12Z")

</div>

I would like to define a Dict{A, Bool} and then put entries with keys of type B (a subtype of A) into it. Adding B entries to the Dict works, as does indexing the Dict with \[\], but get doesn’t seem to work: julia\> VERS…

---

## [How to solve these equations?](https://discourse.julialang.org/t/how-to-solve-these-equations/92788)

<div class="topic-metadata">

**Author:** [@Raymond](https://discourse.julialang.org/u/Raymond)\
**Replies:** 33\
**Last updated:** [January 12, 2023, 7:37am UTC](https://discourse.julialang.org/t/how-to-solve-these-equations/92788 "2023-01-12T07:37:53Z")

</div>

using SymPy @syms x y z e₁ e₂ c₁ c₂ c₃ c₅ s₁ s₂ s₃ g₁ g₂ fx = x\*(x - 1)\*(c₁ + c₂\*y\*z - c₂\*y - c₂\*z - e₁ - e₂\*y\*z + e₂\*y + e₂\*z - g₁\*y - g₂\*z - s₁\*y) fy = y\*(y - 1)\*(c₃ + g₁\*x - g₁ + s₁\*x) fz = -z\*(z - 1)\*(-c₅ + s₂ + s…

---

## [Maintain backwards compatibility when using \`const\` on a mutable struct field](https://discourse.julialang.org/t/maintain-backwards-compatibility-when-using-const-on-a-mutable-struct-field/85965)

<div class="topic-metadata">

**Author:** [@maxkapur](https://discourse.julialang.org/u/maxkapur)\
**Replies:** 12\
**Last updated:** [January 12, 2023, 5:43am UTC](https://discourse.julialang.org/t/maintain-backwards-compatibility-when-using-const-on-a-mutable-struct-field/85965 "2023-01-12T05:43:42Z")

</div>

I searched, and it doesn’t look like anyone has asked this before, but I would be surprised if I am the first, so I apologize if this question is a dupe and I missed it. In the newly released Julia v1.8.0, you can annot…

---

## [Reading sockets asynchronously](https://discourse.julialang.org/t/reading-sockets-asynchronously/92096)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 6\
**Last updated:** [January 12, 2023, 5:05am UTC](https://discourse.julialang.org/t/reading-sockets-asynchronously/92096 "2023-01-12T05:05:24Z")

</div>

I’m using readavailable() within a loop to read messages from a tcp socket as they come in. Is there a version that doesn’t require a loop ? i.e. something that will call a function asynchronously with the incoming mes…

---

## [Surprising type widening when constructing Tuple{...}](https://discourse.julialang.org/t/surprising-type-widening-when-constructing-tuple/92840)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 2\
**Last updated:** [January 12, 2023, 3:18am UTC](https://discourse.julialang.org/t/surprising-type-widening-when-constructing-tuple/92840 "2023-01-12T03:18:58Z")

</div>

Dear Julia type inference masters, I am facing some inference/performance problems which look like they could be circumvented, but I don’t know enough about what is going on here. struct ValType{T, V} end ValTypeof(v::…

---

## [Much worse import time for \`Statistics\` and \`SparseArrays\` on julia 1.9.0 nightly?](https://discourse.julialang.org/t/much-worse-import-time-for-statistics-and-sparsearrays-on-julia-1-9-0-nightly/83679)

<div class="topic-metadata">

**Author:** [@Krastanov](https://discourse.julialang.org/u/Krastanov)\
**Replies:** 3\
**Last updated:** [January 12, 2023, 12:43am UTC](https://discourse.julialang.org/t/much-worse-import-time-for-statistics-and-sparsearrays-on-julia-1-9-0-nightly/83679 "2023-01-12T00:43:30Z")

</div>

I am confused by this. Why would Statistics (or its dependency SparseArrays), a package in the standard library, have such a bad time to import? Anything I can do about this in my package that depends on Statistics? I ha…

---

## [In which shell Julia is running?](https://discourse.julialang.org/t/in-which-shell-julia-is-running/92814)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 8\
**Last updated:** [January 11, 2023, 8:10pm UTC](https://discourse.julialang.org/t/in-which-shell-julia-is-running/92814 "2023-01-11T20:10:03Z")

</div>

I have Julia code that executes external commands with parameters. The parameters are file or folder names. I thought if I check if the code is executed on Windows and use a backslash as path delimiter on Windows and a s…

---

## [Arbitrary Precision Optimization](https://discourse.julialang.org/t/arbitrary-precision-optimization/92803)

<div class="topic-metadata">

**Author:** [@csmarra](https://discourse.julialang.org/u/csmarra)\
**Replies:** 2\
**Last updated:** [January 11, 2023, 7:21pm UTC](https://discourse.julialang.org/t/arbitrary-precision-optimization/92803 "2023-01-11T19:21:19Z")

</div>

Hi, I am trying to perform a function minimization with BigFloat numbers. However, it seems that I cannot get it to work. I am using the BlackBoxOptim.jl package. Is there a way to do that? As an example, I tried to do…

---

## [Automatic Differentiation with ReservoirComputing.jl Echo State Networks](https://discourse.julialang.org/t/automatic-differentiation-with-reservoircomputing-jl-echo-state-networks/92818)

<div class="topic-metadata">

**Author:** [@jClugstor](https://discourse.julialang.org/u/jClugstor)\
**Replies:** 0\
**Last updated:** [January 11, 2023, 6:28pm UTC](https://discourse.julialang.org/t/automatic-differentiation-with-reservoircomputing-jl-echo-state-networks/92818 "2023-01-11T18:28:03Z")

</div>

I’m trying to use auto diff to find the jacobian of an echo state network from ReservoirComputing.jl. So far, I just would like to get the jacobian from the Lorenz forecast tutorial along the trajectory working. #loren…

---

## [Can not add Pkgs tag: buildbot ; worker ; workdir](https://discourse.julialang.org/t/can-not-add-pkgs-tag-buildbot-worker-workdir/92633)

<div class="topic-metadata">

**Author:** [@ajsagit](https://discourse.julialang.org/u/ajsagit)\
**Replies:** 2\
**Last updated:** [January 11, 2023, 4:04pm UTC](https://discourse.julialang.org/t/can-not-add-pkgs-tag-buildbot-worker-workdir/92633 "2023-01-11T16:04:58Z")

</div>

Alway works fine but recently when \] and up or add CSV / other add \[pkgs\] returns errs and the process of Julia.exe crashed. Windows 10 x64, Windows11 x64 Julia 1.7~1.84 TIA.

---

## [Delete a specific row and Colum in matrix](https://discourse.julialang.org/t/delete-a-specific-row-and-colum-in-matrix/92754)

<div class="topic-metadata">

**Author:** [@ahmad88](https://discourse.julialang.org/u/ahmad88)\
**Replies:** 13\
**Last updated:** [January 11, 2023, 12:54pm UTC](https://discourse.julialang.org/t/delete-a-specific-row-and-colum-in-matrix/92754 "2023-01-11T12:54:21Z")

</div>

I have a matrix of size nn and I have a list containing specific nodes in the graph in each iteration I have to remove the specific row and corresponding column based on the value in the list, how do I can know the speci…

---

## [Unitful: parsing currencies](https://discourse.julialang.org/t/unitful-parsing-currencies/84705)

<div class="topic-metadata">

**Author:** [@stepanzh](https://discourse.julialang.org/u/stepanzh)\
**Replies:** 5\
**Last updated:** [January 11, 2023, 10:54am UTC](https://discourse.julialang.org/t/unitful-parsing-currencies/84705 "2023-01-11T10:54:42Z")

</div>

I have a table with cash operations. String representation of an operation contains a value and a currency name, e.g. 1.5 US$ or 1.5 RUB. I’ve decided to use Unitful.jl: Defining new units for keeping different currencie…

---

## [Capture \`DataType\` in closure](https://discourse.julialang.org/t/capture-datatype-in-closure/92752)

<div class="topic-metadata">

**Author:** [@hexaeder](https://discourse.julialang.org/u/hexaeder)\
**Replies:** 7\
**Last updated:** [January 11, 2023, 9:41am UTC](https://discourse.julialang.org/t/capture-datatype-in-closure/92752 "2023-01-11T09:41:04Z")

</div>

Why is it apparently not possible to capture a DataType inside a closure in a typestable manner? Consider function create\_closure1(data) bufT = eltype(data) (i) -\> begin buf = Vector{bufT}(undef,1) …

---

## [Source for the 5-character hash in $HOME/.julia/packages/\<pkgname\>/](https://discourse.julialang.org/t/source-for-the-5-character-hash-in-home-julia-packages-pkgname/92793)

<div class="topic-metadata">

**Author:** [@harris-chris](https://discourse.julialang.org/u/harris-chris)\
**Replies:** 2\
**Last updated:** [January 11, 2023, 8:08am UTC](https://discourse.julialang.org/t/source-for-the-5-character-hash-in-home-julia-packages-pkgname/92793 "2023-01-11T08:08:05Z")

</div>

Hello all, I notice that each package in my $HOME/.julia/packages/\<pkgname\>/ folder has what looks like a 5-character hash code - for example, $HOME/.julia/packages/HTTP/aTjcj. Can anyone tell me how this hash is derive…

---

## [What is ? mark in Julia?](https://discourse.julialang.org/t/what-is-mark-in-julia/92776)

<div class="topic-metadata">

**Author:** [@Kianoush\_Ramezani\_sh](https://discourse.julialang.org/u/Kianoush_Ramezani_sh)\
**Replies:** 4\
**Last updated:** [January 11, 2023, 6:42am UTC](https://discourse.julialang.org/t/what-is-mark-in-julia/92776 "2023-01-11T06:42:48Z")

</div>

e.g. what does it do here: pow2(x, n) = n \<= 0 ? 1 : x\*pow2(x, n-1) or here minmax(xx, y) = (y \< xx) ? (y, xx) : (xx, y)

---

## [Implementing broadcasting for a nested \`Vector\` with a scalar](https://discourse.julialang.org/t/implementing-broadcasting-for-a-nested-vector-with-a-scalar/92760)

<div class="topic-metadata">

**Author:** [@loonatick-src](https://discourse.julialang.org/u/loonatick-src)\
**Replies:** 7\
**Last updated:** [January 11, 2023, 6:36am UTC](https://discourse.julialang.org/t/implementing-broadcasting-for-a-nested-vector-with-a-scalar/92760 "2023-01-11T06:36:50Z")

</div>

Say I have a struct one of whose members has the type RaggedVector{T} = Vector{Vector{T}} And if we construct two conformal instances of this type xs = \[\[1, 2, 3\], \[4\], \[5, 6\]\] ys = \[\[6, 5, 4\], \[3\], …

---

## [How to set data which are in the same group has the same palette color in \`RecipesBase.jl\`?](https://discourse.julialang.org/t/how-to-set-data-which-are-in-the-same-group-has-the-same-palette-color-in-recipesbase-jl/92785)

<div class="topic-metadata">

**Author:** [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Replies:** 0\
**Last updated:** [January 11, 2023, 2:07am UTC](https://discourse.julialang.org/t/how-to-set-data-which-are-in-the-same-group-has-the-same-palette-color-in-recipesbase-jl/92785 "2023-01-11T02:07:58Z")

</div>

It is similar to the following question: How to set colours for groups of elements on a plot - New to Julia - Julia Programming Language For example, I have two groups of data: one is labeled as “22” and one is labeled…

---

## [Loo cv to Bayesian Estimation of Differential Equations (challenge)](https://discourse.julialang.org/t/loo-cv-to-bayesian-estimation-of-differential-equations-challenge/92773)

<div class="topic-metadata">

**Author:** [@RMF](https://discourse.julialang.org/u/RMF)\
**Replies:** 11\
**Last updated:** [January 11, 2023, 2:06am UTC](https://discourse.julialang.org/t/loo-cv-to-bayesian-estimation-of-differential-equations-challenge/92773 "2023-01-11T02:06:41Z")

</div>

Loo cv to Bayesian Estimation of Differential Equations (challenge) applying cross validation with paretoSmooth.jl loo(model,chain)to models written in turing.jl works great, except for estimation in ODE(Bayesian Estima…

---

## [Raw files in PowerModels](https://discourse.julialang.org/t/raw-files-in-powermodels/60479)

<div class="topic-metadata">

**Author:** [@Mariana](https://discourse.julialang.org/u/Mariana)\
**Replies:** 1\
**Last updated:** [January 10, 2023, 11:36pm UTC](https://discourse.julialang.org/t/raw-files-in-powermodels/60479 "2023-01-10T23:36:55Z")

</div>

Hello! I am starting to use PowerModels and I’d like to run power flow calculations using input raw files. However, the raw files I have as an example are written in version 32, and PowerModels requires version 33 of PT…

---

## [In multithreading, how to make each thread pick the first/smallest available element?](https://discourse.julialang.org/t/in-multithreading-how-to-make-each-thread-pick-the-first-smallest-available-element/92678)

<div class="topic-metadata">

**Author:** [@Leo\_I](https://discourse.julialang.org/u/Leo_I)\
**Replies:** 13\
**Last updated:** [January 10, 2023, 10:07pm UTC](https://discourse.julialang.org/t/in-multithreading-how-to-make-each-thread-pick-the-first-smallest-available-element/92678 "2023-01-10T22:07:56Z")

</div>

I start julia in Linux terminal with julia -t 6. The code Threads.@threads for i=1:100 println(i," ",Threads.threadid()); sleep(3); end on my 6-core CPU returns 18 2 52 1 35 4 69 6 85 3 1 5 70 6 53 1…

---

## [Is there something so I can play a noise when Julia finished running? Like I have](https://discourse.julialang.org/t/is-there-something-so-i-can-play-a-noise-when-julia-finished-running-like-i-have/55107)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 5\
**Last updated:** [January 10, 2023, 8:52pm UTC](https://discourse.julialang.org/t/is-there-something-so-i-can-play-a-noise-when-julia-finished-running-like-i-have/55107 "2023-01-10T20:52:45Z")

</div>

is there something so I can play a noise when Julia finished running? Like I have a function function foo(beta) beta\[1\].^2.0 - beta\[2\].^0.5 #Function that pops off a sound noise() #Does this exist? end and…

---

## [Map! using row iteration for output](https://discourse.julialang.org/t/map-using-row-iteration-for-output/92768)

<div class="topic-metadata">

**Author:** [@prittjam](https://discourse.julialang.org/u/prittjam)\
**Replies:** 0\
**Last updated:** [January 10, 2023, 7:13pm UTC](https://discourse.julialang.org/t/map-using-row-iteration-for-output/92768 "2023-01-10T19:13:18Z")

</div>

why is this not possible? Given typeof((u₁,u₂)) Tuple{Vector{SVector{3, Float64}}, Vector{SVector{3, Float64}}} and typeof(M) MMatrix{8, 9, Float64, 72} (alias for MArray{Tuple{8, 9}, Float64, 2, 72}) I want to fill…

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

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