# General Usage

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

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

**Page:** 728

---

## [Tuple reverse is not type-stable enough](https://discourse.julialang.org/t/tuple-reverse-is-not-type-stable-enough/43005)

<div class="topic-metadata">

**Author:** [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Replies:** 4\
**Last updated:** [July 13, 2020, 9:59pm UTC](https://discourse.julialang.org/t/tuple-reverse-is-not-type-stable-enough/43005 "2020-07-13T21:59:31Z")

</div>

I just start with an MWE: # julia 1.4 # \]add AxisKeys using AxisKeys using Test # "more" type-stable version of reverse reverse\_tuple(x) = ntuple(i -\> x\[length(x) + 1 - i\], length(x)) f1(nt) = NamedDimsArray(zeros(1,1…

---

## [Can Julia solve a nonlinear system of equation which nests a linear programming problem?](https://discourse.julialang.org/t/can-julia-solve-a-nonlinear-system-of-equation-which-nests-a-linear-programming-problem/42925)

<div class="topic-metadata">

**Author:** [@SOtani](https://discourse.julialang.org/u/SOtani)\
**Replies:** 4\
**Last updated:** [July 13, 2020, 6:21pm UTC](https://discourse.julialang.org/t/can-julia-solve-a-nonlinear-system-of-equation-which-nests-a-linear-programming-problem/42925 "2020-07-13T18:21:01Z")

</div>

I am trying to find a “real-valued” solution of a fixed point problem which nests a constrained linear programming problem by using NLsolve.jl and Gurobi.jl. Concretely, the outer problem is a nonlinear system of equatio…

---

## [ERROR: KeyError: key OpenStreetMapX \[5c67c38e-c187-11e8-2be6-e3a6a3a5610f\] not found](https://discourse.julialang.org/t/error-keyerror-key-openstreetmapx-5c67c38e-c187-11e8-2be6-e3a6a3a5610f-not-found/21275)

<div class="topic-metadata">

**Author:** [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Replies:** 39\
**Last updated:** [July 13, 2020, 4:58pm UTC](https://discourse.julialang.org/t/error-keyerror-key-openstreetmapx-5c67c38e-c187-11e8-2be6-e3a6a3a5610f-not-found/21275 "2020-07-13T16:58:15Z")

</div>

I’m using Julia 1.0.3. The following is the code. julia\> using OpenStreetMapX julia\> m=get\_map\_data("output.osm") ERROR: KeyError: key OpenStreetMapX \[5c67c38e-c187-11e8-2be6-e3a6a3a5610f\] not found Stacktrace: \[1\] ge…

---

## [Take numbers form two intervals in concentric circles](https://discourse.julialang.org/t/take-numbers-form-two-intervals-in-concentric-circles/42045)

<div class="topic-metadata">

**Author:** [@mors](https://discourse.julialang.org/u/mors)\
**Replies:** 3\
**Last updated:** [July 13, 2020, 2:51pm UTC](https://discourse.julialang.org/t/take-numbers-form-two-intervals-in-concentric-circles/42045 "2020-07-13T14:51:21Z")

</div>

I am trying to take numbers from two intervals in Julia. The problem is the following, I am trying to create concentric circles and I need to generate vectors of dimension equal to 15 filled with numbers taken from each …

---

## ["julia"' is not recognized as an internal or external command, operable program or batch file](https://discourse.julialang.org/t/julia-is-not-recognized-as-an-internal-or-external-command-operable-program-or-batch-file/42983)

<div class="topic-metadata">

**Author:** [@Kleophas\_Mundjele](https://discourse.julialang.org/u/Kleophas_Mundjele)\
**Replies:** 1\
**Last updated:** [July 13, 2020, 2:44pm UTC](https://discourse.julialang.org/t/julia-is-not-recognized-as-an-internal-or-external-command-operable-program-or-batch-file/42983 "2020-07-13T14:44:24Z")

</div>

Hi I am trying to load atom on julia, but not succeeding. I am getting this Julia could not be started. ‘“julia”’ is not recognized as an internal or external command, operable program or batch file. We tried to laun…

---

## [Truncating the string length in Formatting.jl](https://discourse.julialang.org/t/truncating-the-string-length-in-formatting-jl/42834)

<div class="topic-metadata">

**Author:** [@pauljurczak](https://discourse.julialang.org/u/pauljurczak)\
**Replies:** 1\
**Last updated:** [July 13, 2020, 2:23pm UTC](https://discourse.julialang.org/t/truncating-the-string-length-in-formatting-jl/42834 "2020-07-13T14:23:27Z")

</div>

In this snippet: using Formatting s = "123456789" printfmtln("{}--{:6.6s}", s, s) I would like the second occurrence of s to be truncated to 6 characters, but I’m getting: 123456789--123456789 Is there a format defi…

---

## [Repeated vector vector multiplication to obtain matrix](https://discourse.julialang.org/t/repeated-vector-vector-multiplication-to-obtain-matrix/42980)

<div class="topic-metadata">

**Author:** [@morkip](https://discourse.julialang.org/u/morkip)\
**Replies:** 4\
**Last updated:** [July 13, 2020, 2:09pm UTC](https://discourse.julialang.org/t/repeated-vector-vector-multiplication-to-obtain-matrix/42980 "2020-07-13T14:09:32Z")

</div>

In my application I am running many iterations of a multiplication like this mat = vec1 .\* vec2'. The current implementation is like this dP\_dw = zeros(Float64, (number\_of\_states, settings.n\_vis \* 2, settings.n\_hid)) f…

---

## [Program Structure when muliple routines need to access State](https://discourse.julialang.org/t/program-structure-when-muliple-routines-need-to-access-state/42918)

<div class="topic-metadata">

**Author:** [@pyrex41](https://discourse.julialang.org/u/pyrex41)\
**Replies:** 2\
**Last updated:** [July 13, 2020, 1:24pm UTC](https://discourse.julialang.org/t/program-structure-when-muliple-routines-need-to-access-state/42918 "2020-07-13T13:24:01Z")

</div>

I have a program where I have an input feed (via ZMQ) that constantly updates an Array to maintain current state. I have other processes (either separate Tasks via @async or maybe on other threads via multithreading, sti…

---

## [How to duplicate stdout/stderr?](https://discourse.julialang.org/t/how-to-duplicate-stdout-stderr/42970)

<div class="topic-metadata">

**Author:** [@Samuel\_Ainsworth](https://discourse.julialang.org/u/Samuel_Ainsworth)\
**Replies:** 1\
**Last updated:** [July 13, 2020, 8:37am UTC](https://discourse.julialang.org/t/how-to-duplicate-stdout-stderr/42970 "2020-07-13T08:37:57Z")

</div>

I’m looking for a way to duplicate stdout/stderr. I’m aware of I/O and Network · The Julia Language which is great, but unfortunately it captures stdout instead of duplicating it. In python I use: logfile = tempfile.Na…

---

## [Macro that defines function](https://discourse.julialang.org/t/macro-that-defines-function/42969)

<div class="topic-metadata">

**Author:** [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Replies:** 2\
**Last updated:** [July 13, 2020, 5:48am UTC](https://discourse.julialang.org/t/macro-that-defines-function/42969 "2020-07-13T05:48:53Z")

</div>

This doesn’t work. What’s the reason why I can’t define a function as expanded from a macro? Or did I do something wrong? module C macro makefunc(ex) return quote wat() = $(esc(ex)) e…

---

## [Poor performance multiplying many (large) matrices multithreaded](https://discourse.julialang.org/t/poor-performance-multiplying-many-large-matrices-multithreaded/42866)

<div class="topic-metadata">

**Author:** [@biona001](https://discourse.julialang.org/u/biona001)\
**Replies:** 11\
**Last updated:** [July 13, 2020, 1:30am UTC](https://discourse.julialang.org/t/poor-performance-multiplying-many-large-matrices-multithreaded/42866 "2020-07-13T01:30:12Z")

</div>

I am trying to multiply a bunch of (large and differently sized) matrices, and then do some reduction following each multiply. Basically I tried to do this in a multithreaded loop, where I see good speed gains for small…

---

## [How we can write quadratic equation (Mathematical functions) In Julia](https://discourse.julialang.org/t/how-we-can-write-quadratic-equation-mathematical-functions-in-julia/37409)

<div class="topic-metadata">

**Author:** [@Neeraj\_Verma\_ASETRAI](https://discourse.julialang.org/u/Neeraj_Verma_ASETRAI)\
**Replies:** 3\
**Last updated:** [April 14, 2020, 10:17pm UTC](https://discourse.julialang.org/t/how-we-can-write-quadratic-equation-mathematical-functions-in-julia/37409 "2020-04-14T22:17:06Z")

</div>

Suppose i wanted to write a fun y = x^2+1 and wanted to plot in scatter. So how can i plot this in Julia? i tried this method but didn’t work y(x) = x^2+1 x = 1:10 scatter(x,y(x))

---

## [Using DiffEq isoutofdomain to enforce positivity](https://discourse.julialang.org/t/using-diffeq-isoutofdomain-to-enforce-positivity/42443)

<div class="topic-metadata">

**Author:** [@emily\_dj](https://discourse.julialang.org/u/emily_dj)\
**Replies:** 13\
**Last updated:** [July 12, 2020, 6:24pm UTC](https://discourse.julialang.org/t/using-diffeq-isoutofdomain-to-enforce-positivity/42443 "2020-07-12T18:24:11Z")

</div>

I’m trying to enforce positivity of my solution using the isoutofdomain solver option in the DifferentialEquations package, yet it seems that an error within my derivative function (which requires positivity at the time …

---

## [Abnormally exit after executed a very simple expression](https://discourse.julialang.org/t/abnormally-exit-after-executed-a-very-simple-expression/42930)

<div class="topic-metadata">

**Author:** [@astrojhgu](https://discourse.julialang.org/u/astrojhgu)\
**Replies:** 4\
**Last updated:** [July 12, 2020, 3:47pm UTC](https://discourse.julialang.org/t/abnormally-exit-after-executed-a-very-simple-expression/42930 "2020-07-12T15:47:56Z")

</div>

Update: After ugrade to 1.4.2 this error disappears. Following is the original post, which happens under 1.4.1 I’m using Julia 1.4.1 inside a singularity+ubuntu20.04 container Most of the behaviours are normal, but If I…

---

## [Exporting to pdf with GR results in font size 1.5 larger](https://discourse.julialang.org/t/exporting-to-pdf-with-gr-results-in-font-size-1-5-larger/42953)

<div class="topic-metadata">

**Author:** [@yanivab](https://discourse.julialang.org/u/yanivab)\
**Replies:** 0\
**Last updated:** [July 12, 2020, 3:41pm UTC](https://discourse.julialang.org/t/exporting-to-pdf-with-gr-results-in-font-size-1-5-larger/42953 "2020-07-12T15:41:59Z")

</div>

Hello, I’m using Plots.jl with GR for plotting, and trying to export my figures to pdf. I set font size using the theme command: theme(:default, xguidefontsize=9, yguidefontsize=9, xtickfontsize=7, ytickfontsize=7, …

---

## [Installing PyCall](https://discourse.julialang.org/t/installing-pycall/42952)

<div class="topic-metadata">

**Author:** [@marouane1994](https://discourse.julialang.org/u/marouane1994)\
**Replies:** 0\
**Last updated:** [July 12, 2020, 3:10pm UTC](https://discourse.julialang.org/t/installing-pycall/42952 "2020-07-12T15:10:37Z")

</div>

For some reason the build of PyCall takes forever on my PC and the reason is unknown, it stops at Building PyCall → C:\\Users\\Administrator.julia\\packages\\PyCall\\zqDXB\\deps\\build.log\` any idea why it’s taking forever to …

---

## [Why does Core.Compiler.return\_type expect function instance instead of function type?](https://discourse.julialang.org/t/why-does-core-compiler-return-type-expect-function-instance-instead-of-function-type/42521)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 11\
**Last updated:** [July 12, 2020, 2:29pm UTC](https://discourse.julialang.org/t/why-does-core-compiler-return-type-expect-function-instance-instead-of-function-type/42521 "2020-07-12T14:29:28Z")

</div>

While Core.Compiler.return\_type can give imprecise results, it is quite handy from time to time. Today my question is not about its usage, however about why the first argument - the function - is different compared to th…

---

## [What are the functions defined inside other functions called?](https://discourse.julialang.org/t/what-are-the-functions-defined-inside-other-functions-called/42915)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 6\
**Last updated:** [July 12, 2020, 1:40pm UTC](https://discourse.julialang.org/t/what-are-the-functions-defined-inside-other-functions-called/42915 "2020-07-12T13:40:41Z")

</div>

I’ve been looking for “nested” or “inner” or “subfunction” in the manual: no hits. Does anyone remember?

---

## [What does \`|\>\` mean?](https://discourse.julialang.org/t/what-does-mean/42880)

<div class="topic-metadata">

**Author:** [@Gus\_Hart](https://discourse.julialang.org/u/Gus_Hart)\
**Replies:** 12\
**Last updated:** [July 12, 2020, 11:59am UTC](https://discourse.julialang.org/t/what-does-mean/42880 "2020-07-12T11:59:29Z")

</div>

I saw this syntax during a Juliacon2018 video that I was watching. It was unfamiliar to me, so I tried to find it in the documentation, but the search functionality didn’t send me anywhere useful. I scrolled through diff…

---

## [Spetrum method and DifferentialEquaitons](https://discourse.julialang.org/t/spetrum-method-and-differentialequaitons/42919)

<div class="topic-metadata">

**Author:** [@hzgzh](https://discourse.julialang.org/u/hzgzh)\
**Replies:** 2\
**Last updated:** [July 12, 2020, 6:29am UTC](https://discourse.julialang.org/t/spetrum-method-and-differentialequaitons/42919 "2020-07-12T06:29:51Z")

</div>

Hi, I use Differentialequantions to solve the pde, \\left\\{\\begin{array}{l} \\frac{\\partial u}{\\partial t}=\\varepsilon \\frac{\\partial^{2} u}{\\partial x^{2}}+u-u^{3}, \\quad-1\<x\<1 \\\\ \\left.u\\right|\_{x=\\pm 1}=\\pm 1 \\\\ \\lef…

---

## [Include new test Project file logic also into 1.0?](https://discourse.julialang.org/t/include-new-test-project-file-logic-also-into-1-0/42896)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 3\
**Last updated:** [July 12, 2020, 6:24am UTC](https://discourse.julialang.org/t/include-new-test-project-file-logic-also-into-1-0/42896 "2020-07-12T06:24:38Z")

</div>

Hi, I just stumbled upon the switch in the recommendation about where to configure test dependencies. https://julialang.github.io/Pkg.jl/v1/creating-packages/#Test-specific-dependencies-in-Julia-1.2-and-above-1 Apparen…

---

## [What parts of .julia can be read-only?](https://discourse.julialang.org/t/what-parts-of-julia-can-be-read-only/42922)

<div class="topic-metadata">

**Author:** [@denizyuret](https://discourse.julialang.org/u/denizyuret)\
**Replies:** 0\
**Last updated:** [July 12, 2020, 5:18am UTC](https://discourse.julialang.org/t/what-parts-of-julia-can-be-read-only/42922 "2020-07-12T05:18:42Z")

</div>

I am trying to setup a read-only central Julia repository in our GPU cluster using JULIA\_DEPOT\_PATH. However I keep getting errors with certain operations on client machines. As I get errors I symlink directories such as…

---

## [ArchGDAL.jl install error,](https://discourse.julialang.org/t/archgdal-jl-install-error/42761)

<div class="topic-metadata">

**Author:** [@zhangliye](https://discourse.julialang.org/u/zhangliye)\
**Replies:** 5\
**Last updated:** [July 12, 2020, 12:20am UTC](https://discourse.julialang.org/t/archgdal-jl-install-error/42761 "2020-07-12T00:20:49Z")

</div>

I got the current error after installing ArchGDAL.jl. It works last week, and got the error one today. I have run rm ArchGDAL and run ‘add ArchGDAL’, the error is still the same. using ArchGDAL \[ Info: Precompiling Ar…

---

## [Object lifetime problem with CxxWrap and make\_const\_array](https://discourse.julialang.org/t/object-lifetime-problem-with-cxxwrap-and-make-const-array/40991)

<div class="topic-metadata">

**Author:** [@Josiah\_Slack](https://discourse.julialang.org/u/Josiah_Slack)\
**Replies:** 10\
**Last updated:** [July 11, 2020, 10:35pm UTC](https://discourse.julialang.org/t/object-lifetime-problem-with-cxxwrap-and-make-const-array/40991 "2020-07-11T22:35:03Z")

</div>

I’m experimenting with using CxxWrap to connect an existing C++ library to a Julia project. There’s a particular case I’m looking at right now - there’s a C++ object that has a std::vector as a data member which I want t…

---

## [Question about time series clustering](https://discourse.julialang.org/t/question-about-time-series-clustering/42895)

<div class="topic-metadata">

**Author:** [@abcde](https://discourse.julialang.org/u/abcde)\
**Replies:** 12\
**Last updated:** [July 11, 2020, 3:00pm UTC](https://discourse.julialang.org/t/question-about-time-series-clustering/42895 "2020-07-11T15:00:22Z")

</div>

using TimeSeriesClustering data\_path=normpath(joinpath(dirname(@\_\_FILE\_\_),"..","数据","测试数据.csv")) #ts\_input\_data = load\_timeseries\_data(data\_path;region="none", T=24, years=\[2016\]) ts\_input\_data = load\_timeseries\_data(dat…

---

## [Versioning of documentation fails](https://discourse.julialang.org/t/versioning-of-documentation-fails/42795)

<div class="topic-metadata">

**Author:** [@lgo](https://discourse.julialang.org/u/lgo)\
**Replies:** 4\
**Last updated:** [July 11, 2020, 12:27pm UTC](https://discourse.julialang.org/t/versioning-of-documentation-fails/42795 "2020-07-11T12:27:04Z")

</div>

I’m trying to achieve versioning for my documentation created with documenter. I’ve set the devbranch = "dev" in the deploydocs function, but use the defaults apart from that. Yet still, in the documenation the dropdown …

---

## [Extract neighbors from first shell of Voronoi tesselation](https://discourse.julialang.org/t/extract-neighbors-from-first-shell-of-voronoi-tesselation/42844)

<div class="topic-metadata">

**Author:** [@cheins](https://discourse.julialang.org/u/cheins)\
**Replies:** 3\
**Last updated:** [July 11, 2020, 10:03am UTC](https://discourse.julialang.org/t/extract-neighbors-from-first-shell-of-voronoi-tesselation/42844 "2020-07-11T10:03:59Z")

</div>

I’m assuming the best answer to this question requires using VoronoiDelaunay.jl, but I’m also open to other packages/approaches. If I have a set of points in 2D (or 3D? Though not I’m not sure this is possible with the …

---

## [Update fails when remote does not "negotiate mechanisms"](https://discourse.julialang.org/t/update-fails-when-remote-does-not-negotiate-mechanisms/42883)

<div class="topic-metadata">

**Author:** [@SocksNSandals](https://discourse.julialang.org/u/SocksNSandals)\
**Replies:** 0\
**Last updated:** [July 11, 2020, 2:43am UTC](https://discourse.julialang.org/t/update-fails-when-remote-does-not-negotiate-mechanisms/42883 "2020-07-11T02:43:00Z")

</div>

I attempted to do a \]update on a private julia repo and got the following error: (mypackage) pkg\> update Updating registry at \`~/.julia/registries/General\` Updating git-repo \`https://github.com/JuliaRegistries/Gen…

---

## [Loop for minimizing functions with a varying number of arguments](https://discourse.julialang.org/t/loop-for-minimizing-functions-with-a-varying-number-of-arguments/42816)

<div class="topic-metadata">

**Author:** [@sergevic](https://discourse.julialang.org/u/sergevic)\
**Replies:** 12\
**Last updated:** [July 11, 2020, 12:03am UTC](https://discourse.julialang.org/t/loop-for-minimizing-functions-with-a-varying-number-of-arguments/42816 "2020-07-11T00:03:56Z")

</div>

I have to build a loop where each iteration consists in building a function to minimize. At each iteration, the number of arguments is variable. To start, I have two matrices: X=rand(150,100) Y=rand(150,1) At each ite…

---

## [Implementing a Kalman filter for a differential equation system](https://discourse.julialang.org/t/implementing-a-kalman-filter-for-a-differential-equation-system/42879)

<div class="topic-metadata">

**Author:** [@affans](https://discourse.julialang.org/u/affans)\
**Replies:** 0\
**Last updated:** [July 10, 2020, 11:02pm UTC](https://discourse.julialang.org/t/implementing-a-kalman-filter-for-a-differential-equation-system/42879 "2020-07-10T23:02:39Z")

</div>

I am trying to implement a very simple Kalman Filter for learning purposes. I am following the example here (example 2, page 5). I will summarize it here with a MWE so no need to really go to the PDF. Consider the follo…

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

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