# General Usage

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

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

**Page:** 217

---

## [Differential equation with periodic orbit: Can Diffeq.jl determine the period?](https://discourse.julialang.org/t/differential-equation-with-periodic-orbit-can-diffeq-jl-determine-the-period/107982)

<div class="topic-metadata">

**Author:** [@HMegh](https://discourse.julialang.org/u/HMegh)\
**Replies:** 9\
**Last updated:** [December 28, 2023, 10:09pm UTC](https://discourse.julialang.org/t/differential-equation-with-periodic-orbit-can-diffeq-jl-determine-the-period/107982 "2023-12-28T22:09:37Z")

</div>

Hi, I am working on a problem where the differential equation \\mathbf{x}'(t)=F(\\mathbf{x}(t)) admits a periodic solution. For example: \\begin{cases} x'(t) = -y(t) \\\\ y'(t)=x(t)\\end{cases},\\qquad x(0)=1,\\ y(0)=0. The…

---

## [16 bit float on Transformers.jl](https://discourse.julialang.org/t/16-bit-float-on-transformers-jl/107867)

<div class="topic-metadata">

**Author:** [@RainerHeintzmann](https://discourse.julialang.org/u/RainerHeintzmann)\
**Replies:** 7\
**Last updated:** [December 28, 2023, 7:40pm UTC](https://discourse.julialang.org/t/16-bit-float-on-transformers-jl/107867 "2023-12-28T19:40:13Z")

</div>

I am new to LLMs but thought to give it a shot using Transformers.jl. This worked rather well, after creating an account at HuggingFace and getting permission for Llama-7B from Meta. Yet, I was surprised how much GPU ram…

---

## [Question About New GC Threads](https://discourse.julialang.org/t/question-about-new-gc-threads/108117)

<div class="topic-metadata">

**Author:** [@TI36XPro](https://discourse.julialang.org/u/TI36XPro)\
**Replies:** 7\
**Last updated:** [December 28, 2023, 5:47pm UTC](https://discourse.julialang.org/t/question-about-new-gc-threads/108117 "2023-12-28T17:47:51Z")

</div>

I am excited to start using Julia 1.10.0 since I have a particular set of simulations which are allocation heavy (many small allocations) and I believe the GC is the current bottleneck. I want to make sure I am doing th…

---

## [Using \`replace()\` with unicode dot](https://discourse.julialang.org/t/using-replace-with-unicode-dot/108133)

<div class="topic-metadata">

**Author:** [@Brad\_Carman](https://discourse.julialang.org/u/Brad_Carman)\
**Replies:** 2\
**Last updated:** [December 28, 2023, 2:53pm UTC](https://discourse.julialang.org/t/using-replace-with-unicode-dot/108133 "2023-12-28T14:53:46Z")

</div>

Is there a way to get the “\\dot” unicode character to be replaced? julia\> replace("ẋ′", "ẋ"=\>"dx", "′"=\>"\_p") "ẋ\_p"

---

## [Allocations from selecting fields of a named tuple](https://discourse.julialang.org/t/allocations-from-selecting-fields-of-a-named-tuple/108112)

<div class="topic-metadata">

**Author:** [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Replies:** 4\
**Last updated:** [December 28, 2023, 12:53pm UTC](https://discourse.julialang.org/t/allocations-from-selecting-fields-of-a-named-tuple/108112 "2023-12-28T12:53:29Z")

</div>

There seems to be a large difference in the number allocations when selecting fields from a named tuple via two different approaches. using BenchmarkTools nt = (a=1, b=2, c=3) t = (:b, :c) If I use getindex, I get 6 al…

---

## [How do I check which GPU backend I should use](https://discourse.julialang.org/t/how-do-i-check-which-gpu-backend-i-should-use/108108)

<div class="topic-metadata">

**Author:** [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Replies:** 1\
**Last updated:** [December 28, 2023, 9:51am UTC](https://discourse.julialang.org/t/how-do-i-check-which-gpu-backend-i-should-use/108108 "2023-12-28T09:51:18Z")

</div>

I want to try some GPU computation (for a tutorial). I use DiffEqGPU, and need to designate a backend of these: CUDA.functional(). Is there a good way (more than installing, compiling, and checking all alternatives) to …

---

## [Trivial port from C++/Rust to Julia](https://discourse.julialang.org/t/trivial-port-from-c-rust-to-julia/105787)

<div class="topic-metadata">

**Author:** [@feribg](https://discourse.julialang.org/u/feribg)\
**Replies:** 51\
**Last updated:** [December 28, 2023, 5:21am UTC](https://discourse.julialang.org/t/trivial-port-from-c-rust-to-julia/105787 "2023-12-28T05:21:30Z")

</div>

I’m trying to port a very trivial MC simulation from C++ / Rust to Julia. Here are the 3 implementations: C++: (clang OSX) https://pastebin.com/HWEUxa6W Rust: https://pastebin.com/7d31ynJE Julia: https://pastebin.com…

---

## [Error in atexit() when stopping with SIGTERM signal](https://discourse.julialang.org/t/error-in-atexit-when-stopping-with-sigterm-signal/60486)

<div class="topic-metadata">

**Author:** [@kubcoporubco](https://discourse.julialang.org/u/kubcoporubco)\
**Replies:** 0\
**Last updated:** [May 3, 2021, 9:37pm UTC](https://discourse.julialang.org/t/error-in-atexit-when-stopping-with-sigterm-signal/60486 "2021-05-03T21:37:33Z")

</div>

Hi, I am running a compiled julia application in a docker container. In the application code I am registering a zero argument function closeAll by calling the atexit(closeAll). The closeAll function should be called befo…

---

## [Ctrl-C in script: atexit is ignored](https://discourse.julialang.org/t/ctrl-c-in-script-atexit-is-ignored/82413)

<div class="topic-metadata">

**Author:** [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Replies:** 0\
**Last updated:** [June 8, 2022, 8:44am UTC](https://discourse.julialang.org/t/ctrl-c-in-script-atexit-is-ignored/82413 "2022-06-08T08:44:46Z")

</div>

I cannot seem to be able to use atexit properly, in the context of catching Ctrl-C when running a script in Julia 1.7.2: function main() atexit(() -\> println("caught")) println("started program") sleep(5) …

---

## [Graceful interruption and ensure finishing current loop](https://discourse.julialang.org/t/graceful-interruption-and-ensure-finishing-current-loop/92359)

<div class="topic-metadata">

**Author:** [@AllanChain](https://discourse.julialang.org/u/AllanChain)\
**Replies:** 0\
**Last updated:** [December 31, 2022, 1:30pm UTC](https://discourse.julialang.org/t/graceful-interruption-and-ensure-finishing-current-loop/92359 "2022-12-31T13:30:53Z")

</div>

I have a big for loop but each step only takes a few secs to finish. What I want is that when I press Ctrl+C, the program finishes the current loop and stores the states in a file. I know there’s something called exit\_o…

---

## [Catching InterruptException in Embedded Julia](https://discourse.julialang.org/t/catching-interruptexception-in-embedded-julia/38466)

<div class="topic-metadata">

**Author:** [@randy3k](https://discourse.julialang.org/u/randy3k)\
**Replies:** 0\
**Last updated:** [April 30, 2020, 5:30am UTC](https://discourse.julialang.org/t/catching-interruptexception-in-embedded-julia/38466 "2020-04-30T05:30:38Z")

</div>

\#include \<julia.h\> JULIA\_DEFINE\_FAST\_TLS() // only define this once, in an executable (not in a shared library) if you want fast code. int main(int argc, char \*argv\[\]) { jl\_init(); JL\_TRY { jl\_eval\_stri…

---

## [\`Unitful\`: define units in module and use them outside](https://discourse.julialang.org/t/unitful-define-units-in-module-and-use-them-outside/108059)

<div class="topic-metadata">

**Author:** [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Replies:** 14\
**Last updated:** [December 27, 2023, 10:38pm UTC](https://discourse.julialang.org/t/unitful-define-units-in-module-and-use-them-outside/108059 "2023-12-27T22:38:17Z")

</div>

I’m reading the documentation (linked at the bottom of this message) about how to define new units and have come up with a module like this module MyUnits using Unitful Unitful.register(@\_\_MODULE\_\_) # What does this do…

---

## [\`SymPy.Sym\`s as keys in Dicts](https://discourse.julialang.org/t/sympy-sym-s-as-keys-in-dicts/103995)

<div class="topic-metadata">

**Author:** [@jlbosse](https://discourse.julialang.org/u/jlbosse)\
**Replies:** 5\
**Last updated:** [December 27, 2023, 7:04pm UTC](https://discourse.julialang.org/t/sympy-sym-s-as-keys-in-dicts/103995 "2023-12-27T19:04:45Z")

</div>

It seems that Tuples containting SymPy.Syms don’t work as keys in julia’s standard dicts as expected. See the following MWE and its very counterintuitive behaviour. julia\> using SymPy julia\> t = symbols("t") t julia\> …

---

## [Macro expanding to macro: @macroexpand1 works while @macroexpand does not](https://discourse.julialang.org/t/macro-expanding-to-macro-macroexpand1-works-while-macroexpand-does-not/108099)

<div class="topic-metadata">

**Author:** [@abraemer](https://discourse.julialang.org/u/abraemer)\
**Replies:** 7\
**Last updated:** [December 27, 2023, 4:33pm UTC](https://discourse.julialang.org/t/macro-expanding-to-macro-macroexpand1-works-while-macroexpand-does-not/108099 "2023-12-27T16:33:26Z")

</div>

While doing some repetitive data evaluation I had the idea to write a simple templating macro to reduce the boilerplate a bit. However my solution does not work and I don’t understand why. Moreover it in fact does work, …

---

## [Julia quirks (v. 1.9.0 and higher)](https://discourse.julialang.org/t/julia-quirks-v-1-9-0-and-higher/108098)

<div class="topic-metadata">

**Author:** [@KZiemian](https://discourse.julialang.org/u/KZiemian)\
**Replies:** 3\
**Last updated:** [December 27, 2023, 3:23pm UTC](https://discourse.julialang.org/t/julia-quirks-v-1-9-0-and-higher/108098 "2023-12-27T15:23:27Z")

</div>

I’m a huge fan of Julia compiler, even if my knowledge of it is very limited. As you should expected with such complicated program it has few quirks that we should be aware of. Since I’m not advanced Julia programmer, I …

---

## [Question About Unicode and Symbols](https://discourse.julialang.org/t/question-about-unicode-and-symbols/108080)

<div class="topic-metadata">

**Author:** [@TI36XPro](https://discourse.julialang.org/u/TI36XPro)\
**Replies:** 2\
**Last updated:** [December 27, 2023, 2:05pm UTC](https://discourse.julialang.org/t/question-about-unicode-and-symbols/108080 "2023-12-27T14:05:53Z")

</div>

Hello I’ve been experimenting with overloading getproperty for some structs in a personal project of mine. I noticed the following throws an error (using getfield instead of getproperty in this MWE). Does anyone know …

---

## [StaticCompiler - how to handle integer division error?](https://discourse.julialang.org/t/staticcompiler-how-to-handle-integer-division-error/108061)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 2\
**Last updated:** [December 27, 2023, 3:17am UTC](https://discourse.julialang.org/t/staticcompiler-how-to-handle-integer-division-error/108061 "2023-12-27T03:17:18Z")

</div>

StaticCompiler.jl does not allow exceptions. I got stuck trying to compile code involving the mod operator %, as it can raise an exception DivideError if you’re dividing by zero. How can I work around this?

---

## [Rand in Julia vs MATLAB](https://discourse.julialang.org/t/rand-in-julia-vs-matlab/6505)

<div class="topic-metadata">

**Author:** [@rohith14](https://discourse.julialang.org/u/rohith14)\
**Replies:** 10\
**Last updated:** [December 27, 2023, 3:13am UTC](https://discourse.julialang.org/t/rand-in-julia-vs-matlab/6505 "2023-12-27T03:13:33Z")

</div>

Hi, Based on this issue, https://github.com/JuliaLang/julia/issues/8606, I see we are generating different random number sequence in Julia and MATLAB. Is their a way to get same random numbers in both languages ? I se…

---

## [How to programmatically create symbolic variable names in Symbolics.jl](https://discourse.julialang.org/t/how-to-programmatically-create-symbolic-variable-names-in-symbolics-jl/96948)

<div class="topic-metadata">

**Author:** [@pluie](https://discourse.julialang.org/u/pluie)\
**Replies:** 7\
**Last updated:** [December 26, 2023, 5:58pm UTC](https://discourse.julialang.org/t/how-to-programmatically-create-symbolic-variable-names-in-symbolics-jl/96948 "2023-12-26T17:58:16Z")

</div>

Essentially, I am looping over indices and I need to use those indices to create symbolic variable names. A simplified version of what I am trying to do as shown using SymPy: vars=\[\] for i=1:5 for j=2:7 push!…

---

## [Understanding ModelingToolkit connectors and components](https://discourse.julialang.org/t/understanding-modelingtoolkit-connectors-and-components/107783)

<div class="topic-metadata">

**Author:** [@BambOoxX](https://discourse.julialang.org/u/BambOoxX)\
**Replies:** 9\
**Last updated:** [December 26, 2023, 5:48pm UTC](https://discourse.julialang.org/t/understanding-modelingtoolkit-connectors-and-components/107783 "2023-12-26T17:48:35Z")

</div>

Context As discussed in Broadcast inside of \`@mtkmodel\` macro causes precompilation failures when put into a package - #11 by BambOoxX, I’m trying to define mtkmodels to model a moving rigid body submitted to some actio…

---

## [Mutable struct assignment overloading / fast management of temporaries in expression](https://discourse.julialang.org/t/mutable-struct-assignment-overloading-fast-management-of-temporaries-in-expression/108056)

<div class="topic-metadata">

**Author:** [@mattsignorelli](https://discourse.julialang.org/u/mattsignorelli)\
**Replies:** 2\
**Last updated:** [December 26, 2023, 3:01pm UTC](https://discourse.julialang.org/t/mutable-struct-assignment-overloading-fast-management-of-temporaries-in-expression/108056 "2023-12-26T15:01:28Z")

</div>

I’m creating a package which interfaces to a C library with C structs, and implements all the operator overloading for these structs. For example it looks a bit like mutable struct MyStruct t::Ptr{CStruct} # Constru…

---

## [Best practice to document non-API functions](https://discourse.julialang.org/t/best-practice-to-document-non-api-functions/108025)

<div class="topic-metadata">

**Author:** [@David\_Sagan](https://discourse.julialang.org/u/David_Sagan)\
**Replies:** 5\
**Last updated:** [December 26, 2023, 11:59am UTC](https://discourse.julialang.org/t/best-practice-to-document-non-api-functions/108025 "2023-12-26T11:59:17Z")

</div>

I am developing a rather large package that will have a substantial number of functions that are low level and not part of the API. I am new to Julia and am not sure the best way of documenting these. I could write doc s…

---

## [How to extract data from pdf with two columns](https://discourse.julialang.org/t/how-to-extract-data-from-pdf-with-two-columns/108008)

<div class="topic-metadata">

**Author:** [@Simone\_Gabbriellini](https://discourse.julialang.org/u/Simone_Gabbriellini)\
**Replies:** 6\
**Last updated:** [December 26, 2023, 11:59am UTC](https://discourse.julialang.org/t/how-to-extract-data-from-pdf-with-two-columns/108008 "2023-12-26T11:59:09Z")

</div>

I am trying to extract text from a pdf using PDFIO.jl. Problem is that some slides have text on double columns, and the extraction with the provided example fails to reconstruct the text the proper way. For example usin…

---

## [Here's a fun thing](https://discourse.julialang.org/t/heres-a-fun-thing/106556)

<div class="topic-metadata">

**Author:** [@lewis](https://discourse.julialang.org/u/lewis)\
**Replies:** 16\
**Last updated:** [December 26, 2023, 7:25am UTC](https://discourse.julialang.org/t/heres-a-fun-thing/106556 "2023-12-26T07:25:16Z")

</div>

Here is a Lisp-y or Scheme-y, if you prefer, way to deal with deeply nested dicts in Julia. Don’t ask why, but I have an application with deeply nested data structures. I serialize them to and from YAML, which isn’t a ma…

---

## [Documenter.jl - Creating Documentation for Arbitrary Julia Scripts](https://discourse.julialang.org/t/documenter-jl-creating-documentation-for-arbitrary-julia-scripts/108038)

<div class="topic-metadata">

**Author:** [@General.T.Case](https://discourse.julialang.org/u/General.T.Case)\
**Replies:** 1\
**Last updated:** [December 26, 2023, 6:37am UTC](https://discourse.julialang.org/t/documenter-jl-creating-documentation-for-arbitrary-julia-scripts/108038 "2023-12-26T06:37:07Z")

</div>

Is it possible to use Documenter.jl to create documentation for an arbitrary set of Julia scripts located in arbitrary directories? In particular, suppose the scripts are not part of package. It seems straightforward e…

---

## [NeuralPDE - example is taking hours to run](https://discourse.julialang.org/t/neuralpde-example-is-taking-hours-to-run/108024)

<div class="topic-metadata">

**Author:** [@affans](https://discourse.julialang.org/u/affans)\
**Replies:** 4\
**Last updated:** [December 26, 2023, 3:58am UTC](https://discourse.julialang.org/t/neuralpde-example-is-taking-hours-to-run/108024 "2023-12-26T03:58:19Z")

</div>

I am following the example of solving an ODE using PINN. However, on my machine, it’s been 2+ hours, and I am only on iteration 5 of 200… Does anyone know what could be going wrong here? Is it the matter of Flux vs Lux? …

---

## [Creating a system image on Raspery Pi 5](https://discourse.julialang.org/t/creating-a-system-image-on-raspery-pi-5/108016)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 2\
**Last updated:** [December 25, 2023, 8:09pm UTC](https://discourse.julialang.org/t/creating-a-system-image-on-raspery-pi-5/108016 "2023-12-25T20:09:23Z")

</div>

I wrote a script to create a system image on the Pi 5 for my current project, see: I am using ModelingToolkit and other libraries that result in a very large system image. This causes some issues, mainly the RAM requ…

---

## [Multi-threading with DataFrames](https://discourse.julialang.org/t/multi-threading-with-dataframes/101859)

<div class="topic-metadata">

**Author:** [@roh\_codeur](https://discourse.julialang.org/u/roh_codeur)\
**Replies:** 33\
**Last updated:** [December 24, 2023, 3:36pm UTC](https://discourse.julialang.org/t/multi-threading-with-dataframes/101859 "2023-12-24T15:36:02Z")

</div>

Hi I am trying to figure out how multi-threading works with data frames. Example 1: using DataFrames, ProgressMeter df = DataFrame(reshape(1:50\_000\_000, :, 25), :auto); df.id1 = repeat(1:10\_000, 200); df.id2 = string…

---

## [Convert String to function name](https://discourse.julialang.org/t/convert-string-to-function-name/1547)

<div class="topic-metadata">

**Author:** [@vics0000](https://discourse.julialang.org/u/vics0000)\
**Replies:** 28\
**Last updated:** [December 25, 2023, 3:41pm UTC](https://discourse.julialang.org/t/convert-string-to-function-name/1547 "2023-12-25T15:41:07Z")

</div>

It is reasonably trivial to create a dataframe of function calls and then use the table to conditionally execute those functions. My question is, can the dataframe be stored to a file and then recovered? When stored to …

---

## [Labeled vector or vector view of nested structure](https://discourse.julialang.org/t/labeled-vector-or-vector-view-of-nested-structure/108031)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 1\
**Last updated:** [December 25, 2023, 11:28am UTC](https://discourse.julialang.org/t/labeled-vector-or-vector-view-of-nested-structure/108031 "2023-12-25T11:28:38Z")

</div>

I am trying to organize a computation which maps a parameter vector p to various residuals r = f(p), and then solves for the root using a multivariate rootfinder. This part is simple. But then I want to understand and p…

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

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