# General Usage

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

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

**Page:** 600

---

## [UnicodePlot exercise](https://discourse.julialang.org/t/unicodeplot-exercise/61101)

<div class="topic-metadata">

**Author:** [@weymouth](https://discourse.julialang.org/u/weymouth)\
**Replies:** 9\
**Last updated:** [May 14, 2021, 8:47pm UTC](https://discourse.julialang.org/t/unicodeplot-exercise/61101 "2021-05-14T20:47:19Z")

</div>

I’ve taken up a little challenge to reproduce a classic plot from Chorin 1973 (maybe the first computerized flow plot ever) and I hoped WaterLily.jl + UnicodePlots.jl could make short work of it. However, to really n…

---

## [Piping input and output](https://discourse.julialang.org/t/piping-input-and-output/61157)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 4\
**Last updated:** [May 14, 2021, 5:22pm UTC](https://discourse.julialang.org/t/piping-input-and-output/61157 "2021-05-14T17:22:48Z")

</div>

I would like to do something as simple as: grep AA \< box.inp \> box.out using run. Is the only way to do this one of the cumbersome options discussed here? (meaning using pipeline etc?) Or is there a simple alternative…

---

## [Integrating functions with additional parameters](https://discourse.julialang.org/t/integrating-functions-with-additional-parameters/61169)

<div class="topic-metadata">

**Author:** [@dkiese](https://discourse.julialang.org/u/dkiese)\
**Replies:** 2\
**Last updated:** [May 14, 2021, 4:47pm UTC](https://discourse.julialang.org/t/integrating-functions-with-additional-parameters/61169 "2021-05-14T16:47:22Z")

</div>

Hello everyone, I have a question regarding performance of the following mwe: using BenchmarkTools function integrate!(f!, buf, a, b, N) h = (b - a) / N buf .= 0.0 for i in 1 : N f!(bu…

---

## [Solving Grad-Shafranov Equation with ModelingToolkit](https://discourse.julialang.org/t/solving-grad-shafranov-equation-with-modelingtoolkit/60513)

<div class="topic-metadata">

**Author:** [@lstagner](https://discourse.julialang.org/u/lstagner)\
**Replies:** 19\
**Last updated:** [May 14, 2021, 1:30pm UTC](https://discourse.julialang.org/t/solving-grad-shafranov-equation-with-modelingtoolkit/60513 "2021-05-14T13:30:37Z")

</div>

I am trying to solve the Grad-Shafranov partial differential equation and I am running into the following error using ModelingToolkit R0 = 2.0 C = 1.0 A = 1.0 #ψ(r,z) = (1/2)\*(A\*R0^2 +a0\*r^2)\*z^2 + (1/8)\*(C−a0)(r^2−R0^…

---

## [How to do weighted least squares fit with LsqFit.jl](https://discourse.julialang.org/t/how-to-do-weighted-least-squares-fit-with-lsqfit-jl/61136)

<div class="topic-metadata">

**Author:** [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Replies:** 2\
**Last updated:** [May 14, 2021, 10:54am UTC](https://discourse.julialang.org/t/how-to-do-weighted-least-squares-fit-with-lsqfit-jl/61136 "2021-05-14T10:54:15Z")

</div>

I want to preform a weigted least squares fit with LsqFit.jl The documentation ( Tutorial · LsqFit.jl (julianlsolvers.github.io)) does have a section on it, but no example of curve\_fit() actually being called with a wei…

---

## [New DataFrame whose columns are values of a column and grouped by another column](https://discourse.julialang.org/t/new-dataframe-whose-columns-are-values-of-a-column-and-grouped-by-another-column/61137)

<div class="topic-metadata">

**Author:** [@Ali\_Vahdati](https://discourse.julialang.org/u/Ali_Vahdati)\
**Replies:** 2\
**Last updated:** [May 14, 2021, 10:37am UTC](https://discourse.julialang.org/t/new-dataframe-whose-columns-are-values-of-a-column-and-grouped-by-another-column/61137 "2021-05-14T10:37:30Z")

</div>

How can I convert df1 to df2: julia\> df1 = DataFrame(:name =\> \["a", "b", "c", "c", "a", "b"\], :count =\> \[1,4,3,6,3,7\], :time =\> \[1,1,1,2,2,2\]) 6×3 DataFrame Row │ name count time │ String Int64 Int64 …

---

## [Array equal](https://discourse.julialang.org/t/array-equal/61121)

<div class="topic-metadata">

**Author:** [@Cristian\_Suciava](https://discourse.julialang.org/u/Cristian_Suciava)\
**Replies:** 7\
**Last updated:** [May 14, 2021, 7:07am UTC](https://discourse.julialang.org/t/array-equal/61121 "2021-05-14T07:07:01Z")

</div>

I have a function where I evaluate two arrays. For some reason, I got wrong not equal. Even when I evaluate element by element. What is wrong? Here is my code: Number = 3 n = 15 U = \[1,3,5,7\] ab = V…

---

## [Error while trying to download the Distributions Package on JuliaPro](https://discourse.julialang.org/t/error-while-trying-to-download-the-distributions-package-on-juliapro/60812)

<div class="topic-metadata">

**Author:** [@Diana\_Paola](https://discourse.julialang.org/u/Diana_Paola)\
**Replies:** 9\
**Last updated:** [May 14, 2021, 3:55am UTC](https://discourse.julialang.org/t/error-while-trying-to-download-the-distributions-package-on-juliapro/60812 "2021-05-14T03:55:24Z")

</div>

Hi, I’m pretty new in Julia and I’m trying to download the Distributions Package on JuliaPro 1.5.0-1 and it seems to be an error but I don’t know why :confused: . If anyone can help me because I really need it and I don’…

---

## [Symbolics: How to distinguish unknown type from no method?](https://discourse.julialang.org/t/symbolics-how-to-distinguish-unknown-type-from-no-method/61118)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 0\
**Last updated:** [May 14, 2021, 2:10am UTC](https://discourse.julialang.org/t/symbolics-how-to-distinguish-unknown-type-from-no-method/61118 "2021-05-14T02:10:03Z")

</div>

Symbolics.jl sometimes tells me the types of objects. julia\> Symbolics.Term(sqrt, 2) |\> typeof SymbolicUtils.Term{Real,Nothing} Sometimes it doesn’t know the type of the result. julia\> Symbolics.Term(x-\>x+1, \[2\]) |\> t…

---

## [How to create an SVector of SVectors part II](https://discourse.julialang.org/t/how-to-create-an-svector-of-svectors-part-ii/61109)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 7\
**Last updated:** [May 14, 2021, 12:15am UTC](https://discourse.julialang.org/t/how-to-create-an-svector-of-svectors-part-ii/61109 "2021-05-14T00:15:12Z")

</div>

I have the following code: using BenchmarkTools, StaticArrays if ! @isdefined SEGMENTS const SEGMENTS = 6 end # Type definitions const SimFloat = Float64 const Vec3 = MVector{3, SimFloat} function create\_sta…

---

## [PlotlyJS does not display plot and errors on \`Pkg.test("PlotlyJS")\`](https://discourse.julialang.org/t/plotlyjs-does-not-display-plot-and-errors-on-pkg-test-plotlyjs/57684)

<div class="topic-metadata">

**Author:** [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Replies:** 5\
**Last updated:** [May 13, 2021, 10:24pm UTC](https://discourse.julialang.org/t/plotlyjs-does-not-display-plot-and-errors-on-pkg-test-plotlyjs/57684 "2021-05-13T22:24:55Z")

</div>

This is the first time I use the package PlotlyJS. test PlotlyJS opens an empty window and outputs errors. This is using Julia 1.5.4 on Windows 10. (@v1.5) pkg\> test PlotlyJS Testing PlotlyJS Status \`C:\\Users\\miche…

---

## [Integral of quantum wavefunction](https://discourse.julialang.org/t/integral-of-quantum-wavefunction/61104)

<div class="topic-metadata">

**Author:** [@Rasoul\_Jafarzadeh](https://discourse.julialang.org/u/Rasoul_Jafarzadeh)\
**Replies:** 1\
**Last updated:** [May 13, 2021, 9:54pm UTC](https://discourse.julialang.org/t/integral-of-quantum-wavefunction/61104 "2021-05-13T21:54:01Z")

</div>

Hi. Using QuantumOptics package my code is in this form using QuantumOptics b\_c = FockBasis(10); #Fockbasis (cavity field) b\_a = SpinBasis(1//2); #2-level basis (atom) a = destroy(bc) ⊗ one(ba); σ⁻ = one(bc) ⊗ sigma…

---

## [foo.bar.\<TAB\> Completion Not Working](https://discourse.julialang.org/t/foo-bar-tab-completion-not-working/61052)

<div class="topic-metadata">

**Author:** [@rayegun](https://discourse.julialang.org/u/rayegun)\
**Replies:** 2\
**Last updated:** [May 13, 2021, 7:15pm UTC](https://discourse.julialang.org/t/foo-bar-tab-completion-not-working/61052 "2021-05-13T19:15:17Z")

</div>

I’ve got a type struct Configuration p::Ptr{configuration\_t} key::id\_t end which wraps a nested configuration type from C. I can look up the subkeys of this type with keys(c::Configuration) , and I allow tab c…

---

## [How to preserve default struct help entry while adding something else?](https://discourse.julialang.org/t/how-to-preserve-default-struct-help-entry-while-adding-something-else/61099)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 3\
**Last updated:** [May 13, 2021, 6:36pm UTC](https://discourse.julialang.org/t/how-to-preserve-default-struct-help-entry-while-adding-something-else/61099 "2021-05-13T18:36:24Z")

</div>

If I define a struct without any documentation entry above, I get a nice overview of the fields when searching for help about it, like this: julia\> struct A x::Float64 i::Int end help?\> A searc…

---

## [Surprising dot broadcast result when indices are repeated?](https://discourse.julialang.org/t/surprising-dot-broadcast-result-when-indices-are-repeated/61062)

<div class="topic-metadata">

**Author:** [@hsgg](https://discourse.julialang.org/u/hsgg)\
**Replies:** 9\
**Last updated:** [May 13, 2021, 6:40pm UTC](https://discourse.julialang.org/t/surprising-dot-broadcast-result-when-indices-are-repeated/61062 "2021-05-13T18:40:02Z")

</div>

I am confused about the following code. I have an indexing array pixmap to select which elements to add to: julia\> n = 10 julia\> pixmap = fill(1, n) julia\> v = fill(0, n) julia\> @. v\[pixmap\] += 1 julia\> v 10-element Vec…

---

## [Solving linear system with summed DiffEqOperators](https://discourse.julialang.org/t/solving-linear-system-with-summed-diffeqoperators/60998)

<div class="topic-metadata">

**Author:** [@bclyons12](https://discourse.julialang.org/u/bclyons12)\
**Replies:** 7\
**Last updated:** [May 13, 2021, 4:20pm UTC](https://discourse.julialang.org/t/solving-linear-system-with-summed-diffeqoperators/60998 "2021-05-13T16:20:23Z")

</div>

I’m trying to solve an elliptic differential equation that has multiple derivative terms and wanted to use DiffEqOperators.jl to build the matrices. Is it possible to sum DiffEqOperators and then solve using backslash? W…

---

## [Improving performance of Integral equations (3-Nested loops)](https://discourse.julialang.org/t/improving-performance-of-integral-equations-3-nested-loops/61072)

<div class="topic-metadata">

**Author:** [@Debasish](https://discourse.julialang.org/u/Debasish)\
**Replies:** 4\
**Last updated:** [May 13, 2021, 3:07pm UTC](https://discourse.julialang.org/t/improving-performance-of-integral-equations-3-nested-loops/61072 "2021-05-13T15:07:51Z")

</div>

Dear Julia experts, This is my first ever code in Julia. Why I am switching to Julia? I have used Fortran and Matlab before to write boundary element codes previously. Here is an example https://www.youtube.com/watc…

---

## [Cannot install Images because of unresolved dependancies](https://discourse.julialang.org/t/cannot-install-images-because-of-unresolved-dependancies/35235)

<div class="topic-metadata">

**Author:** [@wizebt](https://discourse.julialang.org/u/wizebt)\
**Replies:** 4\
**Last updated:** [May 13, 2021, 1:42pm UTC](https://discourse.julialang.org/t/cannot-install-images-because-of-unresolved-dependancies/35235 "2021-05-13T13:42:57Z")

</div>

Hi, While reverting from 1.4.0rc1 back to 1.3.0 I deleted the whole .julia dir and reinstalled 1.3.0. Now I cannot install Imges package … What’s appening with Artifacts.toml ^\[\[D Resolving package versions... ERROR: U…

---

## [Do block syntax examples](https://discourse.julialang.org/t/do-block-syntax-examples/40757)

<div class="topic-metadata">

**Author:** [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Replies:** 36\
**Last updated:** [May 13, 2021, 12:09pm UTC](https://discourse.julialang.org/t/do-block-syntax-examples/40757 "2021-05-13T12:09:43Z")

</div>

I know there are some people who are really big fans of the do block syntax for things like map etc. I am trying to get on board but it is usually never the first thing to come to mind when I’m writing code. The only ins…

---

## [Correct preallocation for different Autodiff libraries](https://discourse.julialang.org/t/correct-preallocation-for-different-autodiff-libraries/60707)

<div class="topic-metadata">

**Author:** [@triceert](https://discourse.julialang.org/u/triceert)\
**Replies:** 3\
**Last updated:** [May 13, 2021, 12:07pm UTC](https://discourse.julialang.org/t/correct-preallocation-for-different-autodiff-libraries/60707 "2021-05-13T12:07:59Z")

</div>

I have some quite complex Julia package which I would like to tweak for performance. As I understand, the key for this will be to make the code type-stable and reusing memory, especially for repeatedly called expensive f…

---

## [Can I have a UInt12?](https://discourse.julialang.org/t/can-i-have-a-uint12/60935)

<div class="topic-metadata">

**Author:** [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Replies:** 11\
**Last updated:** [May 13, 2021, 11:59am UTC](https://discourse.julialang.org/t/can-i-have-a-uint12/60935 "2021-05-13T11:59:11Z")

</div>

I need to use a number that has 2^12 discrete levels, i.e. a UInt12. Is there a package that does this (I tried BitIntegers but no joy)?

---

## [HTTP POST xml request with headers and authentification](https://discourse.julialang.org/t/http-post-xml-request-with-headers-and-authentification/61026)

<div class="topic-metadata">

**Author:** [@gitboy16](https://discourse.julialang.org/u/gitboy16)\
**Replies:** 6\
**Last updated:** [May 13, 2021, 11:48am UTC](https://discourse.julialang.org/t/http-post-xml-request-with-headers-and-authentification/61026 "2021-05-13T11:48:23Z")

</div>

Hi, I have the following R code that I use to query an API: httr::RETRY(verb="POST", url= "https://mywebsite.net/view", body = xml\_payload, httr::authenticate("myname","mypassword"), httr::content\_…

---

## [Logo design](https://discourse.julialang.org/t/logo-design/61063)

<div class="topic-metadata">

**Author:** [@chriscoey](https://discourse.julialang.org/u/chriscoey)\
**Replies:** 4\
**Last updated:** [May 13, 2021, 10:45am UTC](https://discourse.julialang.org/t/logo-design/61063 "2021-05-13T10:45:16Z")

</div>

Hi, I noticed various package logos like to incorporate their own take on the colored Julia dots, and I’m just wondering if it is OK to use the following logo that I made for Hypatia.jl: (the Y part is relevant to w…

---

## [Disable secret for pluto.jl notebook](https://discourse.julialang.org/t/disable-secret-for-pluto-jl-notebook/61065)

<div class="topic-metadata">

**Author:** [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Replies:** 4\
**Last updated:** [May 13, 2021, 9:41am UTC](https://discourse.julialang.org/t/disable-secret-for-pluto-jl-notebook/61065 "2021-05-13T09:41:20Z")

</div>

Pluto-notebooks are launched in the default browser. If I want to open the notebook in a different browser, I have to copy the localhost adress from the terminal to include the nessecary secret. I however want to be able…

---

## [Creating a sparse matrix from find operation on dense matrix](https://discourse.julialang.org/t/creating-a-sparse-matrix-from-find-operation-on-dense-matrix/61056)

<div class="topic-metadata">

**Author:** [@bmit](https://discourse.julialang.org/u/bmit)\
**Replies:** 4\
**Last updated:** [May 13, 2021, 2:20am UTC](https://discourse.julialang.org/t/creating-a-sparse-matrix-from-find-operation-on-dense-matrix/61056 "2021-05-13T02:20:04Z")

</div>

I have a large matrix x. I’d like to create a sparse representation of the values that meet a certain criteria, e.g. xi \< 1. I’d like to do something like the following: x = rand(1000, 1000) i = findall(xi -\> xi \< 0.01…

---

## [Getting second derivatives at every possible time point w.r.t. parameters](https://discourse.julialang.org/t/getting-second-derivatives-at-every-possible-time-point-w-r-t-parameters/58130)

<div class="topic-metadata">

**Author:** [@donkeysaddle](https://discourse.julialang.org/u/donkeysaddle)\
**Replies:** 3\
**Last updated:** [May 13, 2021, 1:08am UTC](https://discourse.julialang.org/t/getting-second-derivatives-at-every-possible-time-point-w-r-t-parameters/58130 "2021-05-13T01:08:25Z")

</div>

I have used ODEForwardSensitivityProblem to great effect to get derivatives of the equations in my system w.r.t the parameters at every possible time point. Is there a way to get the Hessian at every possible time point…

---

## [How to create an SVector of SVectors?](https://discourse.julialang.org/t/how-to-create-an-svector-of-svectors/61025)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 4\
**Last updated:** [May 12, 2021, 3:46pm UTC](https://discourse.julialang.org/t/how-to-create-an-svector-of-svectors/61025 "2021-05-12T15:46:01Z")

</div>

The following does not work: using StaticArrays pos=SVector{3, SVector{3,Float64}}(zeros(3,3)) Any idea?

---

## [Approximate set intersection for floating point numbers](https://discourse.julialang.org/t/approximate-set-intersection-for-floating-point-numbers/61047)

<div class="topic-metadata">

**Author:** [@cadojo](https://discourse.julialang.org/u/cadojo)\
**Replies:** 1\
**Last updated:** [May 12, 2021, 9:45pm UTC](https://discourse.julialang.org/t/approximate-set-intersection-for-floating-point-numbers/61047 "2021-05-12T21:45:05Z")

</div>

I have two sets of numbers, say… x = randn(1\_000\_000) |\> Set y = randn(1\_000\_000) |\> Set I’d like to find the approximate intersection of the two sets, to some tolerance. I could… for xi in x for yi in y i…

---

## [Parse a large array of small JSON objects?](https://discourse.julialang.org/t/parse-a-large-array-of-small-json-objects/61040)

<div class="topic-metadata">

**Author:** [@Satvik](https://discourse.julialang.org/u/Satvik)\
**Replies:** 2\
**Last updated:** [May 12, 2021, 8:36pm UTC](https://discourse.julialang.org/t/parse-a-large-array-of-small-json-objects/61040 "2021-05-12T20:36:29Z")

</div>

Hi, I have a DataFrame that contains a column of several million JSON strings, e.g. julia\> DataFrame(j=""""{a": 1, "b": 2}""") julia\> pretty\_table(df) ┌──────────────────┐ │ j │ │ String │ ├───…

---

## [How do I map a build ID to a cache file?](https://discourse.julialang.org/t/how-do-i-map-a-build-id-to-a-cache-file/61044)

<div class="topic-metadata">

**Author:** [@bluesmoon](https://discourse.julialang.org/u/bluesmoon)\
**Replies:** 0\
**Last updated:** [May 12, 2021, 8:08pm UTC](https://discourse.julialang.org/t/how-do-i-map-a-build-id-to-a-cache-file/61044 "2021-05-12T20:08:25Z")

</div>

I’m using Julia 1.5.3 I have a module (DSWB) which depends on another module (HTTP), which in turn depends on another module (MbedTLS@1.0.3). When I call using DSWB in my notebook, Julia tries to precompile, and then g…

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

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