# General Usage

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

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

**Page:** 174

---

## [Mutating values in immutable struct (specifically of type ODESolution)](https://discourse.julialang.org/t/mutating-values-in-immutable-struct-specifically-of-type-odesolution/113760)

<div class="topic-metadata">

**Author:** [@hatmatrix](https://discourse.julialang.org/u/hatmatrix)\
**Replies:** 4\
**Last updated:** [May 3, 2024, 2:49am UTC](https://discourse.julialang.org/t/mutating-values-in-immutable-struct-specifically-of-type-odesolution/113760 "2024-05-03T02:49:31Z")

</div>

I’m solving a differential equation that has been nondimensionalized, so I’d like to change the scaling of the dependent variable for plotting. Here is my example. using DifferentialEquations using Plots using Accessors…

---

## [SQUAREM fixed point acceleration](https://discourse.julialang.org/t/squarem-fixed-point-acceleration/113761)

<div class="topic-metadata">

**Author:** [@leima0521](https://discourse.julialang.org/u/leima0521)\
**Replies:** 1\
**Last updated:** [May 3, 2024, 1:18am UTC](https://discourse.julialang.org/t/squarem-fixed-point-acceleration/113761 "2024-05-03T01:18:17Z")

</div>

Hello, Is there a package that implements SQUAREM in fixed point iteration? Thanks!

---

## [Faster way to find all bit arrays of weight n](https://discourse.julialang.org/t/faster-way-to-find-all-bit-arrays-of-weight-n/113658)

<div class="topic-metadata">

**Author:** [@AwesomeQuest](https://discourse.julialang.org/u/AwesomeQuest)\
**Replies:** 14\
**Last updated:** [May 2, 2024, 11:46pm UTC](https://discourse.julialang.org/t/faster-way-to-find-all-bit-arrays-of-weight-n/113658 "2024-05-02T23:46:04Z")

</div>

The obvious way to generate these bit arrays is something like: function findbcn2s(b,n) bitstrs = digits.(2^n-1:2^b-1, base=2, pad=b) .|\> BitVector filter(x-\>sum(x)==n, bitstrs) end I feel like this is horribly…

---

## [PrecompileTools put workload stuff data in image cache](https://discourse.julialang.org/t/precompiletools-put-workload-stuff-data-in-image-cache/113751)

<div class="topic-metadata">

**Author:** [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Replies:** 2\
**Last updated:** [May 2, 2024, 11:36pm UTC](https://discourse.julialang.org/t/precompiletools-put-workload-stuff-data-in-image-cache/113751 "2024-05-02T23:36:42Z")

</div>

During a VSC debug session, while seeking for a mysterious global variable origin, I found that variables used in the @setup\_workload begin of the PrecompileTools precompilation are present in compiled cache and visible …

---

## [How to test package with different sets of test dependencies](https://discourse.julialang.org/t/how-to-test-package-with-different-sets-of-test-dependencies/113478)

<div class="topic-metadata">

**Author:** [@marius311](https://discourse.julialang.org/u/marius311)\
**Replies:** 3\
**Last updated:** [May 2, 2024, 11:22pm UTC](https://discourse.julialang.org/t/how-to-test-package-with-different-sets-of-test-dependencies/113478 "2024-05-02T23:22:23Z")

</div>

Suppose for various reasons I want to test a package with two different test/Project.toml’s. These will have different packages / compat bounds and my single runtests.jl is conditional on which dependencies are loaded. I…

---

## [Prevent the REPL from changing the terminal title](https://discourse.julialang.org/t/prevent-the-repl-from-changing-the-terminal-title/113729)

<div class="topic-metadata">

**Author:** [@cbrnr](https://discourse.julialang.org/u/cbrnr)\
**Replies:** 4\
**Last updated:** [May 2, 2024, 5:19pm UTC](https://discourse.julialang.org/t/prevent-the-repl-from-changing-the-terminal-title/113729 "2024-05-02T17:19:08Z")

</div>

I just noticed that the Julia REPL is changing the terminal title to “Julia”. Is there any way to prevent it from doing that? I’d rather keep my custom terminal window titles…

---

## [\`using Plots\` errors (\`ERROR: LoadError: InitError: UndefVarError: \`GR\_jll\` not defined\`)](https://discourse.julialang.org/t/using-plots-errors-error-loaderror-initerror-undefvarerror-gr-jll-not-defined/113742)

<div class="topic-metadata">

**Author:** [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Replies:** 4\
**Last updated:** [May 2, 2024, 3:43pm UTC](https://discourse.julialang.org/t/using-plots-errors-error-loaderror-initerror-undefvarerror-gr-jll-not-defined/113742 "2024-05-02T15:43:16Z")

</div>

Yesterday I was helping a friend instal Julia. It was a mac computer, and we installed Julia from scratch using juliaup. We added a like 4 packages, including Plots. When we tried using Plots we got an error (see end). …

---

## [Neural ODEs: Fitting a cosine curve](https://discourse.julialang.org/t/neural-odes-fitting-a-cosine-curve/113702)

<div class="topic-metadata">

**Author:** [@bhaveshshrimali](https://discourse.julialang.org/u/bhaveshshrimali)\
**Replies:** 4\
**Last updated:** [May 2, 2024, 3:39pm UTC](https://discourse.julialang.org/t/neural-odes-fitting-a-cosine-curve/113702 "2024-05-02T15:39:51Z")

</div>

Hi everyone, I am trying to experiment with NeuralODEs and wanted to fit a simple cosine curve as an implementation exercise. I have tried experimenting the same with the solvers in torchdiffeq and diffrax but both seem…

---

## [Get external links to work both in REPL and Documenter.jl](https://discourse.julialang.org/t/get-external-links-to-work-both-in-repl-and-documenter-jl/113737)

<div class="topic-metadata">

**Author:** [@araujoms](https://discourse.julialang.org/u/araujoms)\
**Replies:** 0\
**Last updated:** [May 2, 2024, 1:22pm UTC](https://discourse.julialang.org/t/get-external-links-to-work-both-in-repl-and-documenter-jl/113737 "2024-05-02T13:22:50Z")

</div>

I can’t get a decent formatting for external links that work in both at the same time. If I put the bare URL in the docstring, like """ foo(x) Reference: https://arxiv.org/abs/1902.04751 """ I get a clickable link…

---

## [GR\_jll not compiling in Julia 1.10.3](https://discourse.julialang.org/t/gr-jll-not-compiling-in-julia-1-10-3/113693)

<div class="topic-metadata">

**Author:** [@scheinerman](https://discourse.julialang.org/u/scheinerman)\
**Replies:** 21\
**Last updated:** [May 2, 2024, 11:37am UTC](https://discourse.julialang.org/t/gr-jll-not-compiling-in-julia-1-10-3/113693 "2024-05-02T11:37:47Z")

</div>

I just installed Julia 1.10.3 and GR\_jll is not compiling, so I can’t use Plots. The error message I get is this: ERROR: LoadError: InitError: could not load library "/home/WIN/eschein1/.julia/artifacts/e18a60e84fd8ae…

---

## [Missing \`top-level scope\` when \`eval\`ing](https://discourse.julialang.org/t/missing-top-level-scope-when-eval-ing/113728)

<div class="topic-metadata">

**Author:** [@jules](https://discourse.julialang.org/u/jules)\
**Replies:** 0\
**Last updated:** [May 2, 2024, 10:32am UTC](https://discourse.julialang.org/t/missing-top-level-scope-when-eval-ing/113728 "2024-05-02T10:32:27Z")

</div>

This is on Julia 1.10, note that between frame 6 and 7 of the using Plots stacktrace, there’s no top-level scope. But between the corresponding frames 1 and 3 in the second example, there is one. Both evaled Exprs are co…

---

## [Rust-like source-file tests](https://discourse.julialang.org/t/rust-like-source-file-tests/113706)

<div class="topic-metadata">

**Author:** [@algunion](https://discourse.julialang.org/u/algunion)\
**Replies:** 7\
**Last updated:** [May 2, 2024, 7:47am UTC](https://discourse.julialang.org/t/rust-like-source-file-tests/113706 "2024-05-02T07:47:52Z")

</div>

I find the idiomatic Rust way of writing tests extremely practical, and I can only imagine that such an approach would add even more value to a language like Julia. Although tools like Copilot can have project-level acc…

---

## [Adding packages to Project.toml file using package URL](https://discourse.julialang.org/t/adding-packages-to-project-toml-file-using-package-url/113643)

<div class="topic-metadata">

**Author:** [@Name1](https://discourse.julialang.org/u/Name1)\
**Replies:** 7\
**Last updated:** [May 2, 2024, 7:45am UTC](https://discourse.julialang.org/t/adding-packages-to-project-toml-file-using-package-url/113643 "2024-05-02T07:45:58Z")

</div>

Hi all, I want to add a dependency (called MyDependency) that I have privately developed to my Project.toml file for my main module (called URLPack) using MyDependency’s URL. When I go to the package manager using the ‘…

---

## [There is no Julia for AMD Epyc, is there?](https://discourse.julialang.org/t/there-is-no-julia-for-amd-epyc-is-there/113713)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 5\
**Last updated:** [May 2, 2024, 4:02am UTC](https://discourse.julialang.org/t/there-is-no-julia-for-amd-epyc-is-there/113713 "2024-05-02T04:02:53Z")

</div>

I would like to run a test on an AMD EPYC 7543 32-Core Processor. I guess unless I want to build Julia myself, I am out of luck?

---

## [Efficiently selecting parts of a StaticArray](https://discourse.julialang.org/t/efficiently-selecting-parts-of-a-staticarray/4173)

<div class="topic-metadata">

**Author:** [@DNF](https://discourse.julialang.org/u/DNF)\
**Replies:** 17\
**Last updated:** [May 1, 2024, 5:27pm UTC](https://discourse.julialang.org/t/efficiently-selecting-parts-of-a-staticarray/4173 "2024-05-01T17:27:09Z")

</div>

Is there a convenient and efficient way of slicing StaticArrays, or let’s say, dropping parts of an SArray? julia\> vs = SVector{4}(rand(4)) 4-element SVector{4,Float64}: 0.580171 0.719607 0.651051 0.430415 julia\> v…

---

## [ArgumentError: First argument to \`@sprintf\` must be a format string](https://discourse.julialang.org/t/argumenterror-first-argument-to-sprintf-must-be-a-format-string/113697)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 4\
**Last updated:** [May 1, 2024, 3:26pm UTC](https://discourse.julialang.org/t/argumenterror-first-argument-to-sprintf-must-be-a-format-string/113697 "2024-05-01T15:26:30Z")

</div>

julia\> using Printf julia\> @sprintf("%.2f", 3.14159) "3.14" julia\> @sprintf("%."\*"3"\*"f", 3.14159) ERROR: ArgumentError: First argument to \`@sprintf\` must be a format string. julia\> format\_str = "%.2f" "%.2f" julia\> …

---

## [Environments - understanding basic use?](https://discourse.julialang.org/t/environments-understanding-basic-use/113689)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 1\
**Last updated:** [May 1, 2024, 10:28am UTC](https://discourse.julialang.org/t/environments-understanding-basic-use/113689 "2024-05-01T10:28:48Z")

</div>

Advice needed – I finally try to learn the basics of Environments (documentation I’ve found seems to cover more complex cases than mine…) Below, I describe my Case, and what we have done so far. I’m interested in feedba…

---

## [UPDsocket recv without allocations?](https://discourse.julialang.org/t/updsocket-recv-without-allocations/93481)

<div class="topic-metadata">

**Author:** [@nhardy](https://discourse.julialang.org/u/nhardy)\
**Replies:** 3\
**Last updated:** [May 1, 2024, 8:32am UTC](https://discourse.julialang.org/t/updsocket-recv-without-allocations/93481 "2024-05-01T08:32:20Z")

</div>

I have an application where i am receiving / synthesizing data from a number of sources. One source is UDP packets. From what I can find, the only way to receive data from a sock = UDPSocket() is with recv(sock)… which r…

---

## [Using @tensor with sparse tensors of SparseArrayKit.jl](https://discourse.julialang.org/t/using-tensor-with-sparse-tensors-of-sparsearraykit-jl/113686)

<div class="topic-metadata">

**Author:** [@Rodrigue](https://discourse.julialang.org/u/Rodrigue)\
**Replies:** 0\
**Last updated:** [May 1, 2024, 7:53am UTC](https://discourse.julialang.org/t/using-tensor-with-sparse-tensors-of-sparsearraykit-jl/113686 "2024-05-01T07:53:39Z")

</div>

According to the SparseArrayKit.jl documentation, sparse tensors implemented therein are compatible with the @tensor macro from the TensorOperations.jl package. The following simple code function randn\_sparse(T::Type{\<:…

---

## [Julia Slurm Cluster Module Command Not Working](https://discourse.julialang.org/t/julia-slurm-cluster-module-command-not-working/113600)

<div class="topic-metadata">

**Author:** [@TI36XPro](https://discourse.julialang.org/u/TI36XPro)\
**Replies:** 7\
**Last updated:** [May 1, 2024, 3:13am UTC](https://discourse.julialang.org/t/julia-slurm-cluster-module-command-not-working/113600 "2024-05-01T03:13:11Z")

</div>

Hello, I am experimenting with using Julia as my interpreter for slurm run scripts. But I am having an issue and I am hoping someone has run into this before. For reference, my cluster uses Lmod. As part of my run scri…

---

## [\`Set\`s inside \`Set\`s = dangerous](https://discourse.julialang.org/t/set-s-inside-set-s-dangerous/113669)

<div class="topic-metadata">

**Author:** [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Replies:** 5\
**Last updated:** [April 30, 2024, 8:36pm UTC](https://discourse.julialang.org/t/set-s-inside-set-s-dangerous/113669 "2024-04-30T20:36:36Z")

</div>

A colleague discovered the following behaviour. I presume it’s known by those who know, but it doesn’t seem to be documented? julia\> s1 = Set{Int}(\[1\]); julia\> s2 = Set{Int}(\[1, 2\]); julia\> S = Set(\[s1, s2\]); …

---

## [Stripping dollar signs from equations in Documenter.jl](https://discourse.julialang.org/t/stripping-dollar-signs-from-equations-in-documenter-jl/113503)

<div class="topic-metadata">

**Author:** [@Walter\_Dal\_Maz\_Silva](https://discourse.julialang.org/u/Walter_Dal_Maz_Silva)\
**Replies:** 1\
**Last updated:** [April 30, 2024, 8:05pm UTC](https://discourse.julialang.org/t/stripping-dollar-signs-from-equations-in-documenter-jl/113503 "2024-04-30T20:05:45Z")

</div>

First post here, and I don’t ask many questions in forums cause most of the time I find what I am looking for somewhere, but now I am stuck and couldn’t find a suitable solution in another topics. I’ve been using Julia d…

---

## [New version "Julia v1.10.3 has been released" and #52272 not fixed?](https://discourse.julialang.org/t/new-version-julia-v1-10-3-has-been-released-and-52272-not-fixed/113668)

<div class="topic-metadata">

**Author:** [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Replies:** 1\
**Last updated:** [April 30, 2024, 7:49pm UTC](https://discourse.julialang.org/t/new-version-julia-v1-10-3-has-been-released-and-52272-not-fixed/113668 "2024-04-30T19:49:24Z")

</div>

It is a serious bug for some Windows users.

---

## [Same expression returning inconsistent data types brings considerable inconvenience](https://discourse.julialang.org/t/same-expression-returning-inconsistent-data-types-brings-considerable-inconvenience/113469)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 29\
**Last updated:** [April 30, 2024, 6:08pm UTC](https://discourse.julialang.org/t/same-expression-returning-inconsistent-data-types-brings-considerable-inconvenience/113469 "2024-04-30T18:08:27Z")

</div>

For example, function fun(ind) a = \[1; 2\] b = \[3 4\] return a\[ind\]' \* reduce(vcat, b\[ind\]) end fun(\[true; true\]) fun(\[true; false\]) the result is: julia\> fun(\[true; true\]) 11 julia\> fun(\[true; false\]) 1×1 …

---

## [Locate Points within GMT Delauney triangularization](https://discourse.julialang.org/t/locate-points-within-gmt-delauney-triangularization/110967)

<div class="topic-metadata">

**Author:** [@morningglory05](https://discourse.julialang.org/u/morningglory05)\
**Replies:** 4\
**Last updated:** [April 30, 2024, 5:53pm UTC](https://discourse.julialang.org/t/locate-points-within-gmt-delauney-triangularization/110967 "2024-04-30T17:53:09Z")

</div>

Overall issue: I am finding the intersection of two planes. I have the values of both planes at ungridded points, so I subtract their values (call the difference z). Then I have x,y,z values and I find the contour for z=…

---

## [SpecialFunctions + Turing, AD support for quantile function of Gamma distribution gamma\_inv\_cdf](https://discourse.julialang.org/t/specialfunctions-turing-ad-support-for-quantile-function-of-gamma-distribution-gamma-inv-cdf/113663)

<div class="topic-metadata">

**Author:** [@mleprovost](https://discourse.julialang.org/u/mleprovost)\
**Replies:** 0\
**Last updated:** [April 30, 2024, 5:14pm UTC](https://discourse.julialang.org/t/specialfunctions-turing-ad-support-for-quantile-function-of-gamma-distribution-gamma-inv-cdf/113663 "2024-04-30T17:14:39Z")

</div>

Hello, I would like to use AD in Turing.jl to differentiate a custom density that involves the inverse cdf (i.e., quantile function) of a Gamma distribution. Unfortunately, the quantile function of the Gamma distributi…

---

## [PSA: Thread-local state is no longer recommended; Common misconceptions about threadid() and nthreads()](https://discourse.julialang.org/t/psa-thread-local-state-is-no-longer-recommended-common-misconceptions-about-threadid-and-nthreads/101274)

<div class="topic-metadata">

**Author:** [@Mason](https://discourse.julialang.org/u/Mason)\
**Replies:** 58\
**Last updated:** [April 30, 2024, 3:09pm UTC](https://discourse.julialang.org/t/psa-thread-local-state-is-no-longer-recommended-common-misconceptions-about-threadid-and-nthreads/101274 "2024-04-30T15:09:41Z")

</div>

Here’s a new blogpost we’ve been working on for some weeks now intended to explain and help fix a common and incorrect pattern that has been showing up in multithreaded julia code The TL;DR is that if you’ve written cod…

---

## [Inverse of Humanize.jl](https://discourse.julialang.org/t/inverse-of-humanize-jl/113648)

<div class="topic-metadata">

**Author:** [@bjarthur](https://discourse.julialang.org/u/bjarthur)\
**Replies:** 4\
**Last updated:** [April 30, 2024, 2:20pm UTC](https://discourse.julialang.org/t/inverse-of-humanize-jl/113648 "2024-04-30T14:20:56Z")

</div>

Humanize.jl is an old but nice package to convert e.g. 1248923592 to “1.2 GB”. but i need to go the other way around. simple to write some bespoke code myself to do this, but is there a package around? couldn’t find o…

---

## [\[Nerdsnipe warning\] Speed up short vector comparisons to beat R](https://discourse.julialang.org/t/nerdsnipe-warning-speed-up-short-vector-comparisons-to-beat-r/113400)

<div class="topic-metadata">

**Author:** [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Replies:** 37\
**Last updated:** [April 30, 2024, 8:54am UTC](https://discourse.julialang.org/t/nerdsnipe-warning-speed-up-short-vector-comparisons-to-beat-r/113400 "2024-04-30T08:54:02Z")

</div>

Here’s a problem a colleague came to me with; they’ve got an R implementation that takes a day to run something and I said “just re-write it in Julia, I’m sure it’ll take minutes”. A relatively simple re-write was indee…

---

## [Module that defines an interface for an abstract type without implementing it](https://discourse.julialang.org/t/module-that-defines-an-interface-for-an-abstract-type-without-implementing-it/113624)

<div class="topic-metadata">

**Author:** [@maxkapur](https://discourse.julialang.org/u/maxkapur)\
**Replies:** 11\
**Last updated:** [April 30, 2024, 7:56am UTC](https://discourse.julialang.org/t/module-that-defines-an-interface-for-an-abstract-type-without-implementing-it/113624 "2024-04-30T07:56:54Z")

</div>

Suppose I have a module that defines an abstract type AbstractPerformer (as in, a stage performer) and a stage routine for the performer as follows: module Performers abstract type AbstractPerformer end function rejoi…

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

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