# New to Julia

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

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

**Page:** 51

---

## [Using local namespaces in Pluto](https://discourse.julialang.org/t/using-local-namespaces-in-pluto/112238)

<div class="topic-metadata">

**Author:** [@user23804985096787](https://discourse.julialang.org/u/user23804985096787)\
**Replies:** 2\
**Last updated:** [March 29, 2024, 9:15am UTC](https://discourse.julialang.org/t/using-local-namespaces-in-pluto/112238 "2024-03-29T09:15:11Z")

</div>

Very basic question: I am writing some code in Pluto and can’t work out how to properly use local modules/namespaces. When using Jupyter notebooks, I can create local modules (either inside the notebook or in a local fi…

---

## [CPU multithreading: why can't my code estimate PI (throwing darts)?](https://discourse.julialang.org/t/cpu-multithreading-why-cant-my-code-estimate-pi-throwing-darts/112228)

<div class="topic-metadata">

**Author:** [@ErwinMoller](https://discourse.julialang.org/u/ErwinMoller)\
**Replies:** 2\
**Last updated:** [March 28, 2024, 12:36pm UTC](https://discourse.julialang.org/t/cpu-multithreading-why-cant-my-code-estimate-pi-throwing-darts/112228 "2024-03-28T12:36:45Z")

</div>

Hello, Goal: Estimating PI by throwing darts in a square and checking if they hit the unit-circle. I have 2 questions: Why does the following code always underestimate the value of PI? Second piece of code: Why does …

---

## [How to Filter 2D Fourier Coefficients](https://discourse.julialang.org/t/how-to-filter-2d-fourier-coefficients/112108)

<div class="topic-metadata">

**Author:** [@balancedflow](https://discourse.julialang.org/u/balancedflow)\
**Replies:** 15\
**Last updated:** [March 27, 2024, 10:57pm UTC](https://discourse.julialang.org/t/how-to-filter-2d-fourier-coefficients/112108 "2024-03-27T22:57:45Z")

</div>

I have a real 2D Array (Nx,Ny) of some variable, let’s say absolute vorticity. I perform a 2d fft on the matrix by: fc\_2d = FFTW.r2r(arr,FFTW.R2HC) which returns a 2d matrix of the same size of Fourier coefficients. I…

---

## [Anonymous function with get() misunderstanding](https://discourse.julialang.org/t/anonymous-function-with-get-misunderstanding/112198)

<div class="topic-metadata">

**Author:** [@mtesseracted](https://discourse.julialang.org/u/mtesseracted)\
**Replies:** 2\
**Last updated:** [March 27, 2024, 8:01pm UTC](https://discourse.julialang.org/t/anonymous-function-with-get-misunderstanding/112198 "2024-03-27T20:01:43Z")

</div>

I’m learning Julia and looking at the anonymous functions page: Functions · The Julia Language Why does the anonymous function go as the first argument to get when the doc says the default parameter for an undefined key…

---

## [Scope issue with begin/end](https://discourse.julialang.org/t/scope-issue-with-begin-end/112188)

<div class="topic-metadata">

**Author:** [@lrnv](https://discourse.julialang.org/u/lrnv)\
**Replies:** 2\
**Last updated:** [March 27, 2024, 3:59pm UTC](https://discourse.julialang.org/t/scope-issue-with-begin-end/112188 "2024-03-27T15:59:03Z")

</div>

Hi, I thought that module MyPkg const b = begin a = 2 b = a end end MyPkg.b # return 2 as wantedd MyPkg.a # return 2, but I wanted it not to exist. would give me a variable b with the value …

---

## [Seeking Feedback on Robust Solution for Consistent but ill-conditioned Linear System with Real Symmetric Positive Semidefinite Matrices](https://discourse.julialang.org/t/seeking-feedback-on-robust-solution-for-consistent-but-ill-conditioned-linear-system-with-real-symmetric-positive-semidefinite-matrices/111957)

<div class="topic-metadata">

**Author:** [@swanchristmas](https://discourse.julialang.org/u/swanchristmas)\
**Replies:** 1\
**Last updated:** [March 27, 2024, 2:45am UTC](https://discourse.julialang.org/t/seeking-feedback-on-robust-solution-for-consistent-but-ill-conditioned-linear-system-with-real-symmetric-positive-semidefinite-matrices/111957 "2024-03-27T02:45:18Z")

</div>

Hello everyone, I’m currently grappling with a challenging problem involving a linear system that’s consistent but ill-conditioned due to the nature of the matrices involved. I’ve devised a potential solution, but I’m s…

---

## [How to convert a raw string to escape $](https://discourse.julialang.org/t/how-to-convert-a-raw-string-to-escape/112141)

<div class="topic-metadata">

**Author:** [@Simone\_Gabbriellini](https://discourse.julialang.org/u/Simone_Gabbriellini)\
**Replies:** 3\
**Last updated:** [March 26, 2024, 7:24pm UTC](https://discourse.julialang.org/t/how-to-convert-a-raw-string-to-escape/112141 "2024-03-26T19:24:36Z")

</div>

I have a situation where I am making a call to OpenAI and I get back a string, which might contain a $ like in “the price of the ticket is 10$”. My problem is how to articulate the escape of the $ sign: raw\_string = r"…

---

## [Failed to precompile Plots due to InitError in libgobject-2.0.so: undefined symbol g\_pattern\_spec\_copy](https://discourse.julialang.org/t/failed-to-precompile-plots-due-to-initerror-in-libgobject-2-0-so-undefined-symbol-g-pattern-spec-copy/88900)

<div class="topic-metadata">

**Author:** [@clarakoehne](https://discourse.julialang.org/u/clarakoehne)\
**Replies:** 9\
**Last updated:** [December 17, 2023, 2:43am UTC](https://discourse.julialang.org/t/failed-to-precompile-plots-due-to-initerror-in-libgobject-2-0-so-undefined-symbol-g-pattern-spec-copy/88900 "2023-12-17T02:43:02Z")

</div>

Hello all! I am getting an error when I try to run my julia project on a high-performance cluster. I installed julia v1.8.2 using conda (conda create --name myenv julia; conda activate myenv) and instantiated my project …

---

## [Writing dataframes or arrays from Julia to excel file](https://discourse.julialang.org/t/writing-dataframes-or-arrays-from-julia-to-excel-file/112096)

<div class="topic-metadata">

**Author:** [@ssrrii](https://discourse.julialang.org/u/ssrrii)\
**Replies:** 12\
**Last updated:** [March 26, 2024, 5:30pm UTC](https://discourse.julialang.org/t/writing-dataframes-or-arrays-from-julia-to-excel-file/112096 "2024-03-26T17:30:59Z")

</div>

I have four data frames (D1, …, D4) usually having fixed number of columns, but varying numer of rows. I would like to write them next to each other to a single new sheet in an existing xlsx file. I use the packages XLSX…

---

## [How to fix this Precompile error for ITensors](https://discourse.julialang.org/t/how-to-fix-this-precompile-error-for-itensors/112135)

<div class="topic-metadata">

**Author:** [@vikram\_backup](https://discourse.julialang.org/u/vikram_backup)\
**Replies:** 4\
**Last updated:** [March 26, 2024, 5:18pm UTC](https://discourse.julialang.org/t/how-to-fix-this-precompile-error-for-itensors/112135 "2024-03-26T17:18:05Z")

</div>

I am getting the following error Failed to precompile ITensors \[9136182c-28ba-11e9-034c-db9fb085ebd5\] to ... ERROR: LoadError: UndefVarError: \`Unwrap\` not defined I was adding the package Makie, OrdinaryDiffEq, Dynamic…

---

## [Ensure type stability when using OrdinaryDiffEq](https://discourse.julialang.org/t/ensure-type-stability-when-using-ordinarydiffeq/112068)

<div class="topic-metadata">

**Author:** [@ChenPhy](https://discourse.julialang.org/u/ChenPhy)\
**Replies:** 5\
**Last updated:** [March 26, 2024, 2:09am UTC](https://discourse.julialang.org/t/ensure-type-stability-when-using-ordinarydiffeq/112068 "2024-03-26T02:09:17Z")

</div>

Hi, I am trying to solve large numbers of ODEs and my approach is to put solving the equations part into a function and it should spit out the relevant numbers/arrays. Using some a simple equation, it is akin to the fol…

---

## [How to define a new matrix type?](https://discourse.julialang.org/t/how-to-define-a-new-matrix-type/112098)

<div class="topic-metadata">

**Author:** [@homocomputeris](https://discourse.julialang.org/u/homocomputeris)\
**Replies:** 2\
**Last updated:** [March 25, 2024, 8:24pm UTC](https://discourse.julialang.org/t/how-to-define-a-new-matrix-type/112098 "2024-03-25T20:24:15Z")

</div>

How do I define a thin wrapper type around a matrix? I assumed that from LinearAlgebra should do what I want. However, it throws an error: struct MyMatrix{T,S\<:AbstractMatrix{\<:T}} \<: AbstractMatrix{T} data::S …

---

## [Get names and versions of loaded modules](https://discourse.julialang.org/t/get-names-and-versions-of-loaded-modules/42289)

<div class="topic-metadata">

**Author:** [@uwechsler](https://discourse.julialang.org/u/uwechsler)\
**Replies:** 6\
**Last updated:** [March 25, 2024, 3:03pm UTC](https://discourse.julialang.org/t/get-names-and-versions-of-loaded-modules/42289 "2024-03-25T15:03:22Z")

</div>

Is there a way to get the names and version numbers of the currently loaded modules in a Julia session?

---

## [Variable not found](https://discourse.julialang.org/t/variable-not-found/111865)

<div class="topic-metadata">

**Author:** [@Mishal](https://discourse.julialang.org/u/Mishal)\
**Replies:** 3\
**Last updated:** [March 25, 2024, 7:55am UTC](https://discourse.julialang.org/t/variable-not-found/111865 "2024-03-25T07:55:45Z")

</div>

Hi Guys Please refer to the below code. It was running perfectly and now for some reason I am getting the following error, “ERROR: UndefVarError: sol not defined”. Which makes no sense it has been defined… Any assistan…

---

## [A macro for parametrized functions](https://discourse.julialang.org/t/a-macro-for-parametrized-functions/111977)

<div class="topic-metadata">

**Author:** [@goerz](https://discourse.julialang.org/u/goerz)\
**Replies:** 8\
**Last updated:** [March 25, 2024, 2:18am UTC](https://discourse.julialang.org/t/a-macro-for-parametrized-functions/111977 "2024-03-25T02:18:17Z")

</div>

I am contemplating writing a macro @parameterized that turns @parameterized function ControlField( t; # variable ΔT₁, ΔT₂, ΔT₃, ϕ₁=0.0, ϕ₂=0.0, ϕ₃=0.0, E₀₁, E₀₂, E₀₃, # parameters a::Float64=100.0 # constan…

---

## [Julia Pkg (CSV DataFrames Eirene)](https://discourse.julialang.org/t/julia-pkg-csv-dataframes-eirene/112039)

<div class="topic-metadata">

**Author:** [@Meshach\_Ndlovu](https://discourse.julialang.org/u/Meshach_Ndlovu)\
**Replies:** 2\
**Last updated:** [March 24, 2024, 9:05pm UTC](https://discourse.julialang.org/t/julia-pkg-csv-dataframes-eirene/112039 "2024-03-24T21:05:28Z")

</div>

Hello esteemed experts, I am seeking assistance with running specific Julia packages in a Jupyter notebook. However, I encountered the following error message. As a newcomer to Julia, I would greatly appreciate your gui…

---

## [Using findfirst with for multiple values and columns in a Dataframe?](https://discourse.julialang.org/t/using-findfirst-with-for-multiple-values-and-columns-in-a-dataframe/111953)

<div class="topic-metadata">

**Author:** [@phantom](https://discourse.julialang.org/u/phantom)\
**Replies:** 21\
**Last updated:** [March 24, 2024, 10:38am UTC](https://discourse.julialang.org/t/using-findfirst-with-for-multiple-values-and-columns-in-a-dataframe/111953 "2024-03-24T10:38:18Z")

</div>

Is there a way to extend the findfirst(==(val1), df.col1) for more than one value over more than column in a dataframe. Something like findfirst(==(\[ val1, val2\]) , \[df.col1, df.col2\]) I tried findfirst(row -\> (row\[1…

---

## [Flux: Dimension mismatch error](https://discourse.julialang.org/t/flux-dimension-mismatch-error/111981)

<div class="topic-metadata">

**Author:** [@Longblackcoffee](https://discourse.julialang.org/u/Longblackcoffee)\
**Replies:** 1\
**Last updated:** [March 22, 2024, 4:57pm UTC](https://discourse.julialang.org/t/flux-dimension-mismatch-error/111981 "2024-03-22T16:57:09Z")

</div>

Hi everyone, I’m a beginner with Flux, and I want to use it to approximate a high-dimensional input function. However, I’m running into a dimension mismatch error. Here’s a MWE, where I’m just trying to approximate f(x,…

---

## [Indexing of vector of arrays](https://discourse.julialang.org/t/indexing-of-vector-of-arrays/111958)

<div class="topic-metadata">

**Author:** [@TongTongYee](https://discourse.julialang.org/u/TongTongYee)\
**Replies:** 2\
**Last updated:** [March 22, 2024, 11:35am UTC](https://discourse.julialang.org/t/indexing-of-vector-of-arrays/111958 "2024-03-22T11:35:22Z")

</div>

Hi! How do I index vector vector of arrays? Of course, I can easily index them in some cases. But I don’t know how to index them in specific cases. For example, A = Vector{Vector{Matrix{Int64}}}() for i = 1:10 pu…

---

## [The julia expression of only one equation with two variables](https://discourse.julialang.org/t/the-julia-expression-of-only-one-equation-with-two-variables/111916)

<div class="topic-metadata">

**Author:** [@whucsu](https://discourse.julialang.org/u/whucsu)\
**Replies:** 2\
**Last updated:** [March 22, 2024, 4:14am UTC](https://discourse.julialang.org/t/the-julia-expression-of-only-one-equation-with-two-variables/111916 "2024-03-22T04:14:37Z")

</div>

I get one simulation with only one expression below: the P(t) and Q(t) with their derivative are the expected, all the R，C are known parameters. suppose the initial values are known ,but I don’t know how to define th…

---

## [Color conversion from terminal color to Colors.jl color](https://discourse.julialang.org/t/color-conversion-from-terminal-color-to-colors-jl-color/111889)

<div class="topic-metadata">

**Author:** [@Julia2001](https://discourse.julialang.org/u/Julia2001)\
**Replies:** 5\
**Last updated:** [March 22, 2024, 12:43am UTC](https://discourse.julialang.org/t/color-conversion-from-terminal-color-to-colors-jl-color/111889 "2024-03-22T00:43:05Z")

</div>

Hi, how can I convert the “one integer” terminal color consumed by printstyled() to a Colors.jl color usable within Luxor e.g.?

---

## [Something wrong with my memory calculation](https://discourse.julialang.org/t/something-wrong-with-my-memory-calculation/111932)

<div class="topic-metadata">

**Author:** [@Clement\_Benoist](https://discourse.julialang.org/u/Clement_Benoist)\
**Replies:** 0\
**Last updated:** [March 21, 2024, 1:35pm UTC](https://discourse.julialang.org/t/something-wrong-with-my-memory-calculation/111932 "2024-03-21T13:35:41Z")

</div>

I’m coding a NeuralODE in Julia and tried to get a memory use data from the program. On python, when I change my adjoint method I get different but consistent (by method) results for my max RSS but on Julia I always get …

---

## [Profiler Timing Related to Line 0](https://discourse.julialang.org/t/profiler-timing-related-to-line-0/71033)

<div class="topic-metadata">

**Author:** [@andrew-saydjari](https://discourse.julialang.org/u/andrew-saydjari)\
**Replies:** 4\
**Last updated:** [March 21, 2024, 11:26am UTC](https://discourse.julialang.org/t/profiler-timing-related-to-line-0/71033 "2024-03-21T11:26:37Z")

</div>

When using the profiler via ProfileSVG I sometimes see significant traceback blocks in the flame graph coming from line “0” of a notebook cell where the function was defined. An recent example is below (sorry for not bei…

---

## [Deployment of my package's documentation fails with github agent](https://discourse.julialang.org/t/deployment-of-my-packages-documentation-fails-with-github-agent/111816)

<div class="topic-metadata">

**Author:** [@hbrochet](https://discourse.julialang.org/u/hbrochet)\
**Replies:** 1\
**Last updated:** [March 21, 2024, 9:22am UTC](https://discourse.julialang.org/t/deployment-of-my-packages-documentation-fails-with-github-agent/111816 "2024-03-21T09:22:24Z")

</div>

Hello, I started writing a julia package and I tried to create a documentation that would be automatically hosted on github using the documenter.jl package. Unfortunately the github agent fails to build the documentati…

---

## [Polychaos.jl for uncertainty propagation - avoiding manual operations with tensors](https://discourse.julialang.org/t/polychaos-jl-for-uncertainty-propagation-avoiding-manual-operations-with-tensors/106794)

<div class="topic-metadata">

**Author:** [@fabmnc](https://discourse.julialang.org/u/fabmnc)\
**Replies:** 8\
**Last updated:** [March 21, 2024, 1:17am UTC](https://discourse.julialang.org/t/polychaos-jl-for-uncertainty-propagation-avoiding-manual-operations-with-tensors/106794 "2024-03-21T01:17:17Z")

</div>

Hi everybody, I am assessing and trying to get my head around different ways of estimating the propagation of the uncertainty in some models (at this point, my testing models are not ODE, they are simple: model(inputs) …

---

## [Looking for SciMLSensitivity Example with LinearSolve](https://discourse.julialang.org/t/looking-for-scimlsensitivity-example-with-linearsolve/111900)

<div class="topic-metadata">

**Author:** [@Mark\_Lau](https://discourse.julialang.org/u/Mark_Lau)\
**Replies:** 3\
**Last updated:** [March 20, 2024, 10:20pm UTC](https://discourse.julialang.org/t/looking-for-scimlsensitivity-example-with-linearsolve/111900 "2024-03-20T22:20:39Z")

</div>

I’m new to SciMLSensitivity.jl and am trying to learn the ropes. I wanted to try something simple to find the sensitivities of the solution to a LinearProblem with respect to parameters. I couldn’t find an example of how…

---

## [Are broadcast-assignment and \`copyto!\` safe with aliasing?](https://discourse.julialang.org/t/are-broadcast-assignment-and-copyto-safe-with-aliasing/111903)

<div class="topic-metadata">

**Author:** [@goerz](https://discourse.julialang.org/u/goerz)\
**Replies:** 1\
**Last updated:** [March 20, 2024, 9:54pm UTC](https://discourse.julialang.org/t/are-broadcast-assignment-and-copyto-safe-with-aliasing/111903 "2024-03-20T21:54:13Z")

</div>

Are broadcast-assignment and copyto! between two AbstractVector objects guaranteed to be safe if the two vectors alias each other (in a non-crazy way)? I’m especially interested if copying from an array into itself is gu…

---

## [What happens if I switch environments after loading a package?](https://discourse.julialang.org/t/what-happens-if-i-switch-environments-after-loading-a-package/111898)

<div class="topic-metadata">

**Author:** [@goerz](https://discourse.julialang.org/u/goerz)\
**Replies:** 2\
**Last updated:** [March 20, 2024, 8:57pm UTC](https://discourse.julialang.org/t/what-happens-if-i-switch-environments-after-loading-a-package/111898 "2024-03-20T20:57:32Z")

</div>

Following up from That seems sketchy. I’m not sure what behavior Julia guarantees if you load a package in one environment and then switch to another environment. What behavior does Julia guarantee in such a situati…

---

## [Can't terminate input for readlines() in VSCode REPL (Windows 10)](https://discourse.julialang.org/t/cant-terminate-input-for-readlines-in-vscode-repl-windows-10/111896)

<div class="topic-metadata">

**Author:** [@olmdshumel](https://discourse.julialang.org/u/olmdshumel)\
**Replies:** 1\
**Last updated:** [March 20, 2024, 8:12pm UTC](https://discourse.julialang.org/t/cant-terminate-input-for-readlines-in-vscode-repl-windows-10/111896 "2024-03-20T20:12:25Z")

</div>

I’m using readlines() to get multi-line input with a non-fixed number of lines of user input from stdin, but I can’t get readlines() to stop taking input. I’ve tried alt+enter, esc+enter, shift+enter, alt+shift+enter, ct…

---

## [Conversion from float to complex?](https://discourse.julialang.org/t/conversion-from-float-to-complex/111890)

<div class="topic-metadata">

**Author:** [@Sarah\_Groves](https://discourse.julialang.org/u/Sarah_Groves)\
**Replies:** 4\
**Last updated:** [March 20, 2024, 7:12pm UTC](https://discourse.julialang.org/t/conversion-from-float-to-complex/111890 "2024-03-20T19:12:42Z")

</div>

I currently have code that takes two arrays, makes a grid of them, and then calculates the square root of the squares of each value: hx = 1 hy = 1 Nx = 16 Ny = 16 x = hx .\* (0:Nx-1) y = hy .\* (0:Ny-1) function meshgrid…

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

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