# New to Julia

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

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

**Page:** 58

---

## [Using println to insert string into table](https://discourse.julialang.org/t/using-println-to-insert-string-into-table/109069)

<div class="topic-metadata">

**Author:** [@keynescoefen](https://discourse.julialang.org/u/keynescoefen)\
**Replies:** 3\
**Last updated:** [January 21, 2024, 3:28pm UTC](https://discourse.julialang.org/t/using-println-to-insert-string-into-table/109069 "2024-01-21T15:28:44Z")

</div>

Hello! Can someone explain to me why the command in the second loop produces an error? My hunch is that somehow quotes “” are missing in the println statement. The MWE is here: results\_all\_models = DataFrame( Model = …

---

## [Vectors of vectors : Concatenation](https://discourse.julialang.org/t/vectors-of-vectors-concatenation/109061)

<div class="topic-metadata">

**Author:** [@blociss](https://discourse.julialang.org/u/blociss)\
**Replies:** 6\
**Last updated:** [January 21, 2024, 12:00pm UTC](https://discourse.julialang.org/t/vectors-of-vectors-concatenation/109061 "2024-01-21T12:00:54Z")

</div>

Consider this vector v = \[ (1, \[\[11, 11, 11\], \[12, 12, 12\]\]), (2, \[\[21, 21, 21\], \[22, 22, 22\]\]), (3, \[\[31, 31, 31\], \[32, 32, 32\]\]), (4, \[\[41, 41, 41\], \[42, 42, 42\]\]), \] I want to get from v the followin…

---

## [Using vs include](https://discourse.julialang.org/t/using-vs-include/109036)

<div class="topic-metadata">

**Author:** [@jiang\_ming\_zhang](https://discourse.julialang.org/u/jiang_ming_zhang)\
**Replies:** 4\
**Last updated:** [January 20, 2024, 8:02pm UTC](https://discourse.julialang.org/t/using-vs-include/109036 "2024-01-20T20:02:42Z")

</div>

include("./basis.jl") include("./ham.jl") #using basis #using ham This is the header of a julia script. In the same directory, there are two files basis.jl and ham.jl. To include is just to copy and paste the content o…

---

## [CSV package works in terminal but not in VSCode](https://discourse.julialang.org/t/csv-package-works-in-terminal-but-not-in-vscode/109042)

<div class="topic-metadata">

**Author:** [@keynescoefen](https://discourse.julialang.org/u/keynescoefen)\
**Replies:** 2\
**Last updated:** [January 20, 2024, 4:25pm UTC](https://discourse.julialang.org/t/csv-package-works-in-terminal-but-not-in-vscode/109042 "2024-01-20T16:25:24Z")

</div>

Hello! The following code produces a \`TaskFailedException nested task error: MethodError: Cannot \`convert\` an object of type Missing to an object of type String\` using CSV,DataFrames formal\_orgs = DataFrame(CSV.File("s…

---

## [ALTRO: InexactError: trunc(UInt8, 279)](https://discourse.julialang.org/t/altro-inexacterror-trunc-uint8-279/108954)

<div class="topic-metadata">

**Author:** [@G11](https://discourse.julialang.org/u/G11)\
**Replies:** 1\
**Last updated:** [January 18, 2024, 12:37pm UTC](https://discourse.julialang.org/t/altro-inexacterror-trunc-uint8-279/108954 "2024-01-18T12:37:13Z")

</div>

Hi, I am using the ALTRO package to do trajectory optimization. I get the following InexactError sometimes when I run the code. Sometimes it works fine and there is no error code. Has anybody faced this issue before? Wh…

---

## [Problem installing Julia on Mac](https://discourse.julialang.org/t/problem-installing-julia-on-mac/108948)

<div class="topic-metadata">

**Author:** [@gryumova](https://discourse.julialang.org/u/gryumova)\
**Replies:** 10\
**Last updated:** [January 18, 2024, 10:41am UTC](https://discourse.julialang.org/t/problem-installing-julia-on-mac/108948 "2024-01-18T10:41:04Z")

</div>

Hi all. I was unable to install julia by running the following command curl -fsSL https://install.julialang.org | sh I tried it through JuliaUp, it didn’t help. I was advised to build the image myself using the followi…

---

## [ERROR: DomainError, Complex numbers?](https://discourse.julialang.org/t/error-domainerror-complex-numbers/108923)

<div class="topic-metadata">

**Author:** [@Gast](https://discourse.julialang.org/u/Gast)\
**Replies:** 5\
**Last updated:** [January 17, 2024, 10:35pm UTC](https://discourse.julialang.org/t/error-domainerror-complex-numbers/108923 "2024-01-17T22:35:49Z")

</div>

Hi all! I have a very simple expression similar to: a = b ^ c with b and c as positive floating point numbers. The expression above is part of nested functions (outer and inner functions) with each function defined w…

---

## [Counting the number of appearance of Tuples in a Vector](https://discourse.julialang.org/t/counting-the-number-of-appearance-of-tuples-in-a-vector/108901)

<div class="topic-metadata">

**Author:** [@blociss](https://discourse.julialang.org/u/blociss)\
**Replies:** 8\
**Last updated:** [January 17, 2024, 7:13pm UTC](https://discourse.julialang.org/t/counting-the-number-of-appearance-of-tuples-in-a-vector/108901 "2024-01-17T19:13:48Z")

</div>

Let vec = \[(“A”, “B”), (“A”, “C”), (“A”, “D”), (“B”, “C”), (“B”, “D”)\] be a vector. I want to count the number of appearance of each element at each step in the for loop. function count\_occurrences(vec) vect = \[\] …

---

## [LWFBrook90 simulation question](https://discourse.julialang.org/t/lwfbrook90-simulation-question/104193)

<div class="topic-metadata">

**Author:** [@JOY-8831](https://discourse.julialang.org/u/JOY-8831)\
**Replies:** 8\
**Last updated:** [January 17, 2024, 1:47pm UTC](https://discourse.julialang.org/t/lwfbrook90-simulation-question/104193 "2024-01-17T13:47:19Z")

</div>

Hi I am using LWFBrook 90 v1.9 to simulate the hydro-dynamics. These are the scripts I am using: using LWFBrook90 model1 = loadSPAC(input\_path, input\_prefix; simulate\_isotopes = false); simulation = setup(model1) si…

---

## [OhMyREPL: Bracket completion only when pasting into the REPL via screen](https://discourse.julialang.org/t/ohmyrepl-bracket-completion-only-when-pasting-into-the-repl-via-screen/108882)

<div class="topic-metadata">

**Author:** [@Tetrakai](https://discourse.julialang.org/u/Tetrakai)\
**Replies:** 0\
**Last updated:** [January 16, 2024, 9:37pm UTC](https://discourse.julialang.org/t/ohmyrepl-bracket-completion-only-when-pasting-into-the-repl-via-screen/108882 "2024-01-16T21:37:15Z")

</div>

This would normally work fine: paths = Dict(:A =\> "dirA", :B =\> "dirB") But I wanted to use screen to monitor the REPL session via another device. I then kept getting this error: julia\> paths = Dict(:A…

---

## [Special function (airy function) with arbitrary precision](https://discourse.julialang.org/t/special-function-airy-function-with-arbitrary-precision/108546)

<div class="topic-metadata">

**Author:** [@baizhan](https://discourse.julialang.org/u/baizhan)\
**Replies:** 9\
**Last updated:** [January 16, 2024, 8:31pm UTC](https://discourse.julialang.org/t/special-function-airy-function-with-arbitrary-precision/108546 "2024-01-16T20:31:34Z")

</div>

I am solving equations which requires to evaluate Airy function and its derivative at high precision. Although the package SpecialFunctions provides airyai and airyaiprime function, the airyaiprime does not accept BigF…

---

## [Avoiding certain abstract types in the fields of struct](https://discourse.julialang.org/t/avoiding-certain-abstract-types-in-the-fields-of-struct/108858)

<div class="topic-metadata">

**Author:** [@Maybe](https://discourse.julialang.org/u/Maybe)\
**Replies:** 4\
**Last updated:** [January 16, 2024, 3:58pm UTC](https://discourse.julialang.org/t/avoiding-certain-abstract-types-in-the-fields-of-struct/108858 "2024-01-16T15:58:38Z")

</div>

I am trying to define a struct type for an algebraic functional form that has two “irregular” fields: struct my\_struct vars::NTuple{N, Int} where N func::Union{Function, Nothing} ... end The vars field i…

---

## [Large allocations using @Threads.threads in a loop leads to slow down](https://discourse.julialang.org/t/large-allocations-using-threads-threads-in-a-loop-leads-to-slow-down/102919)

<div class="topic-metadata">

**Author:** [@ahmed](https://discourse.julialang.org/u/ahmed)\
**Replies:** 17\
**Last updated:** [August 19, 2023, 7:52am UTC](https://discourse.julialang.org/t/large-allocations-using-threads-threads-in-a-loop-leads-to-slow-down/102919 "2023-08-19T07:52:07Z")

</div>

I have the following problem that I don’t know how to solve while using multithreading to create a matrix. I have a function that returns the matrix element after operating over arrays that are large in size. I’m using @…

---

## [Code after @sync gets executed while @async blocks are still running](https://discourse.julialang.org/t/code-after-sync-gets-executed-while-async-blocks-are-still-running/108854)

<div class="topic-metadata">

**Author:** [@novalex98](https://discourse.julialang.org/u/novalex98)\
**Replies:** 3\
**Last updated:** [January 16, 2024, 9:15am UTC](https://discourse.julialang.org/t/code-after-sync-gets-executed-while-async-blocks-are-still-running/108854 "2024-01-16T09:15:43Z")

</div>

I am using Distributed.jl and trying to parallelize a for loop on a slurm cluster (Hyak klone at the University of Washington). I mark the loop with the @sync macro, then I enclose its insides in an @async macro. There’s…

---

## [Unable to automatically download/install artifact](https://discourse.julialang.org/t/unable-to-automatically-download-install-artifact/108814)

<div class="topic-metadata">

**Author:** [@TalesOliveira](https://discourse.julialang.org/u/TalesOliveira)\
**Replies:** 3\
**Last updated:** [January 16, 2024, 7:47am UTC](https://discourse.julialang.org/t/unable-to-automatically-download-install-artifact/108814 "2024-01-16T07:47:40Z")

</div>

I’m trying to install the LLVM package for the DataScience, course, but I’m getting this error: ERROR: Unable to automatically download/install artifact 'vegalite\_app' from sources listed in 'C:\\Users\\tales\\.julia\\packa…

---

## [Is there a function for creating n (nearly) evenly-spaced integers for indexing?](https://discourse.julialang.org/t/is-there-a-function-for-creating-n-nearly-evenly-spaced-integers-for-indexing/108744)

<div class="topic-metadata">

**Author:** [@parb](https://discourse.julialang.org/u/parb)\
**Replies:** 35\
**Last updated:** [January 16, 2024, 12:33am UTC](https://discourse.julialang.org/t/is-there-a-function-for-creating-n-nearly-evenly-spaced-integers-for-indexing/108744 "2024-01-16T00:33:09Z")

</div>

Hi all, I’d like to downsample arrays with something like longarray = rand(100) numsamples = 30 sampleindices = evenintegers(1, length(longarray), numsamples) downsampled = longarray\[sampleindices\] I realize its not o…

---

## [Is there a package to compare if two DataFrames are the same?](https://discourse.julialang.org/t/is-there-a-package-to-compare-if-two-dataframes-are-the-same/44381)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 11\
**Last updated:** [January 15, 2024, 3:16pm UTC](https://discourse.julialang.org/t/is-there-a-package-to-compare-if-two-dataframes-are-the-same/44381 "2024-01-15T15:16:05Z")

</div>

Something that has more options than the == in Base for comparing dataframes? E.g. one where you can set the tolerance of difference in a float column. And also can compare columns by name even though they may be arrange…

---

## [Instruct Julia to skip unit testing?](https://discourse.julialang.org/t/instruct-julia-to-skip-unit-testing/69354)

<div class="topic-metadata">

**Author:** [@Niceno](https://discourse.julialang.org/u/Niceno)\
**Replies:** 7\
**Last updated:** [January 15, 2024, 3:07pm UTC](https://discourse.julialang.org/t/instruct-julia-to-skip-unit-testing/69354 "2024-01-15T15:07:33Z")

</div>

Hi everyone, I am new to Julia and few days ago had a moment of delight when I learned that Test package offers a very neat way to include unit testing in your code :slight\_smile: Since then, I was putting @testset an…

---

## [Access each element in the broadcast operation](https://discourse.julialang.org/t/access-each-element-in-the-broadcast-operation/108728)

<div class="topic-metadata">

**Author:** [@Afonso\_Britto](https://discourse.julialang.org/u/Afonso_Britto)\
**Replies:** 6\
**Last updated:** [January 15, 2024, 8:11am UTC](https://discourse.julialang.org/t/access-each-element-in-the-broadcast-operation/108728 "2024-01-15T08:11:03Z")

</div>

Is there anyway I can acess the current element I’m iterating through when I use a broadcast operation? I would want to make this code in just one line, so, for every pixel I’m iterating in my image I would want to perfo…

---

## [Method not found error](https://discourse.julialang.org/t/method-not-found-error/108760)

<div class="topic-metadata">

**Author:** [@temp](https://discourse.julialang.org/u/temp)\
**Replies:** 3\
**Last updated:** [January 14, 2024, 8:37pm UTC](https://discourse.julialang.org/t/method-not-found-error/108760 "2024-01-14T20:37:04Z")

</div>

Hi, I’m new to Julia. I can’t follow what’s going wrong here. When I run the following code in REPL, it is able to run and create a chain of convolution layers: A = Chain(\[Flux.Conv((3,3), 1=\>3, stride=1, pad=2, bias=f…

---

## [How to combine multiple SummaryStats objects into a single DataFrame?](https://discourse.julialang.org/t/how-to-combine-multiple-summarystats-objects-into-a-single-dataframe/108747)

<div class="topic-metadata">

**Author:** [@Tetrakai](https://discourse.julialang.org/u/Tetrakai)\
**Replies:** 4\
**Last updated:** [January 12, 2024, 9:27pm UTC](https://discourse.julialang.org/t/how-to-combine-multiple-summarystats-objects-into-a-single-dataframe/108747 "2024-01-12T21:27:22Z")

</div>

I am apparently still missing some basic data manipulation skills. Is there a quick way to create a dataframe where the first row contains sx, and second row contains sy with the appropriate column names? julia\> using S…

---

## [Parametrize a struct with numbers not types](https://discourse.julialang.org/t/parametrize-a-struct-with-numbers-not-types/108725)

<div class="topic-metadata">

**Author:** [@jiang\_ming\_zhang](https://discourse.julialang.org/u/jiang_ming_zhang)\
**Replies:** 4\
**Last updated:** [January 12, 2024, 6:38pm UTC](https://discourse.julialang.org/t/parametrize-a-struct-with-numbers-not-types/108725 "2024-01-12T18:38:56Z")

</div>

Structs parametrized with types are common, struct coo{T} where {T} x::T y::T end Is it possible to parametrize a struct with numbers, like integers? For example, suppose I want to classify all n-component vector…

---

## [How to use exactly a single Module with a single code?](https://discourse.julialang.org/t/how-to-use-exactly-a-single-module-with-a-single-code/108557)

<div class="topic-metadata">

**Author:** [@aquarelleX332](https://discourse.julialang.org/u/aquarelleX332)\
**Replies:** 10\
**Last updated:** [January 12, 2024, 11:28am UTC](https://discourse.julialang.org/t/how-to-use-exactly-a-single-module-with-a-single-code/108557 "2024-01-12T11:28:18Z")

</div>

I’ve already looked at several tutorials on code layout that are a bit long. But I can’t apply them to my case because I can’t see my mistake. I use Module. Here’s the problem. I have a code that contains a lot of data …

---

## [Color channel](https://discourse.julialang.org/t/color-channel/108714)

<div class="topic-metadata">

**Author:** [@Afonso\_Britto](https://discourse.julialang.org/u/Afonso_Britto)\
**Replies:** 1\
**Last updated:** [January 12, 2024, 9:18am UTC](https://discourse.julialang.org/t/color-channel/108714 "2024-01-12T09:18:22Z")

</div>

I’m learning how to use Julia for image processing. I want to change the values in the color channels. Something like this: red.(j\[:, i\]) .= red.(j\[:, i\]) But I don’t understand why it does not work.

---

## [How to change my Mach number to stop at 2.89 instead of it going higher](https://discourse.julialang.org/t/how-to-change-my-mach-number-to-stop-at-2-89-instead-of-it-going-higher/108699)

<div class="topic-metadata">

**Author:** [@Abood\_123](https://discourse.julialang.org/u/Abood_123)\
**Replies:** 5\
**Last updated:** [January 12, 2024, 2:46am UTC](https://discourse.julialang.org/t/how-to-change-my-mach-number-to-stop-at-2-89-instead-of-it-going-higher/108699 "2024-01-12T02:46:37Z")

</div>

so the graph I’m getting here has a line that goes to up pretty much double the amount that I need it to go to. It’s supposed to stop at 2.893 as that’s the highest Mach number my nozzle goes up to but can’t seem to get …

---

## [How do I edit and test code changes in a package](https://discourse.julialang.org/t/how-do-i-edit-and-test-code-changes-in-a-package/108686)

<div class="topic-metadata">

**Author:** [@Fenrir\_Sivar](https://discourse.julialang.org/u/Fenrir_Sivar)\
**Replies:** 7\
**Last updated:** [January 11, 2024, 8:31pm UTC](https://discourse.julialang.org/t/how-do-i-edit-and-test-code-changes-in-a-package/108686 "2024-01-11T20:31:01Z")

</div>

I’m new to Julia and inherited a package from a work member (the only one with Julia experience around, left the company) I know how to install the package from my git repo, but I have no clue how to make my local chan…

---

## [How to get rid of the straight line?](https://discourse.julialang.org/t/how-to-get-rid-of-the-straight-line/108646)

<div class="topic-metadata">

**Author:** [@kim1](https://discourse.julialang.org/u/kim1)\
**Replies:** 11\
**Last updated:** [January 11, 2024, 6:54pm UTC](https://discourse.julialang.org/t/how-to-get-rid-of-the-straight-line/108646 "2024-01-11T18:54:37Z")

</div>

Hi guys this may sound weird but Im trying to plot my graph without the straight line that connecting to the curve in it, unfortunately I dont know how from my own equation. :joy: so that the result at the end i will get…

---

## [Weird error in Flux model](https://discourse.julialang.org/t/weird-error-in-flux-model/108650)

<div class="topic-metadata">

**Author:** [@artp96](https://discourse.julialang.org/u/artp96)\
**Replies:** 4\
**Last updated:** [January 11, 2024, 11:15am UTC](https://discourse.julialang.org/t/weird-error-in-flux-model/108650 "2024-01-11T11:15:29Z")

</div>

I hate to blindly dump but I’m getting a weird error with this code. I’ve tried looking for something similar, and I’ve spent some time trying to debug it and even asked GPT-4 but I’m stumped. using cuDNN, Flux, CUDA h …

---

## [Should a helper function be defined inside or outside the main function?](https://discourse.julialang.org/t/should-a-helper-function-be-defined-inside-or-outside-the-main-function/108649)

<div class="topic-metadata">

**Author:** [@sadish-d](https://discourse.julialang.org/u/sadish-d)\
**Replies:** 4\
**Last updated:** [January 11, 2024, 7:10am UTC](https://discourse.julialang.org/t/should-a-helper-function-be-defined-inside-or-outside-the-main-function/108649 "2024-01-11T07:10:57Z")

</div>

I have a function f that uses a helper function h (which has no use beyond f). I face the choice of whether to define h inside or outside f. As in: inside function f() h() = ... return h() end outside h() = ... f…

---

## [Fourier expansion package](https://discourse.julialang.org/t/fourier-expansion-package/108621)

<div class="topic-metadata">

**Author:** [@baizhan](https://discourse.julialang.org/u/baizhan)\
**Replies:** 8\
**Last updated:** [January 11, 2024, 1:33am UTC](https://discourse.julialang.org/t/fourier-expansion-package/108621 "2024-01-11T01:33:42Z")

</div>

I have a periodic function, say f(x+T)=f(x), then it can be decomposed into a sum of sin and cos functions. For example, f(x)=\\sum\_{s=-\\infty}^{\\infty}A\_{s}e^{isx}, where A\_{s}=\\frac{1}{T}\\int\_{-T/2}^{T/2}f(x)e^{-is…

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

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