# General Usage

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

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

**Page:** 425

---

## [\`im\` as global constant](https://discourse.julialang.org/t/im-as-global-constant/84055)

<div class="topic-metadata">

**Author:** [@kurt](https://discourse.julialang.org/u/kurt)\
**Replies:** 2\
**Last updated:** [July 11, 2022, 3:22pm UTC](https://discourse.julialang.org/t/im-as-global-constant/84055 "2022-07-11T15:22:10Z")

</div>

Where is im as a global constant defined? I’ve checked base.jl, complex.jl and mathconsts.jl. I cant seem to find it. Help would be appreciated. Thank you

---

## [Analog of \`diff\` operator for adjacent sum](https://discourse.julialang.org/t/analog-of-diff-operator-for-adjacent-sum/84025)

<div class="topic-metadata">

**Author:** [@v715](https://discourse.julialang.org/u/v715)\
**Replies:** 9\
**Last updated:** [July 11, 2022, 1:34pm UTC](https://discourse.julialang.org/t/analog-of-diff-operator-for-adjacent-sum/84025 "2022-07-11T13:34:51Z")

</div>

I want to return the sum of adjacent elements in an array, ie, a function sumadj that produces julia\> a = \[2, 3, 4\] julia\> sumadj(a) 2-element Vector{Int64}: 5 7 diff computes the difference between adjacent pairs o…

---

## [Found Bug in Flux](https://discourse.julialang.org/t/found-bug-in-flux/83483)

<div class="topic-metadata">

**Author:** [@Jack\_N](https://discourse.julialang.org/u/Jack_N)\
**Replies:** 13\
**Last updated:** [July 11, 2022, 2:25pm UTC](https://discourse.julialang.org/t/found-bug-in-flux/83483 "2022-07-11T14:25:29Z")

</div>

My Flux model chain works perfectly when given an input or when calculating the loss of my training data. However, when I try to calculate the gradient my model chain undergoes unexpected behaviour. My input data is a 3…

---

## [How record a chart animation function](https://discourse.julialang.org/t/how-record-a-chart-animation-function/83958)

<div class="topic-metadata">

**Author:** [@evandro.schulz](https://discourse.julialang.org/u/evandro.schulz)\
**Replies:** 7\
**Last updated:** [July 11, 2022, 2:15pm UTC](https://discourse.julialang.org/t/how-record-a-chart-animation-function/83958 "2022-07-11T14:15:29Z")

</div>

Hi, I’m a new user in Julia (but, I have large experience with R and Python). Well, I’m create a function that create a figure (a grid of charts) bellow. The idea is the parameter i is the number of points or simulation…

---

## [Summing an element of tuple](https://discourse.julialang.org/t/summing-an-element-of-tuple/84020)

<div class="topic-metadata">

**Author:** [@Salvatore\_Candita](https://discourse.julialang.org/u/Salvatore_Candita)\
**Replies:** 7\
**Last updated:** [July 11, 2022, 12:08pm UTC](https://discourse.julialang.org/t/summing-an-element-of-tuple/84020 "2022-07-11T12:08:42Z")

</div>

Hi everyone, I’m struggling with the following operation: I have an array of Tuple{Int,String) in which I have to increase by 1 the first element of the tuple but it seems doesn’t work in a while cycle; here the solutio…

---

## [Mixed Subplots Modification for PlotlyJS](https://discourse.julialang.org/t/mixed-subplots-modification-for-plotlyjs/84013)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 1\
**Last updated:** [July 11, 2022, 11:46am UTC](https://discourse.julialang.org/t/mixed-subplots-modification-for-plotlyjs/84013 "2022-07-11T11:46:56Z")

</div>

Hi all, the source is from this site: https://plotly.com/julia/mixed-subplots/ I try to learn and change the csv to become the location of Central Bank for some countries and the reserves of each. I want to modify th…

---

## [Dataframes transform!](https://discourse.julialang.org/t/dataframes-transform/84041)

<div class="topic-metadata">

**Author:** [@jerry\_ji](https://discourse.julialang.org/u/jerry_ji)\
**Replies:** 8\
**Last updated:** [July 11, 2022, 11:28am UTC](https://discourse.julialang.org/t/dataframes-transform/84041 "2022-07-11T11:28:40Z")

</div>

Hello! What is right way to transform an dataframe in place with a function which return multiple columns? I want to write it like transform!(df, :A=\>(x-\>f(x))=\>\[:B,:C\]) but it doesnt work.

---

## [Equivalent of C# enum?](https://discourse.julialang.org/t/equivalent-of-c-enum/83717)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 6\
**Last updated:** [July 11, 2022, 10:51am UTC](https://discourse.julialang.org/t/equivalent-of-c-enum/83717 "2022-07-11T10:51:46Z")

</div>

Does Julia have the equivalent of C# public enum AorB { A = 1, B = 2 } AorB x = AorB.B A variable that can take a fixed set of possib…

---

## [Two questions on package development](https://discourse.julialang.org/t/two-questions-on-package-development/83864)

<div class="topic-metadata">

**Author:** [@\_stla](https://discourse.julialang.org/u/_stla)\
**Replies:** 6\
**Last updated:** [July 11, 2022, 9:28am UTC](https://discourse.julialang.org/t/two-questions-on-package-development/83864 "2022-07-11T09:28:56Z")

</div>

Hello, I’m facing two uncomfortable issues when developing a package: How to install it? Currently I install it from Github with Pkg.add(url = ......). That does not look serious. Once it is installed, I have a pr…

---

## [Plotting with GR broken](https://discourse.julialang.org/t/plotting-with-gr-broken/84036)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 2\
**Last updated:** [July 11, 2022, 9:14am UTC](https://discourse.julialang.org/t/plotting-with-gr-broken/84036 "2022-07-11T09:14:41Z")

</div>

Hi all, I was trying this code (yesterday it was fine): using Plots, LaTeXStrings gr() f(x) = (x^3 - 1) / (x-1) plot( f, 0, 6, legend=false, framestyle=:origin, yticks=(-3:3, \["$i" for i in 0:6\]) ) b…

---

## [Tutorial and best practices for distributed processing with Julia on a cluster](https://discourse.julialang.org/t/tutorial-and-best-practices-for-distributed-processing-with-julia-on-a-cluster/83878)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 4\
**Last updated:** [July 11, 2022, 8:21am UTC](https://discourse.julialang.org/t/tutorial-and-best-practices-for-distributed-processing-with-julia-on-a-cluster/83878 "2022-07-11T08:21:43Z")

</div>

Can anyone provide a tutorial and best practices for running distributed computations on a cluster? In particular using Folds.

---

## [OpenBLAS threads repeatedly call gettimeofday() at the end of a loop](https://discourse.julialang.org/t/openblas-threads-repeatedly-call-gettimeofday-at-the-end-of-a-loop/84027)

<div class="topic-metadata">

**Author:** [@maxwindiff](https://discourse.julialang.org/u/maxwindiff)\
**Replies:** 0\
**Last updated:** [July 11, 2022, 12:52am UTC](https://discourse.julialang.org/t/openblas-threads-repeatedly-call-gettimeofday-at-the-end-of-a-loop/84027 "2022-07-11T00:52:52Z")

</div>

When doing some profiling, I noticed that OpenBLAS threads would make a lot of calls to gettimeofday(), usually at the end of a loop. It happens on both Julia 1.7 and 1.8-rc1. In some of my programs this can add up to 10…

---

## [About .julia directory (conda is around 2 GB)](https://discourse.julialang.org/t/about-julia-directory-conda-is-around-2-gb/84026)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 1\
**Last updated:** [July 10, 2022, 11:44pm UTC](https://discourse.julialang.org/t/about-julia-directory-conda-is-around-2-gb/84026 "2022-07-10T23:44:06Z")

</div>

Hi all, this is important, I was surprised when I checked that .julia has 3 GB of size and conda is the biggest one, if I delete conda will it be okay? If I want packages installed here, can I move the packages folder …

---

## [Plot Map in Julia](https://discourse.julialang.org/t/plot-map-in-julia/84019)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 9\
**Last updated:** [July 10, 2022, 11:08pm UTC](https://discourse.julialang.org/t/plot-map-in-julia/84019 "2022-07-10T23:08:41Z")

</div>

Hi all, I want to know is it possible to plot map with color for different country by using Julia. like this: Each color could represent certain cluster/grouping. I see mapbox is expensive, we need to have credit c…

---

## [Weave.jl just hanging... was working earlier today](https://discourse.julialang.org/t/weave-jl-just-hanging-was-working-earlier-today/83975)

<div class="topic-metadata">

**Author:** [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Replies:** 1\
**Last updated:** [July 10, 2022, 10:04pm UTC](https://discourse.julialang.org/t/weave-jl-just-hanging-was-working-earlier-today/83975 "2022-07-10T22:04:45Z")

</div>

Earlier today weave was happily making output .html files. Now it just hangs at the end of each chunk and waits until i Ctrl-c it goes to the next chunk and hangs there… It actually runs to completion if I include\_weave…

---

## [GpABC package: abc-example fail](https://discourse.julialang.org/t/gpabc-package-abc-example-fail/82708)

<div class="topic-metadata">

**Author:** [@EvaJ\_MathModel](https://discourse.julialang.org/u/EvaJ_MathModel)\
**Replies:** 1\
**Last updated:** [July 10, 2022, 5:42pm UTC](https://discourse.julialang.org/t/gpabc-package-abc-example-fail/82708 "2022-07-10T17:42:42Z")

</div>

I wanted to try Julia GpABC package. There are some examples on GitHub: GpABC.jl/abc-example.ipynb at master · tanhevg/GpABC.jl · GitHub I used the In\[1\] and In\[2\] from the above and then tried to run simulator function…

---

## [Precompile errors with \`pkg\> update\` or \`pkg\> add\` for some packages](https://discourse.julialang.org/t/precompile-errors-with-pkg-update-or-pkg-add-for-some-packages/83917)

<div class="topic-metadata">

**Author:** [@forestacorn](https://discourse.julialang.org/u/forestacorn)\
**Replies:** 4\
**Last updated:** [July 10, 2022, 1:43pm UTC](https://discourse.julialang.org/t/precompile-errors-with-pkg-update-or-pkg-add-for-some-packages/83917 "2022-07-10T13:43:53Z")

</div>

In the package manager I was getting some precompilation errors when trying to update Julia. So I have removed all the offending packages, which included Pluto and tried to add Pluto again with the following result: (@…

---

## [Can we still say that Julia's indexing is one-based?](https://discourse.julialang.org/t/can-we-still-say-that-julias-indexing-is-one-based/84009)

<div class="topic-metadata">

**Author:** [@peterkovesi](https://discourse.julialang.org/u/peterkovesi)\
**Replies:** 8\
**Last updated:** [July 10, 2022, 12:58pm UTC](https://discourse.julialang.org/t/can-we-still-say-that-julias-indexing-is-one-based/84009 "2022-07-10T12:58:17Z")

</div>

I was looking at the Julia Developer Survey 2022 and noted that one-based indexing was a feature of the language that you could choose to like or dislike. In the light of recent discussions here, here, and here and th…

---

## [Questions about the values of @variables in Catalyst/ModelingToolkit](https://discourse.julialang.org/t/questions-about-the-values-of-variables-in-catalyst-modelingtoolkit/83976)

<div class="topic-metadata">

**Author:** [@Wenzhe\_Ma](https://discourse.julialang.org/u/Wenzhe_Ma)\
**Replies:** 7\
**Last updated:** [July 10, 2022, 12:11pm UTC](https://discourse.julialang.org/t/questions-about-the-values-of-variables-in-catalyst-modelingtoolkit/83976 "2022-07-10T12:11:36Z")

</div>

Hello, I have a few seemingly simple questions but just can’t figure out the answer myself. I am using Catalyst to define my model. My first question is how do I find the default values I defined for the variables? for …

---

## [How can I copy a namedtuple or all objects within a namedtuple?](https://discourse.julialang.org/t/how-can-i-copy-a-namedtuple-or-all-objects-within-a-namedtuple/84016)

<div class="topic-metadata">

**Author:** [@JonasG](https://discourse.julialang.org/u/JonasG)\
**Replies:** 4\
**Last updated:** [July 10, 2022, 11:11am UTC](https://discourse.julialang.org/t/how-can-i-copy-a-namedtuple-or-all-objects-within-a-namedtuple/84016 "2022-07-10T11:11:53Z")

</div>

So this should be simple (sorry if it was asked before): I have a namedtuple that saves a bunch of results. Suppose this is: init\_results = (result1 = collect(1:10), result2 = collect(11:20)) How can I copy init\_result…

---

## [Error reordering Schur decomposition](https://discourse.julialang.org/t/error-reordering-schur-decomposition/83948)

<div class="topic-metadata">

**Author:** [@AS90](https://discourse.julialang.org/u/AS90)\
**Replies:** 3\
**Last updated:** [July 10, 2022, 8:28am UTC](https://discourse.julialang.org/t/error-reordering-schur-decomposition/83948 "2022-07-10T08:28:12Z")

</div>

Hello. I wish to suitably reorder the eigenvalues resulting from a generalised Schur matrix decomposition in an ascending fashion. This is the code. using LinearAlgebra A=randn(3, 3); B=randn(3, 3); (S, T, Qt, Z, eS, eT…

---

## [Performance of recursive function](https://discourse.julialang.org/t/performance-of-recursive-function/83961)

<div class="topic-metadata">

**Author:** [@Fabrice\_Rosay](https://discourse.julialang.org/u/Fabrice_Rosay)\
**Replies:** 12\
**Last updated:** [July 10, 2022, 7:58am UTC](https://discourse.julialang.org/t/performance-of-recursive-function/83961 "2022-07-10T07:58:48Z")

</div>

Hi, I have the following recursive function to calculate the number of positions in a game. All functions inside perft (play, gen\_moves, isOver) are non allocating, yet perft allocates a lot of memory. Using the track…

---

## [REPL tab completion](https://discourse.julialang.org/t/repl-tab-completion/84000)

<div class="topic-metadata">

**Author:** [@hros](https://discourse.julialang.org/u/hros)\
**Replies:** 2\
**Last updated:** [July 10, 2022, 7:53am UTC](https://discourse.julialang.org/t/repl-tab-completion/84000 "2022-07-10T07:53:52Z")

</div>

when typing a function name directly (without spaces) after an operator which is not a “standard operator” (e.g., +, -, \*, /, ^, =) auto completion does not work. This applies both to built-in operators (e.g., ÷, ⊻, ∈, …

---

## [How to benchmark @distributed block?](https://discourse.julialang.org/t/how-to-benchmark-distributed-block/83973)

<div class="topic-metadata">

**Author:** [@v715](https://discourse.julialang.org/u/v715)\
**Replies:** 4\
**Last updated:** [July 9, 2022, 10:37pm UTC](https://discourse.julialang.org/t/how-to-benchmark-distributed-block/83973 "2022-07-09T22:37:23Z")

</div>

The following code works: using Distributed @time @distributed for i in 1:10000 i \* 2 end 0.008885 seconds (8.50 k allocations: 492.944 KiB, 99.20% compilation time) Task (done) @0x0000000109e9a6e0 But this cau…

---

## [Plot from DataFrames using StatsPlots](https://discourse.julialang.org/t/plot-from-dataframes-using-statsplots/83991)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 1\
**Last updated:** [July 9, 2022, 5:56pm UTC](https://discourse.julialang.org/t/plot-from-dataframes-using-statsplots/83991 "2022-07-09T17:56:53Z")

</div>

Hi all, I just learn about using csv and create dataframe. This is my code: using CSV using DataFrames df = CSV.read("/home/browni/LasthrimProjection/importedenergydata.csv", DataFrame) print(df) Now, I want to pl…

---

## [Alias a struct using it's own field](https://discourse.julialang.org/t/alias-a-struct-using-its-own-field/83990)

<div class="topic-metadata">

**Author:** [@moataz-sabry](https://discourse.julialang.org/u/moataz-sabry)\
**Replies:** 4\
**Last updated:** [July 9, 2022, 3:08pm UTC](https://discourse.julialang.org/t/alias-a-struct-using-its-own-field/83990 "2022-07-09T15:08:39Z")

</div>

let’s say I have the following struct: struct Dog name age end then I wanted to create an array of dogs like the following: array = \[Dog(:Jack, 2), Dog(:Max, 3)\] 2-element Vector{Dog}: Dog(:Jack, 2) Dog(:Ma…

---

## [The tooling barriers to writing+publishing a package](https://discourse.julialang.org/t/the-tooling-barriers-to-writing-publishing-a-package/83986)

<div class="topic-metadata">

**Author:** [@evanfields](https://discourse.julialang.org/u/evanfields)\
**Replies:** 5\
**Last updated:** [July 9, 2022, 2:47pm UTC](https://discourse.julialang.org/t/the-tooling-barriers-to-writing-publishing-a-package/83986 "2022-07-09T14:47:36Z")

</div>

In the Julia community, we proudly say that the line between a developer and a user is thin. This is partially true: Julia packages mostly don’t have a two language problem, and \]dev makes it easy to start tinkering arou…

---

## [Makie error: scatter! not defined](https://discourse.julialang.org/t/makie-error-scatter-not-defined/83952)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 5\
**Last updated:** [July 9, 2022, 10:42am UTC](https://discourse.julialang.org/t/makie-error-scatter-not-defined/83952 "2022-07-09T10:42:35Z")

</div>

Can anyone help? I get an error of: LoadError: UndefVarError: scatter! not defined when I run this code: using Makie f(x,y) = cos(x)\*cos(y)\*sqrt(x^2 + y^2) x = range(-5, length = 100, stop = 5) y = range(-5, length …

---

## [Why is this function valid julia syntax?](https://discourse.julialang.org/t/why-is-this-function-valid-julia-syntax/83984)

<div class="topic-metadata">

**Author:** [@lukas.grunwald](https://discourse.julialang.org/u/lukas.grunwald)\
**Replies:** 1\
**Last updated:** [July 9, 2022, 9:44am UTC](https://discourse.julialang.org/t/why-is-this-function-valid-julia-syntax/83984 "2022-07-09T09:44:33Z")

</div>

The following function is valid julia code (in the sense that there is no parsing error) function temp(x::AbstractArray) x\[1\] = 1 + return nothing # This is the same as writing x\[1\] = 1 + return nothing end which …

---

## [Question about XLSX?](https://discourse.julialang.org/t/question-about-xlsx/83931)

<div class="topic-metadata">

**Author:** [@Raymond](https://discourse.julialang.org/u/Raymond)\
**Replies:** 5\
**Last updated:** [July 9, 2022, 7:10am UTC](https://discourse.julialang.org/t/question-about-xlsx/83931 "2022-07-09T07:10:25Z")

</div>

Dear all, What’s wrong with this error? julia\> XLSX.readtable("AREAER.xlsx", "Sheet1") ERROR: Shared Strings Table not found for this workbook. Stacktrace: \[1\] error(s::String) @ Base ./error.jl:33 \[2\] sst\_load…

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

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