# General Usage

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

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

**Page:** 244

---

## [How not to concatenate in hvcat](https://discourse.julialang.org/t/how-not-to-concatenate-in-hvcat/104146)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 7\
**Last updated:** [September 29, 2023, 12:23pm UTC](https://discourse.julialang.org/t/how-not-to-concatenate-in-hvcat/104146 "2023-09-29T12:23:22Z")

</div>

Is there a way one can use the \[...; ...\] syntax which lowers to hvcat without concatenating the arguments? Ie as a plain vanilla matrix constructor. Eg julia\> \[\[1\] \[2\]; \[3\] \[4\]\] 2×2 Matrix{Int64}: 1 2 3 4 c…

---

## [How to save the plot object in file instead of a jpg figure?](https://discourse.julialang.org/t/how-to-save-the-plot-object-in-file-instead-of-a-jpg-figure/93130)

<div class="topic-metadata">

**Author:** [@tiZ](https://discourse.julialang.org/u/tiZ)\
**Replies:** 5\
**Last updated:** [September 29, 2023, 7:45am UTC](https://discourse.julialang.org/t/how-to-save-the-plot-object-in-file-instead-of-a-jpg-figure/93130 "2023-09-29T07:45:29Z")

</div>

Hi, I know that saving the code and data is the best way to reproduce scientific figures, but sometimes I also want to save the figure objects for future modify;like changing the colour scheme, adding text annotations o…

---

## [How to remove image scales() from GLMakie?](https://discourse.julialang.org/t/how-to-remove-image-scales-from-glmakie/104372)

<div class="topic-metadata">

**Author:** [@Luis\_Manuel\_Espinoza](https://discourse.julialang.org/u/Luis_Manuel_Espinoza)\
**Replies:** 1\
**Last updated:** [September 29, 2023, 3:10am UTC](https://discourse.julialang.org/t/how-to-remove-image-scales-from-glmakie/104372 "2023-09-29T03:10:17Z")

</div>

I have the following question, I am putting together some images with GLMakie but I do not have much experience with packaging, but I would like to remove the graduated sides around the images but I do not know how to do…

---

## [Unexpected behavior of loop over set](https://discourse.julialang.org/t/unexpected-behavior-of-loop-over-set/104371)

<div class="topic-metadata">

**Author:** [@Yly](https://discourse.julialang.org/u/Yly)\
**Replies:** 1\
**Last updated:** [September 29, 2023, 1:34am UTC](https://discourse.julialang.org/t/unexpected-behavior-of-loop-over-set/104371 "2023-09-29T01:34:09Z")

</div>

I have the following (minimized, but perhaps not minimal) code snippet which is intended to group nodes of graph components. The surprising thing is that it seems to imply that elements of a set are not in the set. ns …

---

## [MKLPardiso and Julia GC seg faults](https://discourse.julialang.org/t/mklpardiso-and-julia-gc-seg-faults/104368)

<div class="topic-metadata">

**Author:** [@jdlara-berkeley](https://discourse.julialang.org/u/jdlara-berkeley)\
**Replies:** 0\
**Last updated:** [September 28, 2023, 9:26pm UTC](https://discourse.julialang.org/t/mklpardiso-and-julia-gc-seg-faults/104368 "2023-09-28T21:26:45Z")

</div>

I have been using Pardiso.jl 0.5.4 to solve large linear systems of equations with many RHS (80k x 80k). From time to time depending on the size of the system and wether Julia calls GarbageCollect then it will create a s…

---

## [Use ProgressMeter to track an increasing real value?](https://discourse.julialang.org/t/use-progressmeter-to-track-an-increasing-real-value/104361)

<div class="topic-metadata">

**Author:** [@benninkrs](https://discourse.julialang.org/u/benninkrs)\
**Replies:** 2\
**Last updated:** [September 28, 2023, 8:32pm UTC](https://discourse.julialang.org/t/use-progressmeter-to-track-an-increasing-real-value/104361 "2023-09-28T20:32:28Z")

</div>

I have a calculation which takes an unknown number of steps to increase a real value x from 0.0 to some user-specified target value xmax \> 0.0. I want to use ProgressMeter to show the progress but none of progressmeter…

---

## [Julia command line evaluation with string in the expression](https://discourse.julialang.org/t/julia-command-line-evaluation-with-string-in-the-expression/104333)

<div class="topic-metadata">

**Author:** [@Shuhua](https://discourse.julialang.org/u/Shuhua)\
**Replies:** 8\
**Last updated:** [September 28, 2023, 6:55pm UTC](https://discourse.julialang.org/t/julia-command-line-evaluation-with-string-in-the-expression/104333 "2023-09-28T18:55:54Z")

</div>

I am using PowerShell on Windows. Did not figure out how I can include a string in the expression when evaluating it in the command line. Examples: PS F:\\WJ\\SmartPark\\CMS\\code\\COPT\_HTTP\> julia -e 'x = 123' PS F:\\WJ\\Sm…

---

## [Design pattern with enums with some overlapping elements?](https://discourse.julialang.org/t/design-pattern-with-enums-with-some-overlapping-elements/104363)

<div class="topic-metadata">

**Author:** [@myersm0](https://discourse.julialang.org/u/myersm0)\
**Replies:** 0\
**Last updated:** [September 28, 2023, 6:27pm UTC](https://discourse.julialang.org/t/design-pattern-with-enums-with-some-overlapping-elements/104363 "2023-09-28T18:27:33Z")

</div>

I would appreciate it if anyone has any advice on elegantly handling this design problem: I’m writing a package for visualization of some custom types with GLMakie for a specific domain. In the domain, there are several…

---

## [Multithreading increases memory allocations](https://discourse.julialang.org/t/multithreading-increases-memory-allocations/104355)

<div class="topic-metadata">

**Author:** [@Alberto\_Roman](https://discourse.julialang.org/u/Alberto_Roman)\
**Replies:** 3\
**Last updated:** [September 28, 2023, 5:56pm UTC](https://discourse.julialang.org/t/multithreading-increases-memory-allocations/104355 "2023-09-28T17:56:59Z")

</div>

Hi there, I am trying to understand why the number of memory allocations increases with multi threading. I have the following code computing the difference of a vector (it is basically the diff function) ‘’’ function…

---

## [Getting started with HPC and Julia](https://discourse.julialang.org/t/getting-started-with-hpc-and-julia/104213)

<div class="topic-metadata">

**Author:** [@kerim](https://discourse.julialang.org/u/kerim)\
**Replies:** 23\
**Last updated:** [September 28, 2023, 4:56pm UTC](https://discourse.julialang.org/t/getting-started-with-hpc-and-julia/104213 "2023-09-28T16:56:23Z")

</div>

Hi, I’ve built small cluster (master node and 4 other nodes) on the cloud and now I need to check whether Julia Distributed is able to use it. Setup: Julia dirpath: ~/julia - all the nodes have it Single shared folde…

---

## [I am seeing strange behavior in NLsolve package. Mutating function is not working](https://discourse.julialang.org/t/i-am-seeing-strange-behavior-in-nlsolve-package-mutating-function-is-not-working/104359)

<div class="topic-metadata">

**Author:** [@Shashank](https://discourse.julialang.org/u/Shashank)\
**Replies:** 2\
**Last updated:** [September 28, 2023, 4:45pm UTC](https://discourse.julialang.org/t/i-am-seeing-strange-behavior-in-nlsolve-package-mutating-function-is-not-working/104359 "2023-09-28T16:45:57Z")

</div>

I am trying to optimize a function that has several contributions. So I need to add several terms to it, but when I pass that function to nlsolve I am getting strange results. I have reproduced a minimal example that rep…

---

## [Why is sum slower than multiplying by vector of ones?](https://discourse.julialang.org/t/why-is-sum-slower-than-multiplying-by-vector-of-ones/104347)

<div class="topic-metadata">

**Author:** [@Jad\_Zeitouni](https://discourse.julialang.org/u/Jad_Zeitouni)\
**Replies:** 4\
**Last updated:** [September 28, 2023, 2:05pm UTC](https://discourse.julialang.org/t/why-is-sum-slower-than-multiplying-by-vector-of-ones/104347 "2023-09-28T14:05:04Z")

</div>

So when I try to sum a 10000 x 100 matrix x on its second dimension, using sum(x, dims=2), it takes about 200 microseconds. If I instead do x \* ones(100), this takes only 40 microseconds. What gives? Here’s the full cod…

---

## [Performance comparison, Julia is a slower than Mojo, am I doing something wrong?](https://discourse.julialang.org/t/performance-comparison-julia-is-a-slower-than-mojo-am-i-doing-something-wrong/103870)

<div class="topic-metadata">

**Author:** [@Brian1](https://discourse.julialang.org/u/Brian1)\
**Replies:** 44\
**Last updated:** [September 28, 2023, 1:10pm UTC](https://discourse.julialang.org/t/performance-comparison-julia-is-a-slower-than-mojo-am-i-doing-something-wrong/103870 "2023-09-28T13:10:00Z")

</div>

I am using fibonacci function to the compare the performance between Julia and Mojo. First Julia code: function fib(n::Int64)::Int64 n \<= 2 && return 1 n == 3 && return 2 fib(n - 1) + fib(n - 2) end @time …

---

## [Size-hinted array declarations](https://discourse.julialang.org/t/size-hinted-array-declarations/100935)

<div class="topic-metadata">

**Author:** [@jonniedie](https://discourse.julialang.org/u/jonniedie)\
**Replies:** 6\
**Last updated:** [September 28, 2023, 10:20am UTC](https://discourse.julialang.org/t/size-hinted-array-declarations/100935 "2023-09-28T10:20:49Z")

</div>

The common way of declaring size-hinted arrays for more efficient append!/push!/etc. seems to be x = SomeElementType\[\] sizehint!(x, expected\_size) But the sizehint! induces an extra allocation. Is there a way to avoid …

---

## [Constant changes when optimising ODE parameters](https://discourse.julialang.org/t/constant-changes-when-optimising-ode-parameters/104318)

<div class="topic-metadata">

**Author:** [@BogTak](https://discourse.julialang.org/u/BogTak)\
**Replies:** 2\
**Last updated:** [September 28, 2023, 9:48am UTC](https://discourse.julialang.org/t/constant-changes-when-optimising-ode-parameters/104318 "2023-09-28T09:48:01Z")

</div>

Hi! I’m trying to use Julia for optimizing parameters for an ODE system, but I’m running into the issue that the value C1 that should be constant is changed during the optimization. I currently have the following code (f…

---

## [Factorial(big(-1))==0, bug or expected behaviour?](https://discourse.julialang.org/t/factorial-big-1-0-bug-or-expected-behaviour/104298)

<div class="topic-metadata">

**Author:** [@mlanghinrichs](https://discourse.julialang.org/u/mlanghinrichs)\
**Replies:** 8\
**Last updated:** [September 28, 2023, 8:50am UTC](https://discourse.julialang.org/t/factorial-big-1-0-bug-or-expected-behaviour/104298 "2023-09-28T08:50:23Z")

</div>

I noticed the following behaviour on my system (julia 1.8): the factorial of negative integers x disagrees when x is Int or BigInt. Is this a bug or expected behaviour? I also compare to the gamma function below (from Sp…

---

## [StateSpaceModels.Forecast output are not callable/iterable](https://discourse.julialang.org/t/statespacemodels-forecast-output-are-not-callable-iterable/104314)

<div class="topic-metadata">

**Author:** [@ultratrader](https://discourse.julialang.org/u/ultratrader)\
**Replies:** 2\
**Last updated:** [September 28, 2023, 2:00am UTC](https://discourse.julialang.org/t/statespacemodels-forecast-output-are-not-callable-iterable/104314 "2023-09-28T02:00:27Z")

</div>

Hi all, I tried to extract the output of the forecast function in StateSpaceModels.jl after fitting using auto\_arima() and convert it to an array for further computation. I am using Julia 1.9.2 and StateSpaceModels.jl v…

---

## [Plotting the tangent line of a vector-valued function](https://discourse.julialang.org/t/plotting-the-tangent-line-of-a-vector-valued-function/104297)

<div class="topic-metadata">

**Author:** [@Alf](https://discourse.julialang.org/u/Alf)\
**Replies:** 2\
**Last updated:** [September 27, 2023, 10:10pm UTC](https://discourse.julialang.org/t/plotting-the-tangent-line-of-a-vector-valued-function/104297 "2023-09-27T22:10:51Z")

</div>

Hi! I want to plot the tangent line of the vector valued function \\mathbf{f}(t)=(\\cos(t),\\sin(t),t) at t=\\pi, but I get an error. I can’t not understad what I am doing wrong. using SymPy, Plots @syms t::real g(t) = \[cos…

---

## [Select point from graph, use button to store?](https://discourse.julialang.org/t/select-point-from-graph-use-button-to-store/104323)

<div class="topic-metadata">

**Author:** [@dkzwart](https://discourse.julialang.org/u/dkzwart)\
**Replies:** 1\
**Last updated:** [September 27, 2023, 6:35pm UTC](https://discourse.julialang.org/t/select-point-from-graph-use-button-to-store/104323 "2023-09-27T18:35:40Z")

</div>

I have a plot that I want to pick a point from. Once I select the correct point, I want to press a button to store it (using PostgreSQL). Currently, when I press the ‘save’ button, it selects a different point and stores…

---

## [Tip: macro to install/use package in temporary environment](https://discourse.julialang.org/t/tip-macro-to-install-use-package-in-temporary-environment/103190)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 26\
**Last updated:** [September 27, 2023, 3:02pm UTC](https://discourse.julialang.org/t/tip-macro-to-install-use-package-in-temporary-environment/103190 "2023-09-27T15:02:44Z")

</div>

I have been using this pattern, which loads a package from a temporary environment (to not add it to the current one): julia\> \] activate --temp (jl\_3FBlLK) pkg\> add Plots julia\> using Plots julia\> \] activate . julia\>…

---

## [Why does SampledSignals.jl store a 2-channel audio as a 2-column Matrix rather than a Vector?](https://discourse.julialang.org/t/why-does-sampledsignals-jl-store-a-2-channel-audio-as-a-2-column-matrix-rather-than-a-vector/104284)

<div class="topic-metadata">

**Author:** [@sadish-d](https://discourse.julialang.org/u/sadish-d)\
**Replies:** 8\
**Last updated:** [September 27, 2023, 1:21pm UTC](https://discourse.julialang.org/t/why-does-sampledsignals-jl-store-a-2-channel-audio-as-a-2-column-matrix-rather-than-a-vector/104284 "2023-09-27T13:21:29Z")

</div>

Since each sample from each channel is supposed to be read/played together, I would think that it makes sense to put samples for one channel in the odd indices of a vector, and samples from the other channel in the even …

---

## [How to achieve numerical reproducibility across platforms for scientific replication package](https://discourse.julialang.org/t/how-to-achieve-numerical-reproducibility-across-platforms-for-scientific-replication-package/104201)

<div class="topic-metadata">

**Author:** [@Gabriel\_Kreindler](https://discourse.julialang.org/u/Gabriel_Kreindler)\
**Replies:** 19\
**Last updated:** [September 27, 2023, 11:20am UTC](https://discourse.julialang.org/t/how-to-achieve-numerical-reproducibility-across-platforms-for-scientific-replication-package/104201 "2023-09-27T11:20:54Z")

</div>

I am preparing the replication package for an academic publication, and I am running into issues that my code gives different results on my local Windows 11 machine and Unix university servers. I am using the same versio…

---

## [Precedence of local and julia-shipped shared libraries](https://discourse.julialang.org/t/precedence-of-local-and-julia-shipped-shared-libraries/104258)

<div class="topic-metadata">

**Author:** [@Benedict](https://discourse.julialang.org/u/Benedict)\
**Replies:** 13\
**Last updated:** [September 27, 2023, 10:40am UTC](https://discourse.julialang.org/t/precedence-of-local-and-julia-shipped-shared-libraries/104258 "2023-09-27T10:40:44Z")

</div>

I am working together with @sloede on libtrixi, a C/Fortran-interface library to the flow solver Trixi.jl. @sloede managed to create a standalone library using PackageCompiler.jl, see How do libraries compiled by Package…

---

## [Docstring for hcat(DataFrame...) varargs returns the default Base.hcat docs](https://discourse.julialang.org/t/docstring-for-hcat-dataframe-varargs-returns-the-default-base-hcat-docs/104300)

<div class="topic-metadata">

**Author:** [@filchristou](https://discourse.julialang.org/u/filchristou)\
**Replies:** 3\
**Last updated:** [September 27, 2023, 10:09am UTC](https://discourse.julialang.org/t/docstring-for-hcat-dataframe-varargs-returns-the-default-base-hcat-docs/104300 "2023-09-27T10:09:04Z")

</div>

Probably, this is not something specific to DataFrames.jl but a general situation. Normally the following code julia\> using DataFrames; julia\> df1 = DataFrame(a=\[1,2,3,4,5\], b=\[10,20,30,40,50\]); julia\> df2 = DataFram…

---

## [Vector with negative indices extending getindex](https://discourse.julialang.org/t/vector-with-negative-indices-extending-getindex/104286)

<div class="topic-metadata">

**Author:** [@gvdr](https://discourse.julialang.org/u/gvdr)\
**Replies:** 4\
**Last updated:** [September 27, 2023, 12:19am UTC](https://discourse.julialang.org/t/vector-with-negative-indices-extending-getindex/104286 "2023-09-27T00:19:00Z")

</div>

Hello. I’m trying to extend the method(s) for get index so to have the ability of accessing a numeric vector, Vector{T} where T\<:Number, at a negative (or zero) index and get zero(T). The intended behaviour is something…

---

## [Package/workflow for combining BenchmarkTools.jl and HyphothesisTests.jl](https://discourse.julialang.org/t/package-workflow-for-combining-benchmarktools-jl-and-hyphothesistests-jl/104252)

<div class="topic-metadata">

**Author:** [@oxinabox](https://discourse.julialang.org/u/oxinabox)\
**Replies:** 6\
**Last updated:** [September 26, 2023, 10:26pm UTC](https://discourse.julialang.org/t/package-workflow-for-combining-benchmarktools-jl-and-hyphothesistests-jl/104252 "2023-09-26T22:26:03Z")

</div>

It seems to me that we should have the technology to determine if a change in the performance of a function is statistically significant, possibly with some user specified assumptions. Has anyone made a workflow or litt…

---

## [Why do hitting Ctrl+Enter or cutting and pasting code in the REPL yield different results?](https://discourse.julialang.org/t/why-do-hitting-ctrl-enter-or-cutting-and-pasting-code-in-the-repl-yield-different-results/104272)

<div class="topic-metadata">

**Author:** [@Soldalma](https://discourse.julialang.org/u/Soldalma)\
**Replies:** 3\
**Last updated:** [September 26, 2023, 9:00pm UTC](https://discourse.julialang.org/t/why-do-hitting-ctrl-enter-or-cutting-and-pasting-code-in-the-repl-yield-different-results/104272 "2023-09-26T21:00:19Z")

</div>

I have some code that I am working on in VSCode, where at some point I try to include a file with this line: include("./src/ModelData.jl") Then I get an error message: ERROR: SystemError: opening file "c:\\\\Users\\\\fsal…

---

## [Julia on Lego ev3dev?](https://discourse.julialang.org/t/julia-on-lego-ev3dev/104280)

<div class="topic-metadata">

**Author:** [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Replies:** 2\
**Last updated:** [September 26, 2023, 8:29pm UTC](https://discourse.julialang.org/t/julia-on-lego-ev3dev/104280 "2023-09-26T20:29:34Z")

</div>

Has anyone got any experience trying to use Julia on ARM on the Lego Mindstorms EV3 computers? My son’s school is using those in a robotics class and using RobotC for programming, but I’m wondering if a more interactive …

---

## [Least squares in julia](https://discourse.julialang.org/t/least-squares-in-julia/104279)

<div class="topic-metadata">

**Author:** [@jcbritobr](https://discourse.julialang.org/u/jcbritobr)\
**Replies:** 7\
**Last updated:** [September 26, 2023, 7:22pm UTC](https://discourse.julialang.org/t/least-squares-in-julia/104279 "2023-09-26T19:22:23Z")

</div>

Hello, good afternoon, I’m facing issues to solve least squares in julia using qr decomposition. numcourses = \[13,4,12,3,14,13,12,9,11,7,13,11,9,2,5,7,10,0,9,7\] happiness = \[70,25,54,21,80,68,84,62,57,40,60,64,45,38,5…

---

## [Help removing allocations for "enrichment score" function](https://discourse.julialang.org/t/help-removing-allocations-for-enrichment-score-function/104273)

<div class="topic-metadata">

**Author:** [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Replies:** 1\
**Last updated:** [September 26, 2023, 6:57pm UTC](https://discourse.julialang.org/t/help-removing-allocations-for-enrichment-score-function/104273 "2023-09-26T18:57:12Z")

</div>

I have a function that calculates an “enrichment score” for a set of values - basically, the skew of in-set vs out-of-set values. A naive implementation (it’s sort of a literal transcription of the method) looks like thi…

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

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