# General Usage

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

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

**Page:** 256

---

## [How to pass additional parameters to curve\_fit in Julia?](https://discourse.julialang.org/t/how-to-pass-additional-parameters-to-curve-fit-in-julia/103031)

<div class="topic-metadata">

**Author:** [@trg818](https://discourse.julialang.org/u/trg818)\
**Replies:** 3\
**Last updated:** [August 22, 2023, 1:00am UTC](https://discourse.julialang.org/t/how-to-pass-additional-parameters-to-curve-fit-in-julia/103031 "2023-08-22T01:00:46Z")

</div>

Hi, I have a dataset that I would like to fit to my function pbase(x,pars) with Julia’s curve\_fit, whereby pars is supposed to contain a non-fitting parameter that controls which functional model is chosen. The function…

---

## [PrecompileTools: precompilation causing allocations in Julia 1.6.7](https://discourse.julialang.org/t/precompiletools-precompilation-causing-allocations-in-julia-1-6-7/103039)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 9\
**Last updated:** [August 22, 2023, 12:45am UTC](https://discourse.julialang.org/t/precompiletools-precompilation-causing-allocations-in-julia-1-6-7/103039 "2023-08-22T00:45:59Z")

</div>

TL;DR: When using PrecompileTools.jl and loading a package in Julia 1.6.7, allocations appear that are not expected in some functions. How can that be? The issue: I know that precompilation makes sense for Julia \>=1.9.…

---

## [Getting started with PrecompileTools (Julia 1.9.2) - how to save precompiled code to disk?](https://discourse.julialang.org/t/getting-started-with-precompiletools-julia-1-9-2-how-to-save-precompiled-code-to-disk/103040)

<div class="topic-metadata">

**Author:** [@pluie](https://discourse.julialang.org/u/pluie)\
**Replies:** 3\
**Last updated:** [August 21, 2023, 9:39pm UTC](https://discourse.julialang.org/t/getting-started-with-precompiletools-julia-1-9-2-how-to-save-precompiled-code-to-disk/103040 "2023-08-21T21:39:38Z")

</div>

The documentation for PrecompileTools states “particularly with Julia 1.9 and higher, the precompiled code can be saved to disk, so that it doesn’t need to be compiled freshly in each Julia session.” It is unclear to me …

---

## [Prevent array re-allocation inside a loop (I am not allowed to allocate before the loop)](https://discourse.julialang.org/t/prevent-array-re-allocation-inside-a-loop-i-am-not-allowed-to-allocate-before-the-loop/103042)

<div class="topic-metadata">

**Author:** [@simon79](https://discourse.julialang.org/u/simon79)\
**Replies:** 10\
**Last updated:** [August 21, 2023, 7:11pm UTC](https://discourse.julialang.org/t/prevent-array-re-allocation-inside-a-loop-i-am-not-allowed-to-allocate-before-the-loop/103042 "2023-08-21T19:11:36Z")

</div>

Hi, I am executing a code similar to the simple one below under the constraint that I cannot allocate anything before the loop due to some constraints of the calling function. for it=1:ntime my\_fun() end where m…

---

## [ApproxFun.jl Spectral method for 2D Helmholtz equation on unbounded domains](https://discourse.julialang.org/t/approxfun-jl-spectral-method-for-2d-helmholtz-equation-on-unbounded-domains/102255)

<div class="topic-metadata">

**Author:** [@mleprovost](https://discourse.julialang.org/u/mleprovost)\
**Replies:** 2\
**Last updated:** [August 21, 2023, 5:50pm UTC](https://discourse.julialang.org/t/approxfun-jl-spectral-method-for-2d-helmholtz-equation-on-unbounded-domains/102255 "2023-08-21T17:50:00Z")

</div>

Hello, I would like to solve the following homogeneous Helmholtz problem with a spectral method on an 2D unbounded domain: (i \\alpha - \\Delta) \\hat{\\omega} = 0, \\;\\alpha \> 0 with a Dirichlet boundary condition for th…

---

## [Type of array containing units from Unitful](https://discourse.julialang.org/t/type-of-array-containing-units-from-unitful/103020)

<div class="topic-metadata">

**Author:** [@Iddingsite](https://discourse.julialang.org/u/Iddingsite)\
**Replies:** 8\
**Last updated:** [August 21, 2023, 3:13pm UTC](https://discourse.julialang.org/t/type-of-array-containing-units-from-unitful/103020 "2023-08-21T15:13:52Z")

</div>

Hello! I am struggling a bit with types coming from Unitful in arrays. Here is a simple MWE: using Unitful array\_unit = \[1.0, 3, 4\]u"yr" If I look at the type of array\_unit, I obtain this: typeof(array\_unit) Vector{…

---

## [Help for improving the performance of my algorithm](https://discourse.julialang.org/t/help-for-improving-the-performance-of-my-algorithm/102907)

<div class="topic-metadata">

**Author:** [@mike\_k](https://discourse.julialang.org/u/mike_k)\
**Replies:** 6\
**Last updated:** [August 21, 2023, 12:52pm UTC](https://discourse.julialang.org/t/help-for-improving-the-performance-of-my-algorithm/102907 "2023-08-21T12:52:06Z")

</div>

I aim to develop a package for solving the standard quadratic optimization problem which maximizes (minimizes) a quadratic form over the unit simplex. That is \\max x^T Q x : \\sum\_{i \\in \[1:n\]} x\_i = 1, x\\in \\mathbb{R}\_+^…

---

## [Not possible to create a post request with more than 268 strings for create\_embeddings() of OpenAI.jl?](https://discourse.julialang.org/t/not-possible-to-create-a-post-request-with-more-than-268-strings-for-create-embeddings-of-openai-jl/102985)

<div class="topic-metadata">

**Author:** [@Alex\_Tantos](https://discourse.julialang.org/u/Alex_Tantos)\
**Replies:** 2\
**Last updated:** [August 21, 2023, 6:15am UTC](https://discourse.julialang.org/t/not-possible-to-create-a-post-request-with-more-than-268-strings-for-create-embeddings-of-openai-jl/102985 "2023-08-21T06:15:26Z")

</div>

Hi there. It seems there is a time or string limit for doing post requests? Although I am able to do a one time request for 1000 strings out of the overview column in R, I cannot do more than 268 right now with OpenAI.j…

---

## [Common allocation mistakes](https://discourse.julialang.org/t/common-allocation-mistakes/66127)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 47\
**Last updated:** [August 21, 2023, 5:42am UTC](https://discourse.julialang.org/t/common-allocation-mistakes/66127 "2023-08-21T05:42:20Z")

</div>

@amrods, splitting here the question you posted. 1. Create a mutable array inside a loop, explicitly: julia\> function f(x) z = 0. for i in 1:10 y = \[ i+1, i+2 \] z += x\[1\]\*y\[1\] + x…

---

## [Solving this without a loop (learning purposes)](https://discourse.julialang.org/t/solving-this-without-a-loop-learning-purposes/103013)

<div class="topic-metadata">

**Author:** [@CodeGodz](https://discourse.julialang.org/u/CodeGodz)\
**Replies:** 14\
**Last updated:** [August 21, 2023, 12:46am UTC](https://discourse.julialang.org/t/solving-this-without-a-loop-learning-purposes/103013 "2023-08-21T00:46:23Z")

</div>

I’m trying to get more familiar with using Transducers.jl or related functions that avoid loops - just to learn. Let’s say I have this simple vector x = Bool\[1,1,0,0,1,1,0,1\] and I want to find the indices of adjacent …

---

## [Construct DataFrame From Uneven Named Tuples](https://discourse.julialang.org/t/construct-dataframe-from-uneven-named-tuples/102970)

<div class="topic-metadata">

**Author:** [@quietlight](https://discourse.julialang.org/u/quietlight)\
**Replies:** 18\
**Last updated:** [August 20, 2023, 4:47pm UTC](https://discourse.julialang.org/t/construct-dataframe-from-uneven-named-tuples/102970 "2023-08-20T16:47:56Z")

</div>

I am trying to construct a DataFrame from an array of named tuples where some key:value pairs may be missing from some tuples. They come from querying Airtable using Airtable,jl. If you have missing values in your table…

---

## [Does redefinition of const variables always create unpredictable behavior?](https://discourse.julialang.org/t/does-redefinition-of-const-variables-always-create-unpredictable-behavior/103001)

<div class="topic-metadata">

**Author:** [@Soldalma](https://discourse.julialang.org/u/Soldalma)\
**Replies:** 6\
**Last updated:** [August 20, 2023, 4:28pm UTC](https://discourse.julialang.org/t/does-redefinition-of-const-variables-always-create-unpredictable-behavior/103001 "2023-08-20T16:28:42Z")

</div>

I have a program that runs fine. I want it to run faster. So I redefined some of its top-level variables to be const, like this const myvar = 1 Now when I run the program I get the following message: WARNING: redefini…

---

## [Any breaking changes in NLopt v1.0.0?](https://discourse.julialang.org/t/any-breaking-changes-in-nlopt-v1-0-0/102988)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 2\
**Last updated:** [August 20, 2023, 2:05pm UTC](https://discourse.julialang.org/t/any-breaking-changes-in-nlopt-v1-0-0/102988 "2023-08-20T14:05:35Z")

</div>

NLopt v1.0.0 just got tagged (:tada:). See Release v1.0.0 · JuliaOpt/NLopt.jl · GitHub. Were there any breaking changes compared to the previous stable version, v0.6.5? This is not transparent from looking at the commit…

---

## [Not getting inline result in VS Code after switching to Julia 1.9.2](https://discourse.julialang.org/t/not-getting-inline-result-in-vs-code-after-switching-to-julia-1-9-2/102916)

<div class="topic-metadata">

**Author:** [@Shuvomoy\_Das\_Gupta](https://discourse.julialang.org/u/Shuvomoy_Das_Gupta)\
**Replies:** 1\
**Last updated:** [August 20, 2023, 11:42am UTC](https://discourse.julialang.org/t/not-getting-inline-result-in-vs-code-after-switching-to-julia-1-9-2/102916 "2023-08-20T11:42:12Z")

</div>

Dear All, After switching to Julia 1.9.2 I am having issues in having inline results in VS Code for some reason. Sometimes it works and sometimes it does not. I have tried removing vs code, removing Julia extension, and…

---

## [Help on changing the color of a poly edge in Makie](https://discourse.julialang.org/t/help-on-changing-the-color-of-a-poly-edge-in-makie/102999)

<div class="topic-metadata">

**Author:** [@marteaua](https://discourse.julialang.org/u/marteaua)\
**Replies:** 0\
**Last updated:** [August 20, 2023, 9:18am UTC](https://discourse.julialang.org/t/help-on-changing-the-color-of-a-poly-edge-in-makie/102999 "2023-08-20T09:18:29Z")

</div>

Hi, I plotted a small 3D mesh using poly in Makie, I use a LScene because I want to put several 3D axis and do camera rotations. I try to change the color of one of the edge of the mesh. My idea is to plot the edge abov…

---

## [Vcat DataFrame columns based on multiple columns in Julia](https://discourse.julialang.org/t/vcat-dataframe-columns-based-on-multiple-columns-in-julia/102932)

<div class="topic-metadata">

**Author:** [@Mark01](https://discourse.julialang.org/u/Mark01)\
**Replies:** 6\
**Last updated:** [August 20, 2023, 8:48am UTC](https://discourse.julialang.org/t/vcat-dataframe-columns-based-on-multiple-columns-in-julia/102932 "2023-08-20T08:48:19Z")

</div>

I have 3 DataFrames, each containing 3 columns: A, B, and C. using DataFrames common\_data = Dict("A" =\> \[1, 2, 3\], "B" =\> \[10, 20, 30\]) df1 = DataFrame(merge(common\_data, Dict("C" =\> \[100, 200, 300\]))) df2 = DataFra…

---

## [Stuck trying to plot data from COM port in real time](https://discourse.julialang.org/t/stuck-trying-to-plot-data-from-com-port-in-real-time/102885)

<div class="topic-metadata">

**Author:** [@rud-lucien](https://discourse.julialang.org/u/rud-lucien)\
**Replies:** 9\
**Last updated:** [August 20, 2023, 1:04am UTC](https://discourse.julialang.org/t/stuck-trying-to-plot-data-from-com-port-in-real-time/102885 "2023-08-20T01:04:46Z")

</div>

I’m trying to plot data coming from the serial port in real-time. Not sure if how I’m doing it the correct approach but this is what I did. I created this module that I call SerialPortReader.jl the code for it is as foll…

---

## [How does type annotation affect the performance?](https://discourse.julialang.org/t/how-does-type-annotation-affect-the-performance/102986)

<div class="topic-metadata">

**Author:** [@Reza-Reza](https://discourse.julialang.org/u/Reza-Reza)\
**Replies:** 5\
**Last updated:** [August 19, 2023, 10:21pm UTC](https://discourse.julialang.org/t/how-does-type-annotation-affect-the-performance/102986 "2023-08-19T22:21:54Z")

</div>

I read that in Julia it’s better to allow more generic type annotation and that type annotation be it done or not does not have an impact on the performance. I think I might have misunderstood what I read. So I did a mic…

---

## [PrecompileTools doesn't cache result of workload if type unstable](https://discourse.julialang.org/t/precompiletools-doesnt-cache-result-of-workload-if-type-unstable/102891)

<div class="topic-metadata">

**Author:** [@tomerarnon](https://discourse.julialang.org/u/tomerarnon)\
**Replies:** 7\
**Last updated:** [August 19, 2023, 7:04pm UTC](https://discourse.julialang.org/t/precompiletools-doesnt-cache-result-of-workload-if-type-unstable/102891 "2023-08-19T19:04:19Z")

</div>

In the following minimal example, foo() isn’t fully precompiled (notice the precompile statement from --trace-compile=stderr) unless I type annotate the type unstable function from Meshes.jl (confirmed type unstable with…

---

## [Is multithreaded FFTW on multiple arrays causing too much overhead?](https://discourse.julialang.org/t/is-multithreaded-fftw-on-multiple-arrays-causing-too-much-overhead/102832)

<div class="topic-metadata">

**Author:** [@erny123](https://discourse.julialang.org/u/erny123)\
**Replies:** 15\
**Last updated:** [August 19, 2023, 6:04pm UTC](https://discourse.julialang.org/t/is-multithreaded-fftw-on-multiple-arrays-causing-too-much-overhead/102832 "2023-08-19T18:04:19Z")

</div>

I have a couple of matrices that I have FFT to computer a nonlinear function and then IFFT. My question: Is using a multithreaded FFT plan creating too much overhead because of each instance the FFTW is called? Is there…

---

## [Speed up solution of large system of equations](https://discourse.julialang.org/t/speed-up-solution-of-large-system-of-equations/102659)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 18\
**Last updated:** [August 19, 2023, 3:19pm UTC](https://discourse.julialang.org/t/speed-up-solution-of-large-system-of-equations/102659 "2023-08-19T15:19:48Z")

</div>

I have a system of equations: \\begin{aligned} & S^m\_{a\_m, e\_m}-\\mu^{0m}\_{a\_m, e\_m}=\\sum\_{a\_m=1}^{46} {\\Pi}\_{a\_m, e\_m, a\_f, e\_f}\\sqrt{S^m\_{a\_m, e\_m} S^f\_{a\_f, e\_f}} \\prod\_{k=0}^{T(a\_m, a\_f)-1}\\left(\\frac{\\mu^{0m}\_{a\_m+k…

---

## [Why \[(a = 1, b = 3), (a = 3, b = 4)\] isa Vector{NamedTuple} -\> false?](https://discourse.julialang.org/t/why-a-1-b-3-a-3-b-4-isa-vector-namedtuple-false/102981)

<div class="topic-metadata">

**Author:** [@andrey2185](https://discourse.julialang.org/u/andrey2185)\
**Replies:** 4\
**Last updated:** [August 19, 2023, 12:44pm UTC](https://discourse.julialang.org/t/why-a-1-b-3-a-3-b-4-isa-vector-namedtuple-false/102981 "2023-08-19T12:44:22Z")

</div>

hello! why ? \[(a = 1, b = 3), (a = 3, b = 4)\] isa Vector{NamedTuple} # -\> false

---

## [Sympy symbol to Symbolics.jl Num: adding a rule](https://discourse.julialang.org/t/sympy-symbol-to-symbolics-jl-num-adding-a-rule/102915)

<div class="topic-metadata">

**Author:** [@jClugstor](https://discourse.julialang.org/u/jClugstor)\
**Replies:** 2\
**Last updated:** [August 18, 2023, 4:53pm UTC](https://discourse.julialang.org/t/sympy-symbol-to-symbolics-jl-num-adding-a-rule/102915 "2023-08-18T16:53:58Z")

</div>

I’m trying to convert a Sympy symbol into a Symbolics.jl Num type. When I use pyconvert\_add\_rule to add the rule, and then try to convert it using pyconvert, it says that it can’t convert the sympy symbol to a Symbolics N…

---

## [Design pattern for undo operation with Makie](https://discourse.julialang.org/t/design-pattern-for-undo-operation-with-makie/102868)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 2\
**Last updated:** [August 18, 2023, 4:30pm UTC](https://discourse.julialang.org/t/design-pattern-for-undo-operation-with-makie/102868 "2023-08-18T16:30:00Z")

</div>

We have GUI program where it would be useful to have an UNDO button: Add undo button · Issue #7 · bradcarman/ModelingToolkitDesigner.jl · GitHub Is there any suggestion how to implement this? EDIT: Article related to C…

---

## [VS Code cannot connect to JuliaHub](https://discourse.julialang.org/t/vs-code-cannot-connect-to-juliahub/102940)

<div class="topic-metadata">

**Author:** [@pascal](https://discourse.julialang.org/u/pascal)\
**Replies:** 1\
**Last updated:** [August 18, 2023, 1:34pm UTC](https://discourse.julialang.org/t/vs-code-cannot-connect-to-juliahub/102940 "2023-08-18T13:34:59Z")

</div>

I don’t seem to get the JuliaHub extension in VS Code to connect to JuliaHub.com. I’ve downloaded the auth.toml token from JuliaHub and placed it in ~/.julia/servers/juliahub.com/auth.toml. And then I installed the Juli…

---

## [Why I am not to update String as value in Dictionary if Dictionary is created with Int64 values](https://discourse.julialang.org/t/why-i-am-not-to-update-string-as-value-in-dictionary-if-dictionary-is-created-with-int64-values/102952)

<div class="topic-metadata">

**Author:** [@saampandit](https://discourse.julialang.org/u/saampandit)\
**Replies:** 1\
**Last updated:** [August 18, 2023, 12:52pm UTC](https://discourse.julialang.org/t/why-i-am-not-to-update-string-as-value-in-dictionary-if-dictionary-is-created-with-int64-values/102952 "2023-08-18T12:52:40Z")

</div>

I am working and learning Dictionaries, now here is what is happening, # Initialize a dictionary d = Dict("a"=\>1, "b" =\> 2, "c" =\> 3) d\["c"\] = 4 # works d\["c"\] = "Hello" # Fails with error pasted below d\["d"\] = "Hello"…

---

## [Distributed-memory parallelism on a shared-memory machine](https://discourse.julialang.org/t/distributed-memory-parallelism-on-a-shared-memory-machine/102883)

<div class="topic-metadata">

**Author:** [@martinmestre](https://discourse.julialang.org/u/martinmestre)\
**Replies:** 10\
**Last updated:** [August 18, 2023, 12:33pm UTC](https://discourse.julialang.org/t/distributed-memory-parallelism-on-a-shared-memory-machine/102883 "2023-08-18T12:33:43Z")

</div>

Thanks a lot. If I have a single processor with 8 logical cores, can I parallelize with multiple processes? I thought that I was forced to do multithreading when there is only one processor with shared memory. Is that ri…

---

## [Overview of different number representations, philosophies and use cases](https://discourse.julialang.org/t/overview-of-different-number-representations-philosophies-and-use-cases/102910)

<div class="topic-metadata">

**Author:** [@i9e1](https://discourse.julialang.org/u/i9e1)\
**Replies:** 6\
**Last updated:** [August 18, 2023, 8:18am UTC](https://discourse.julialang.org/t/overview-of-different-number-representations-philosophies-and-use-cases/102910 "2023-08-18T08:18:04Z")

</div>

Hello, there is some activity to implement different number formats other than Rational and float. All approaches known to me so far try to tackle a fundamental tradeoff: We want our calculations to be fast and accurat…

---

## [Releasing process memory from Arrow.jl](https://discourse.julialang.org/t/releasing-process-memory-from-arrow-jl/102882)

<div class="topic-metadata">

**Author:** [@djholiver](https://discourse.julialang.org/u/djholiver)\
**Replies:** 5\
**Last updated:** [August 17, 2023, 7:23pm UTC](https://discourse.julialang.org/t/releasing-process-memory-from-arrow-jl/102882 "2023-08-17T19:23:40Z")

</div>

Hi, I make heavy use of the (incredible) Arrow.jl package provided by @quinnj to do api - exposed analytics running in docker containers. The files are large: c. 65GB, 35M rows, 250 columns and the analytics queries exe…

---

## [Does Julia do common subexpression elimination?](https://discourse.julialang.org/t/does-julia-do-common-subexpression-elimination/102901)

<div class="topic-metadata">

**Author:** [@deaminase](https://discourse.julialang.org/u/deaminase)\
**Replies:** 5\
**Last updated:** [August 17, 2023, 5:27pm UTC](https://discourse.julialang.org/t/does-julia-do-common-subexpression-elimination/102901 "2023-08-17T17:27:21Z")

</div>

This recent GitHub reads like Julia doesn’t do common subexpression elimination at all, is this a correct assumption? Here’s the relevant bits from the issue: using BenchmarkTools f(x) = exp(x)/(1+exp(x)) function g(x…

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

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