# General Usage

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

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

**Page:** 307

---

## [Constructing index with broadcasting operators vs loops](https://discourse.julialang.org/t/constructing-index-with-broadcasting-operators-vs-loops/97228)

<div class="topic-metadata">

**Author:** [@fipelle](https://discourse.julialang.org/u/fipelle)\
**Replies:** 2\
**Last updated:** [April 7, 2023, 6:12pm UTC](https://discourse.julialang.org/t/constructing-index-with-broadcasting-operators-vs-loops/97228 "2023-04-07T18:12:47Z")

</div>

Hi, I am playing around with the following code and trying to find the most efficient way to construct indices based on a boolean condition: using BenchmarkTools, Random, Statistics; # Generate data n, m = 10^3, 5 fea…

---

## [Adding performant runtime dispatch to Julia](https://discourse.julialang.org/t/adding-performant-runtime-dispatch-to-julia/97214)

<div class="topic-metadata">

**Author:** [@Tarny\_GG\_Channie](https://discourse.julialang.org/u/Tarny_GG_Channie)\
**Replies:** 3\
**Last updated:** [April 7, 2023, 12:54pm UTC](https://discourse.julialang.org/t/adding-performant-runtime-dispatch-to-julia/97214 "2023-04-07T12:54:53Z")

</div>

While Julia’s compile-time dispatch serves Julia users well, in some cases, runtime dispatch is needed. Runtime dispatch in Julia is not designed to be performant. This proposal attempts to add a limited dispatching (inc…

---

## [If-else loop failure for a large array](https://discourse.julialang.org/t/if-else-loop-failure-for-a-large-array/97180)

<div class="topic-metadata">

**Author:** [@Sh\_166](https://discourse.julialang.org/u/Sh_166)\
**Replies:** 5\
**Last updated:** [April 7, 2023, 8:22am UTC](https://discourse.julialang.org/t/if-else-loop-failure-for-a-large-array/97180 "2023-04-07T08:22:24Z")

</div>

I have the following code: if sol\[5,i\] - sol\_1\[5,i\] \>= 0.0 s\[i\] = sol\[5,i\] - sol\_1\[5,i\] else s\[i\] = sol\_1\[5,i\] - sol\[5,i\] end end Now, here, sol and sol\_1 correspond to 2 solutions I have fr…

---

## [How do you iterate over a vector of ranges of different lengths?](https://discourse.julialang.org/t/how-do-you-iterate-over-a-vector-of-ranges-of-different-lengths/97181)

<div class="topic-metadata">

**Author:** [@AwesomeQuest](https://discourse.julialang.org/u/AwesomeQuest)\
**Replies:** 2\
**Last updated:** [April 6, 2023, 11:23pm UTC](https://discourse.julialang.org/t/how-do-you-iterate-over-a-vector-of-ranges-of-different-lengths/97181 "2023-04-06T23:23:40Z")

</div>

So I have an arbitrary vector of ranges julia\> kthNvals(k) = (1:(2^k)) .- 1; julia\> kthNvals.(1:4) 4-element Vector{UnitRange{Int64}}: 0:1 0:3 0:7 0:15 I need to generate all the vectors where each index is a val…

---

## [Solving two non-linear equations with two variables. Any suggestion?](https://discourse.julialang.org/t/solving-two-non-linear-equations-with-two-variables-any-suggestion/97190)

<div class="topic-metadata">

**Author:** [@Zerosum](https://discourse.julialang.org/u/Zerosum)\
**Replies:** 2\
**Last updated:** [April 6, 2023, 10:43pm UTC](https://discourse.julialang.org/t/solving-two-non-linear-equations-with-two-variables-any-suggestion/97190 "2023-04-06T22:43:42Z")

</div>

I’m trying to solve a system of two non-linear equations with two variables. I understand I can use the NLsolve package, but I was wondering if there is any dimension I can improve to get faster speed. Suppose I have t…

---

## [Julia to SMP2](https://discourse.julialang.org/t/julia-to-smp2/97178)

<div class="topic-metadata">

**Author:** [@xlxs4](https://discourse.julialang.org/u/xlxs4)\
**Replies:** 0\
**Last updated:** [April 6, 2023, 1:38pm UTC](https://discourse.julialang.org/t/julia-to-smp2/97178 "2023-04-06T13:38:48Z")

</div>

I’m about to start working on a space mission and part of what I’ll be doing is create models that can plug in simulator pipelines that take SMP2 as input. There’s solutions such as MOSAIC that transfers Simulink models …

---

## [Can the two sides of a mesh have a different color (e.g., origami paper)?](https://discourse.julialang.org/t/can-the-two-sides-of-a-mesh-have-a-different-color-e-g-origami-paper/97118)

<div class="topic-metadata">

**Author:** [@g2g](https://discourse.julialang.org/u/g2g)\
**Replies:** 5\
**Last updated:** [April 6, 2023, 5:20pm UTC](https://discourse.julialang.org/t/can-the-two-sides-of-a-mesh-have-a-different-color-e-g-origami-paper/97118 "2023-04-06T17:20:47Z")

</div>

\# fold.jl # MWE of moving mesh # # All the paper test sheet's vertices and faces are defined # according to the wavefront 3D object file format by the # following six lines of text: #= v -2.0 0 2.0 v -2.0 0 -2.0 v 2.…

---

## [Pkg test run only one testset](https://discourse.julialang.org/t/pkg-test-run-only-one-testset/96356)

<div class="topic-metadata">

**Author:** [@iskyd](https://discourse.julialang.org/u/iskyd)\
**Replies:** 8\
**Last updated:** [April 6, 2023, 3:49pm UTC](https://discourse.julialang.org/t/pkg-test-run-only-one-testset/96356 "2023-04-06T15:49:38Z")

</div>

I’m developing a package and I have a test folder with a runtest.jl file and other test files. The runtest.jl is the following cd(@\_\_DIR\_\_) using Pkg using Test, TestSetExtensions using Wasabi using Mocking @testset…

---

## [Avoiding numpy with PythonCall](https://discourse.julialang.org/t/avoiding-numpy-with-pythoncall/93505)

<div class="topic-metadata">

**Author:** [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Replies:** 6\
**Last updated:** [April 6, 2023, 3:06pm UTC](https://discourse.julialang.org/t/avoiding-numpy-with-pythoncall/93505 "2023-04-06T15:06:18Z")

</div>

I’m trying to avoid using numpy in the following MWE. The main goal here is to construct the object-points argument, objectPoints, needed in OpenCV’s camera calibration function, calibrateCamera. The following creates …

---

## [Help with Weave.jl](https://discourse.julialang.org/t/help-with-weave-jl/97177)

<div class="topic-metadata">

**Author:** [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Replies:** 4\
**Last updated:** [April 6, 2023, 2:42pm UTC](https://discourse.julialang.org/t/help-with-weave-jl/97177 "2023-04-06T14:42:51Z")

</div>

I’m trying to test out Weave.jl and it works fine when converting to .html, but I can’t get it to convert to .pdf. My project directory looks like this: WeaveTest/ -src/ --main.jl --test.jmd In main.jl, I am calling we…

---

## [Why RSS is much bigger than GC live?](https://discourse.julialang.org/t/why-rss-is-much-bigger-than-gc-live/97175)

<div class="topic-metadata">

**Author:** [@zhijie\_sun](https://discourse.julialang.org/u/zhijie_sun)\
**Replies:** 1\
**Last updated:** [April 6, 2023, 12:43pm UTC](https://discourse.julialang.org/t/why-rss-is-much-bigger-than-gc-live/97175 "2023-04-06T12:43:32Z")

</div>

I used the function mentioned herehttps://discourse.julialang.org/t/how-to-track-total-memory-usage-of-julia-process-over-time/91167/2, meminfo\_julia() and meminfo\_procfs() to get RSS and GC\_live memory, but I found my p…

---

## [Failed to precompile Singular](https://discourse.julialang.org/t/failed-to-precompile-singular/97172)

<div class="topic-metadata">

**Author:** [@Zaineb\_Belafia](https://discourse.julialang.org/u/Zaineb_Belafia)\
**Replies:** 3\
**Last updated:** [April 6, 2023, 2:22pm UTC](https://discourse.julialang.org/t/failed-to-precompile-singular/97172 "2023-04-06T14:22:47Z")

</div>

Hi, I’m new to Julia and having troubles with the compilation of Singular. was able to add the package but it does not precompile. I am far from beeing a computer expert, so I would really much appreciate your help! T…

---

## [PlotlyJS + LaTeXStrings error](https://discourse.julialang.org/t/plotlyjs-latexstrings-error/97054)

<div class="topic-metadata">

**Author:** [@rgouveiamendes](https://discourse.julialang.org/u/rgouveiamendes)\
**Replies:** 9\
**Last updated:** [April 6, 2023, 2:01pm UTC](https://discourse.julialang.org/t/plotlyjs-latexstrings-error/97054 "2023-04-06T14:01:50Z")

</div>

Hi everyone, I am having trouble producing a plot using PlotlyJS and LaTeXStrings. Here it is a simplified version of the code: using DataFrames, PlotlyJS, LaTeXStrings df = DataFrame( country = \[repeat(\["Portuga…

---

## [Interactive Polar heatmap?](https://discourse.julialang.org/t/interactive-polar-heatmap/97157)

<div class="topic-metadata">

**Author:** [@Ertyk](https://discourse.julialang.org/u/Ertyk)\
**Replies:** 0\
**Last updated:** [April 6, 2023, 8:46am UTC](https://discourse.julialang.org/t/interactive-polar-heatmap/97157 "2023-04-06T08:46:03Z")

</div>

Hi, What options are there for interactive polar heatmaps in Julia? Is there any examples creating something like this in e.g. GLMakie? https://docs.juliaplots.org/latest/gallery/gr/generated/gr-ref049/#gr\_ref049

---

## [Does dict's dict cause memory leak?](https://discourse.julialang.org/t/does-dicts-dict-cause-memory-leak/97050)

<div class="topic-metadata">

**Author:** [@zhijie\_sun](https://discourse.julialang.org/u/zhijie_sun)\
**Replies:** 10\
**Last updated:** [April 6, 2023, 8:16am UTC](https://discourse.julialang.org/t/does-dicts-dict-cause-memory-leak/97050 "2023-04-06T08:16:16Z")

</div>

I tried use dict of dict to imitate the sparse matrix’s storage mode, the structure is like Dict{Int64, Dict{Int64, Float64}}, and the outer dict’s key is the colum index of sparse matrix, and inner dict’s key is row ind…

---

## [Query - column names with spaces](https://discourse.julialang.org/t/query-column-names-with-spaces/56232)

<div class="topic-metadata">

**Author:** [@statspy](https://discourse.julialang.org/u/statspy)\
**Replies:** 5\
**Last updated:** [April 6, 2023, 8:11am UTC](https://discourse.julialang.org/t/query-column-names-with-spaces/56232 "2023-04-06T08:11:15Z")

</div>

I have this df: d = DataFrame(Symbol("Full Name") =\> \["Mike","Paul","Andres"\], Symbol("Age") =\> 10:12) so far so good. Now i want to do this Query: using Query @from i in d begin @where i.Age == 11 @select {i."Full Name…

---

## [How to Draw Circuits using Circuits.jl](https://discourse.julialang.org/t/how-to-draw-circuits-using-circuits-jl/87472)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 3\
**Last updated:** [April 6, 2023, 6:25am UTC](https://discourse.julialang.org/t/how-to-draw-circuits-using-circuits-jl/87472 "2023-04-06T06:25:13Z")

</div>

Hi all, I want to draw this I want to try Circuits.jl and try simple example first, but unable to use it, I do not know how to plot it, or is my code is wrong… using Circuits, Plots c = @circuit a:(0,0) --\> Inducto…

---

## [Why I can't find root for transcendental function with SymPy?](https://discourse.julialang.org/t/why-i-cant-find-root-for-transcendental-function-with-sympy/97147)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 0\
**Last updated:** [April 6, 2023, 3:53am UTC](https://discourse.julialang.org/t/why-i-cant-find-root-for-transcendental-function-with-sympy/97147 "2023-04-06T03:53:23Z")

</div>

Hi all, I just want to find the solution / the root for exponential / transcendental function this is the code very simple: using SymPy @syms t solve(15t - 75.8\*exp(-32t/15) + 1150.3~5000,t) it returns Any\[\] , it sh…

---

## [How to Reflect Tangent Line toward $y=x$ axis with CalculusWithJulia?](https://discourse.julialang.org/t/how-to-reflect-tangent-line-toward-y-x-axis-with-calculuswithjulia/95712)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 5\
**Last updated:** [April 6, 2023, 3:49am UTC](https://discourse.julialang.org/t/how-to-reflect-tangent-line-toward-y-x-axis-with-calculuswithjulia/95712 "2023-04-06T03:49:26Z")

</div>

Hi all, I am able to plot reflection of a curve toward y=x axis. But how to reflect a tangent line that went through a certain point to that curve as well? I want a tangent line plotted at (d,c). using Plots, LaTeXStr…

---

## [Adjoint for threaded map (ThreadsX.map)](https://discourse.julialang.org/t/adjoint-for-threaded-map-threadsx-map/97142)

<div class="topic-metadata">

**Author:** [@mfishelson](https://discourse.julialang.org/u/mfishelson)\
**Replies:** 1\
**Last updated:** [April 6, 2023, 2:02am UTC](https://discourse.julialang.org/t/adjoint-for-threaded-map-threadsx-map/97142 "2023-04-06T02:02:43Z")

</div>

I am using Zygote to compute the gradient of a function which calls map(f, x), where applying f to each element of the array x is slow. I would like to speed up the gradient computation by using a threaded map such as Th…

---

## [Who does "better" than DataFrames?](https://discourse.julialang.org/t/who-does-better-than-dataframes/96946)

<div class="topic-metadata">

**Author:** [@rocco\_sprmnt21](https://discourse.julialang.org/u/rocco_sprmnt21)\
**Replies:** 43\
**Last updated:** [April 6, 2023, 12:55am UTC](https://discourse.julialang.org/t/who-does-better-than-dataframes/96946 "2023-04-06T00:55:25Z")

</div>

given a list of observations (simulations, trials, results) find the list of “best” results for each simulation. In the context of DataFrames, using the minilanguage, the problem is solved by calling the following funct…

---

## [Zero elements in sparse matrix](https://discourse.julialang.org/t/zero-elements-in-sparse-matrix/97134)

<div class="topic-metadata">

**Author:** [@Nova](https://discourse.julialang.org/u/Nova)\
**Replies:** 3\
**Last updated:** [April 5, 2023, 9:24pm UTC](https://discourse.julialang.org/t/zero-elements-in-sparse-matrix/97134 "2023-04-05T21:24:39Z")

</div>

How to find the index of zero elements in a sparse matrix efficiently? I have a matrix with a size of 200k by 200k.

---

## [Inplace mutation of DataFrame column of type Missing](https://discourse.julialang.org/t/inplace-mutation-of-dataframe-column-of-type-missing/97109)

<div class="topic-metadata">

**Author:** [@fchichorro](https://discourse.julialang.org/u/fchichorro)\
**Replies:** 3\
**Last updated:** [April 5, 2023, 9:15pm UTC](https://discourse.julialang.org/t/inplace-mutation-of-dataframe-column-of-type-missing/97109 "2023-04-05T21:15:56Z")

</div>

I am updating a CSV file by loading it as a DataFrame, loading it in memory and replacing values where I need. The minimal version of this dataset looks like this: df = CSV.File(IOBuffer("""fruit,count,verifier\\napple,2…

---

## [Shared array between two julia sessions with different pids](https://discourse.julialang.org/t/shared-array-between-two-julia-sessions-with-different-pids/97107)

<div class="topic-metadata">

**Author:** [@andrey2185](https://discourse.julialang.org/u/andrey2185)\
**Replies:** 5\
**Last updated:** [April 5, 2023, 8:18pm UTC](https://discourse.julialang.org/t/shared-array-between-two-julia-sessions-with-different-pids/97107 "2023-04-05T20:18:15Z")

</div>

Process 26012: julia\> using SharedArrays julia\> getpid() 26012 julia\> sa = SharedVector{Int}(4); Process 35208: julia\> using SharedArrays julia\> getpid() 35208 Is there an easy way to get sa from process 26012 in …

---

## [Q | Using Regex and eachmatch() to extract substrings](https://discourse.julialang.org/t/q-using-regex-and-eachmatch-to-extract-substrings/97128)

<div class="topic-metadata">

**Author:** [@Audrius-St](https://discourse.julialang.org/u/Audrius-St)\
**Replies:** 1\
**Last updated:** [April 5, 2023, 8:06pm UTC](https://discourse.julialang.org/t/q-using-regex-and-eachmatch-to-extract-substrings/97128 "2023-04-05T20:06:45Z")

</div>

Hello, I’m using a package \[Form 4.3.0\] for symbolic code optimization that outputs results in C and have written a script to convert the code to Julia. It’s worked to-date, however, I’ve run into a new problem in rece…

---

## [Create periodic signals for simulating system response with lsim](https://discourse.julialang.org/t/create-periodic-signals-for-simulating-system-response-with-lsim/97058)

<div class="topic-metadata">

**Author:** [@lucasmsoares96](https://discourse.julialang.org/u/lucasmsoares96)\
**Replies:** 4\
**Last updated:** [April 5, 2023, 7:37pm UTC](https://discourse.julialang.org/t/create-periodic-signals-for-simulating-system-response-with-lsim/97058 "2023-04-05T19:37:35Z")

</div>

I need to generate a periodic quadratic wave to use as input to the lsim function. In Matlab I can generate this wave with the command: z = tf('z',1); H = (0.05\*(z - 1)) / (z^2 - 1.85\*z + 0.9); \[u,t\] = gensig('square',2…

---

## [Partition of distributed arrays in Julia](https://discourse.julialang.org/t/partition-of-distributed-arrays-in-julia/97122)

<div class="topic-metadata">

**Author:** [@Hana](https://discourse.julialang.org/u/Hana)\
**Replies:** 0\
**Last updated:** [April 5, 2023, 4:40pm UTC](https://discourse.julialang.org/t/partition-of-distributed-arrays-in-julia/97122 "2023-04-05T16:40:48Z")

</div>

0 my problem is to complete partition\_data(strain::AbstractArray, stress::AbstractArray) in Julia. In this function, the strain/stress arguments are Arrays that contain the entire stress and strain data only on the proc…

---

## [Creating sparse diagonal matrix of CuArray](https://discourse.julialang.org/t/creating-sparse-diagonal-matrix-of-cuarray/97108)

<div class="topic-metadata">

**Author:** [@Hemsh94](https://discourse.julialang.org/u/Hemsh94)\
**Replies:** 0\
**Last updated:** [April 5, 2023, 9:40am UTC](https://discourse.julialang.org/t/creating-sparse-diagonal-matrix-of-cuarray/97108 "2023-04-05T09:40:42Z")

</div>

Hello everyone, If we have a vector (u), we can easily convert it into a sparse diagonal matrix using the command spdiagm(u). I want to do the same operation using CUDA where u is defined as CuArray(u). The command spd…

---

## [SMTPClient response status](https://discourse.julialang.org/t/smtpclient-response-status/97089)

<div class="topic-metadata">

**Author:** [@PRCervera](https://discourse.julialang.org/u/PRCervera)\
**Replies:** 1\
**Last updated:** [April 5, 2023, 7:14am UTC](https://discourse.julialang.org/t/smtpclient-response-status/97089 "2023-04-05T07:14:41Z")

</div>

Hi, How can I get resp status , in this funtion, to know if the email has been sending correctly? Are there any options to build similar function? Thank you !!! Julia version 1.8.5 using SMTPClient function Enviar…

---

## [Pure virtual method called terminate called without an active exception](https://discourse.julialang.org/t/pure-virtual-method-called-terminate-called-without-an-active-exception/86536)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 6\
**Last updated:** [April 5, 2023, 5:25am UTC](https://discourse.julialang.org/t/pure-virtual-method-called-terminate-called-without-an-active-exception/86536 "2023-04-05T05:25:41Z")

</div>

I occasionally encounter this error on Julia v1.8 while using a code that calls Folds.map to perform a multi-threaded calculation on one node of a SLURM cluster: pure virtual method called terminate called without an ac…

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

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