# New to Julia

**URL:** https://discourse.julialang.org/c/first-steps/8.md?page=26

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

**Page:** 27

---

## [Can you run (execute) a Julia package in a similar way in which one can execute a Python package or module?](https://discourse.julialang.org/t/can-you-run-execute-a-julia-package-in-a-similar-way-in-which-one-can-execute-a-python-package-or-module/123397)

<div class="topic-metadata">

**Author:** [@world-peace](https://discourse.julialang.org/u/world-peace)\
**Replies:** 9\
**Last updated:** [December 3, 2024, 9:06pm UTC](https://discourse.julialang.org/t/can-you-run-execute-a-julia-package-in-a-similar-way-in-which-one-can-execute-a-python-package-or-module/123397 "2024-12-03T21:06:22Z")

</div>

Python has the ability to run a package or module using the -m flag. Does Julia have a similar mechanism? The way it works in python is as follows. You run python3 -m my\_package. my\_package is a package (a directory)…

---

## [CairoMakie No Copy Button VSCode](https://discourse.julialang.org/t/cairomakie-no-copy-button-vscode/123391)

<div class="topic-metadata">

**Author:** [@andrew-saydjari](https://discourse.julialang.org/u/andrew-saydjari)\
**Replies:** 5\
**Last updated:** [December 3, 2024, 7:24pm UTC](https://discourse.julialang.org/t/cairomakie-no-copy-button-vscode/123391 "2024-12-03T19:24:30Z")

</div>

Not new to Julia, but new to CairoMakie. Trying to switch my plots from PythonPlots. My old PythonPlots workflow generated an image in VSCode that had a little copy symbol on it, that would copy it to the clipboard. With…

---

## [Convert time interval to seconds?](https://discourse.julialang.org/t/convert-time-interval-to-seconds/3806)

<div class="topic-metadata">

**Author:** [@ndbecker](https://discourse.julialang.org/u/ndbecker)\
**Replies:** 3\
**Last updated:** [July 9, 2019, 7:42am UTC](https://discourse.julialang.org/t/convert-time-interval-to-seconds/3806 "2019-07-09T07:42:19Z")

</div>

T0 = now() T = now() - T0 typeof(T) Base.Dates.Millisecond If I want to convert to seconds, I can do convert(Float64, (now() - T0).value)/1000 Well, that’s ugly, and depends on knowing that the time period happens to …

---

## [Why string interning when strings are immutable?](https://discourse.julialang.org/t/why-string-interning-when-strings-are-immutable/123417)

<div class="topic-metadata">

**Author:** [@world-peace](https://discourse.julialang.org/u/world-peace)\
**Replies:** 1\
**Last updated:** [December 3, 2024, 5:10pm UTC](https://discourse.julialang.org/t/why-string-interning-when-strings-are-immutable/123417 "2024-12-03T17:10:16Z")

</div>

Just read something which caught my attention when reading the metaprogramming documentation: Metaprogramming · The Julia Language Which states that one of the purposes of the : is to create an interned string. Appar…

---

## [ADAM solver returns parameter values resulting in poor fit for my SDE model](https://discourse.julialang.org/t/adam-solver-returns-parameter-values-resulting-in-poor-fit-for-my-sde-model/122999)

<div class="topic-metadata">

**Author:** [@Luis\_Reig\_Quilis](https://discourse.julialang.org/u/Luis_Reig_Quilis)\
**Replies:** 4\
**Last updated:** [December 3, 2024, 4:28pm UTC](https://discourse.julialang.org/t/adam-solver-returns-parameter-values-resulting-in-poor-fit-for-my-sde-model/122999 "2024-12-03T16:28:05Z")

</div>

Hi! I am a plant breeding master student that recently got into SDEs. I am investigating the seasonal change in biomass of some wheat genotypes from the day they are sowed until the day of harvest. I want to fit a SDE mo…

---

## [Learning to write and rendering Julia-style Markdown](https://discourse.julialang.org/t/learning-to-write-and-rendering-julia-style-markdown/123243)

<div class="topic-metadata">

**Author:** [@Benny](https://discourse.julialang.org/u/Benny)\
**Replies:** 8\
**Last updated:** [December 3, 2024, 6:54am UTC](https://discourse.julialang.org/t/learning-to-write-and-rendering-julia-style-markdown/123243 "2024-12-03T06:54:42Z")

</div>

Getting around to learning how to write documentation more sophisticated than ASCII docstrings, so I’m practicing Markdown. VS Code already previews/renders Markdown files with LaTeX equation support, so that’s cool. Thi…

---

## [Error: MethodError: no method matching validate](https://discourse.julialang.org/t/error-methoderror-no-method-matching-validate/123354)

<div class="topic-metadata">

**Author:** [@Jax\_Xu](https://discourse.julialang.org/u/Jax_Xu)\
**Replies:** 9\
**Last updated:** [December 2, 2024, 4:14pm UTC](https://discourse.julialang.org/t/error-methoderror-no-method-matching-validate/123354 "2024-12-02T16:14:02Z")

</div>

Hi! I’m new to Julia and Catalyst.jl. I am trying to follow the tutorial of Introduction to learn how to use catalyst. I install packages, including Blockquote Status C:\\Users\\23954749\\.julia\\environments\\v1.10\\Projec…

---

## [Convert filepath to URI](https://discourse.julialang.org/t/convert-filepath-to-uri/123334)

<div class="topic-metadata">

**Author:** [@thestoicone](https://discourse.julialang.org/u/thestoicone)\
**Replies:** 6\
**Last updated:** [December 2, 2024, 9:11am UTC](https://discourse.julialang.org/t/convert-filepath-to-uri/123334 "2024-12-02T09:11:28Z")

</div>

I’ve been knocking my head against a wall trying to fix an issue in the .xspf (VLC) playlist generator I’m writing. I used “walkdir” to get the paths of the files but I can’t seem to convert them into the correct format …

---

## [Converting Char type to Int type](https://discourse.julialang.org/t/converting-char-type-to-int-type/123320)

<div class="topic-metadata">

**Author:** [@hack3rcon](https://discourse.julialang.org/u/hack3rcon)\
**Replies:** 6\
**Last updated:** [December 1, 2024, 10:09am UTC](https://discourse.julialang.org/t/converting-char-type-to-int-type/123320 "2024-12-01T10:09:00Z")

</div>

Hello, I have a file similar to the following: 1 2 3 4 5 6 7 8 9 10 I wrote the following program to read this file character by character and convert its numbers to Int type: function summer() inn = open("input.…

---

## [Encountering usability issues with the REPL](https://discourse.julialang.org/t/encountering-usability-issues-with-the-repl/123301)

<div class="topic-metadata">

**Author:** [@Elias\_Al\_Alam](https://discourse.julialang.org/u/Elias_Al_Alam)\
**Replies:** 13\
**Last updated:** [December 1, 2024, 1:00am UTC](https://discourse.julialang.org/t/encountering-usability-issues-with-the-repl/123301 "2024-12-01T01:00:52Z")

</div>

So whenever i click run this REPL seems to be the default and it runs a bit a too slow and when i have something that requires input then it just gets stuck. On top of that the other way which is run “Run file in new …

---

## [Packages to write a blog post on “Optimizing an X matmul kernel” in Julia](https://discourse.julialang.org/t/packages-to-write-a-blog-post-on-optimizing-an-x-matmul-kernel-in-julia/123095)

<div class="topic-metadata">

**Author:** [@xiaoxi](https://discourse.julialang.org/u/xiaoxi)\
**Replies:** 1\
**Last updated:** [November 30, 2024, 10:22am UTC](https://discourse.julialang.org/t/packages-to-write-a-blog-post-on-optimizing-an-x-matmul-kernel-in-julia/123095 "2024-11-30T10:22:12Z")

</div>

If I were to write a post similar to “Optimizing an X matmul kernel” like but in Julia, how should I start? Should I start by learning how to use KernelAbstractions.jl? P.S: I understand that a blog post like this, h…

---

## [Recursive functions](https://discourse.julialang.org/t/recursive-functions/123279)

<div class="topic-metadata">

**Author:** [@hack3rcon](https://discourse.julialang.org/u/hack3rcon)\
**Replies:** 3\
**Last updated:** [November 30, 2024, 9:19am UTC](https://discourse.julialang.org/t/recursive-functions/123279 "2024-11-30T09:19:31Z")

</div>

Hello, Consider the following recursive function: function decToBin(n) if n \> 0 decToBin(n ÷ 2) print("$(n % 2)") end end For example, n=13. The n is greater than 0 and the line decToBin(n ÷ 2) …

---

## [Function depending on in-place or not in-place function handles](https://discourse.julialang.org/t/function-depending-on-in-place-or-not-in-place-function-handles/123236)

<div class="topic-metadata">

**Author:** [@danieleavitabile](https://discourse.julialang.org/u/danieleavitabile)\
**Replies:** 8\
**Last updated:** [November 29, 2024, 5:46pm UTC](https://discourse.julialang.org/t/function-depending-on-in-place-or-not-in-place-function-handles/123236 "2024-11-29T17:46:34Z")

</div>

I’m moving my first steps in programming with Julia and I have written a module whose structure is below: module my\_solver function solve(f,u0) # use f(u) and u0 to compute u\_final return u\_final end end in which…

---

## [Apply inverse of BigFloat sparse Hermitian matrix](https://discourse.julialang.org/t/apply-inverse-of-bigfloat-sparse-hermitian-matrix/123189)

<div class="topic-metadata">

**Author:** [@EZ\_Money](https://discourse.julialang.org/u/EZ_Money)\
**Replies:** 2\
**Last updated:** [November 29, 2024, 3:07pm UTC](https://discourse.julialang.org/t/apply-inverse-of-bigfloat-sparse-hermitian-matrix/123189 "2024-11-29T15:07:41Z")

</div>

Hi! I’m trying to find the smallest singular vector of a sparse (16900x16900) Hermitian BigFloat matrix A. Is there a standard way to do this? My current idea is to use ArnoldiMethod.partialschur with a function that a…

---

## [Misplaced assignment statement](https://discourse.julialang.org/t/misplaced-assignment-statement/123194)

<div class="topic-metadata">

**Author:** [@engineer-in-a-box](https://discourse.julialang.org/u/engineer-in-a-box)\
**Replies:** 5\
**Last updated:** [November 29, 2024, 11:59am UTC](https://discourse.julialang.org/t/misplaced-assignment-statement/123194 "2024-11-29T11:59:48Z")

</div>

my code is giving me an error: LoadError: syntax: misplaced assignment statement in “\[T = BigInt\]” what does this error mean?

---

## [IntervalOptimisation.jl and threads gives lock conflicts](https://discourse.julialang.org/t/intervaloptimisation-jl-and-threads-gives-lock-conflicts/122588)

<div class="topic-metadata">

**Author:** [@JADekker](https://discourse.julialang.org/u/JADekker)\
**Replies:** 10\
**Last updated:** [November 29, 2024, 12:56am UTC](https://discourse.julialang.org/t/intervaloptimisation-jl-and-threads-gives-lock-conflicts/122588 "2024-11-29T00:56:02Z")

</div>

Hi, in a project I’m working on, I need to run many, many small optimizations. I like to do this by using Threads.@threads, which typically cuts down my runtime by a factor 2-4 for the problems I’m looking at. However, w…

---

## [Does Julia cache the code generation or compilation results of \`using SomeModuleName\`?](https://discourse.julialang.org/t/does-julia-cache-the-code-generation-or-compilation-results-of-using-somemodulename/123214)

<div class="topic-metadata">

**Author:** [@world-peace](https://discourse.julialang.org/u/world-peace)\
**Replies:** 1\
**Last updated:** [November 28, 2024, 8:21pm UTC](https://discourse.julialang.org/t/does-julia-cache-the-code-generation-or-compilation-results-of-using-somemodulename/123214 "2024-11-28T20:21:10Z")

</div>

I’m trying to demonstrate the effects of precompilation techniques in Julia. I have written 3 modules and one main.jl file which uses them. Here is my code: $ cat MyModule1.jl module MyModule1 function mysum(v::Abstr…

---

## [Ideas for examples to demonstrate precompilation time and runtime performance?](https://discourse.julialang.org/t/ideas-for-examples-to-demonstrate-precompilation-time-and-runtime-performance/123180)

<div class="topic-metadata">

**Author:** [@world-peace](https://discourse.julialang.org/u/world-peace)\
**Replies:** 4\
**Last updated:** [November 28, 2024, 5:19pm UTC](https://discourse.julialang.org/t/ideas-for-examples-to-demonstrate-precompilation-time-and-runtime-performance/123180 "2024-11-28T17:19:41Z")

</div>

I am looking for some ideas for short example codes which can be used to demonstrate how much time it takes for Julia to compile when code is first run vs the time taken for code to execute after it has been run once (an…

---

## [ERROR: IOError: rm("C:\\\\Users\\\\35879\\\\.julia\\\\artifacts\\\\jl\_weK1vY\\\\bin"): directory not empty (ENOTEMPTY)](https://discourse.julialang.org/t/error-ioerror-rm-c-users-35879-julia-artifacts-jl-wek1vy-bin-directory-not-empty-enotempty/123142)

<div class="topic-metadata">

**Author:** [@Y1123929](https://discourse.julialang.org/u/Y1123929)\
**Replies:** 6\
**Last updated:** [November 28, 2024, 3:39pm UTC](https://discourse.julialang.org/t/error-ioerror-rm-c-users-35879-julia-artifacts-jl-wek1vy-bin-directory-not-empty-enotempty/123142 "2024-11-28T15:39:19Z")

</div>

When I encountered this error while downloading the environment package, but the directory is empty.How should I handle it? I would be very grateful. (ANN) pkg\> add Flux, Images, Plots Resolving package versions... …

---

## [Storing output in matrix or vector format](https://discourse.julialang.org/t/storing-output-in-matrix-or-vector-format/123207)

<div class="topic-metadata">

**Author:** [@danieleavitabile](https://discourse.julialang.org/u/danieleavitabile)\
**Replies:** 4\
**Last updated:** [November 28, 2024, 11:20am UTC](https://discourse.julialang.org/t/storing-output-in-matrix-or-vector-format/123207 "2024-11-28T11:20:55Z")

</div>

I’m new to Julia, coming from Matlab. Consider the following sketched function function time\_stepper(f,u0,nsteps, ...) # Allocate arrays t = zeros(nsteps) p = length(u0) u = zeros(p,nsteps +1) # Initialise t\[1\] = 0.0…

---

## [ERROR: UndefVarError: \`ADAM\` not defined in \`Main\` in flux](https://discourse.julialang.org/t/error-undefvarerror-adam-not-defined-in-main-in-flux/121784)

<div class="topic-metadata">

**Author:** [@Liuxiu1512](https://discourse.julialang.org/u/Liuxiu1512)\
**Replies:** 4\
**Last updated:** [November 28, 2024, 10:01am UTC](https://discourse.julialang.org/t/error-undefvarerror-adam-not-defined-in-main-in-flux/121784 "2024-11-28T10:01:16Z")

</div>

Hi, i get this error when try to using flux julia\> using Pkg julia\> Pkg.add(“Flux”) Resolving package versions… No Changes to C:\\Users\\lbtvi\\.julia\\environments\\v1.11\\Project.toml No Changes to C:\\Users\\lbtvi\\.julia…

---

## [Error when subtracting sparse matrices](https://discourse.julialang.org/t/error-when-subtracting-sparse-matrices/123198)

<div class="topic-metadata">

**Author:** [@EZ\_Money](https://discourse.julialang.org/u/EZ_Money)\
**Replies:** 5\
**Last updated:** [November 28, 2024, 9:20am UTC](https://discourse.julialang.org/t/error-when-subtracting-sparse-matrices/123198 "2024-11-28T09:20:22Z")

</div>

I’m getting an error when running A-B for sparse matrices A and B which have the same type and dimensions. Actually, B was obtained from A by setting B = A; B\[1,1\] = 1; julia\> Ha 16900×16900 SparseMatrixCSC{Complex{BigF…

---

## [Understanding the output of @code\_warntype](https://discourse.julialang.org/t/understanding-the-output-of-code-warntype/123191)

<div class="topic-metadata">

**Author:** [@miguelborrero](https://discourse.julialang.org/u/miguelborrero)\
**Replies:** 8\
**Last updated:** [November 28, 2024, 8:35am UTC](https://discourse.julialang.org/t/understanding-the-output-of-code-warntype/123191 "2024-11-28T08:35:12Z")

</div>

Hi there, I simulated some data which I stored as an Array{Observation} where Observation is a composite type that stores the elements of each observation. I then I wrote a function to compute the log-likelihood of the …

---

## [Animate Makie.volume! doesn't work](https://discourse.julialang.org/t/animate-makie-volume-doesnt-work/123162)

<div class="topic-metadata">

**Author:** [@YoffeG](https://discourse.julialang.org/u/YoffeG)\
**Replies:** 4\
**Last updated:** [November 27, 2024, 6:31pm UTC](https://discourse.julialang.org/t/animate-makie-volume-doesnt-work/123162 "2024-11-27T18:31:16Z")

</div>

Hey all, assume I have a time-varying 3d volume that I wish to animate and save as an mp4 file, where the volume is simply a color-coded cube, where the color coding is the value of each pixel varying in time. I found no…

---

## [What function is called to convert a type to a string as part of string interpolation?](https://discourse.julialang.org/t/what-function-is-called-to-convert-a-type-to-a-string-as-part-of-string-interpolation/123119)

<div class="topic-metadata">

**Author:** [@world-peace](https://discourse.julialang.org/u/world-peace)\
**Replies:** 7\
**Last updated:** [November 27, 2024, 7:59am UTC](https://discourse.julialang.org/t/what-function-is-called-to-convert-a-type-to-a-string-as-part-of-string-interpolation/123119 "2024-11-27T07:59:13Z")

</div>

I’m currently using the following code example\_string = "$(logdata.level)" to convert from a Base.CoreLogging.LogLevel to a String. However I would guess that there is a function call which can be used instead to do t…

---

## [Pkg.add(“DiffEqOperators”) throws error](https://discourse.julialang.org/t/pkg-add-diffeqoperators-throws-error/123081)

<div class="topic-metadata">

**Author:** [@Y1123929](https://discourse.julialang.org/u/Y1123929)\
**Replies:** 2\
**Last updated:** [November 27, 2024, 3:42am UTC](https://discourse.julialang.org/t/pkg-add-diffeqoperators-throws-error/123081 "2024-11-27T03:42:23Z")

</div>

I’m getting an error using Pkg.add(“DiffEqOperators”) How this situation should be resolved. I would be grateful. Pkg.add("DiffEqOperators") Resolving package versions... ERROR: Unsatisfiable requirements detected f…

---

## [How to interpret this function with no name, and two sets of parenthesis](https://discourse.julialang.org/t/how-to-interpret-this-function-with-no-name-and-two-sets-of-parenthesis/123092)

<div class="topic-metadata">

**Author:** [@world-peace](https://discourse.julialang.org/u/world-peace)\
**Replies:** 3\
**Last updated:** [November 26, 2024, 12:40pm UTC](https://discourse.julialang.org/t/how-to-interpret-this-function-with-no-name-and-two-sets-of-parenthesis/123092 "2024-11-26T12:40:43Z")

</div>

Can anyone help me understand how to interpret the below function? It appears to be an anonymous function, but has two sets of parenthesis. function (j::JSON)(io, args) (io, args) are arguments to this function. But w…

---

## [Reading and printing characters from a file](https://discourse.julialang.org/t/reading-and-printing-characters-from-a-file/123079)

<div class="topic-metadata">

**Author:** [@hack3rcon](https://discourse.julialang.org/u/hack3rcon)\
**Replies:** 2\
**Last updated:** [November 26, 2024, 9:27am UTC](https://discourse.julialang.org/t/reading-and-printing-characters-from-a-file/123079 "2024-11-26T09:27:07Z")

</div>

Hello, I have a file like below: A B c I want to write a program that produces output like the following: A is Uppercase B is Uppercase c is Lowercase I wrote the following program: function UL() inn = open("in…

---

## [Cannot download GalacticOptim after downloading environment package NeuralPDE](https://discourse.julialang.org/t/cannot-download-galacticoptim-after-downloading-environment-package-neuralpde/123072)

<div class="topic-metadata">

**Author:** [@Y1123929](https://discourse.julialang.org/u/Y1123929)\
**Replies:** 2\
**Last updated:** [November 26, 2024, 8:52am UTC](https://discourse.julialang.org/t/cannot-download-galacticoptim-after-downloading-environment-package-neuralpde/123072 "2024-11-26T08:52:15Z")

</div>

The following is my code import Pkg Pkg.add("GalacticOptim") using NeuralPDE,GalacticOptim When NeuralPDE is included in the environment package, the following error occurs when GalacticOptim is downloaded, but it can…

---

## [Permutation formula n!/(n-r)!](https://discourse.julialang.org/t/permutation-formula-n-n-r/123040)

<div class="topic-metadata">

**Author:** [@hack3rcon](https://discourse.julialang.org/u/hack3rcon)\
**Replies:** 20\
**Last updated:** [November 26, 2024, 7:37am UTC](https://discourse.julialang.org/t/permutation-formula-n-n-r/123040 "2024-11-26T07:37:24Z")

</div>

Hello, To calculate the formula n!/(n-r)!, I wrote the following program: function combinations(n, r) n = BigInt(factorial(n)) r = BigInt(factorial(r)) t = BigInt(factorial(n-r)) final = BigInt(n / (t \*…

[Previous page](https://discourse.julialang.org/c/first-steps/8.md?page=25)

[Next page](https://discourse.julialang.org/c/first-steps/8.md?page=27)
