# General Usage

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

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

**Page:** 594

---

## [How do method definitions work inside functions?](https://discourse.julialang.org/t/how-do-method-definitions-work-inside-functions/62055)

<div class="topic-metadata">

**Author:** [@matthias314](https://discourse.julialang.org/u/matthias314)\
**Replies:** 2\
**Last updated:** [May 30, 2021, 4:07pm UTC](https://discourse.julialang.org/t/how-do-method-definitions-work-inside-functions/62055 "2021-05-30T16:07:46Z")

</div>

I’m trying to understand how method definitions work inside functions. (Is this mentioned anywhere in the documentation?) From this post I learned that all method definitions for a given local function f are combined to …

---

## [Plots.jl series with only errorbars?](https://discourse.julialang.org/t/plots-jl-series-with-only-errorbars/62053)

<div class="topic-metadata">

**Author:** [@pdubya](https://discourse.julialang.org/u/pdubya)\
**Replies:** 2\
**Last updated:** [May 30, 2021, 1:06pm UTC](https://discourse.julialang.org/t/plots-jl-series-with-only-errorbars/62053 "2021-05-30T13:06:57Z")

</div>

Is it possible to make a plot with only error bars using Plots.jl? Alternatively, is it possible to style the errorbars independent of the associate :path or :scatter series? basically want x = collect(1:5); y = 5\*x; …

---

## [Julia fn clearer than C++/Fortran (examples sought)](https://discourse.julialang.org/t/julia-fn-clearer-than-c-fortran-examples-sought/50739)

<div class="topic-metadata">

**Author:** [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)\
**Replies:** 38\
**Last updated:** [May 30, 2021, 11:20am UTC](https://discourse.julialang.org/t/julia-fn-clearer-than-c-fortran-examples-sought/50739 "2021-05-30T11:20:47Z")

</div>

As part of an explanation of Julia’s import in facilitating & speeding the process of bringing someone on into an ongoing larger project and getting them up to speed, I am looking for examples of the same function writt…

---

## [Default constructor does not show up from methodswith](https://discourse.julialang.org/t/default-constructor-does-not-show-up-from-methodswith/62064)

<div class="topic-metadata">

**Author:** [@endremborza](https://discourse.julialang.org/u/endremborza)\
**Replies:** 2\
**Last updated:** [May 30, 2021, 10:17am UTC](https://discourse.julialang.org/t/default-constructor-does-not-show-up-from-methodswith/62064 "2021-05-30T10:17:50Z")

</div>

can’t really describe it in more detail than what is in the title, here is an example: struct A end struct B a::A end println("finds constructor with A param:") B |\> methods |\> println println("does not findconstr…

---

## [Convert an Array Written as a String to An Actual Array](https://discourse.julialang.org/t/convert-an-array-written-as-a-string-to-an-actual-array/62013)

<div class="topic-metadata">

**Author:** [@TheCedarPrince](https://discourse.julialang.org/u/TheCedarPrince)\
**Replies:** 7\
**Last updated:** [May 30, 2021, 8:33am UTC](https://discourse.julialang.org/t/convert-an-array-written-as-a-string-to-an-actual-array/62013 "2021-05-30T08:33:06Z")

</div>

Hi all, I have no idea how this happened, but I am using a dataset where in the file, arrays were actually stored as strings like this: "\[1, 2, 3, 4, 5\]" How do I best convert the above into an actual array of integer…

---

## [Reverse UnitRange](https://discourse.julialang.org/t/reverse-unitrange/62038)

<div class="topic-metadata">

**Author:** [@minetest2048](https://discourse.julialang.org/u/minetest2048)\
**Replies:** 3\
**Last updated:** [May 30, 2021, 7:52am UTC](https://discourse.julialang.org/t/reverse-unitrange/62038 "2021-05-30T07:52:11Z")

</div>

I’m trying to implement SystemVerilog style bit indexing/slicing operator: a = 0b11100 b\[4:2\] == 0b111 But I realize that the colon operator doesn’t work when the second index is lower than the first index: julia\> dum…

---

## [Looking for advice on achieving faster startup times](https://discourse.julialang.org/t/looking-for-advice-on-achieving-faster-startup-times/61160)

<div class="topic-metadata">

**Author:** [@enriquer](https://discourse.julialang.org/u/enriquer)\
**Replies:** 11\
**Last updated:** [May 30, 2021, 7:25am UTC](https://discourse.julialang.org/t/looking-for-advice-on-achieving-faster-startup-times/61160 "2021-05-30T07:25:45Z")

</div>

(reposting from a Julia+ARM thread because this is not really ARM specific) I am testing the feasibility of using Julia for an embedded Linux platform. Our current target hardware has a Cortex-A7 based SOC which can run…

---

## [DifferentialEquations can solve backward?](https://discourse.julialang.org/t/differentialequations-can-solve-backward/62072)

<div class="topic-metadata">

**Author:** [@cpraveen](https://discourse.julialang.org/u/cpraveen)\
**Replies:** 1\
**Last updated:** [May 30, 2021, 6:48am UTC](https://discourse.julialang.org/t/differentialequations-can-solve-backward/62072 "2021-05-30T06:48:10Z")

</div>

Using DifferentialEquations, I am solving a simple first order ODE backwards which should work, right ? But the solver fails. I can solve this using my own forward Euler scheme without any problem. Note that the interva…

---

## [PackageCompiler with R](https://discourse.julialang.org/t/packagecompiler-with-r/62069)

<div class="topic-metadata">

**Author:** [@ParadaCarleton](https://discourse.julialang.org/u/ParadaCarleton)\
**Replies:** 1\
**Last updated:** [May 30, 2021, 2:13am UTC](https://discourse.julialang.org/t/packagecompiler-with-r/62069 "2021-05-30T02:13:24Z")

</div>

I’m interested in reimplementing some R code in Julia to speed it up, then making it a package on CRAN. Is there a way to use PackageCompiler together with JuliaCall to create an R package that uses Julia without requiri…

---

## [Simple addition using Transducers via single-threaded foldl , multi-threaded foldxt always calculates two (slightly) different answers](https://discourse.julialang.org/t/simple-addition-using-transducers-via-single-threaded-foldl-multi-threaded-foldxt-always-calculates-two-slightly-different-answers/62024)

<div class="topic-metadata">

**Author:** [@Marc.Cox](https://discourse.julialang.org/u/Marc.Cox)\
**Replies:** 4\
**Last updated:** [May 29, 2021, 10:29pm UTC](https://discourse.julialang.org/t/simple-addition-using-transducers-via-single-threaded-foldl-multi-threaded-foldxt-always-calculates-two-slightly-different-answers/62024 "2021-05-29T22:29:21Z")

</div>

Simple addition using Transducers via single-threaded foldl , multi-threaded foldxt calculates two (slightly) different answers . IOW Is the single-threaded foldl , multi-threaded foldxt, or None of them correct ? Some…

---

## [How resolve compatibility with InteractiveDynamics package?](https://discourse.julialang.org/t/how-resolve-compatibility-with-interactivedynamics-package/62014)

<div class="topic-metadata">

**Author:** [@murrayE](https://discourse.julialang.org/u/murrayE)\
**Replies:** 6\
**Last updated:** [May 29, 2021, 6:56pm UTC](https://discourse.julialang.org/t/how-resolve-compatibility-with-interactivedynamics-package/62014 "2021-05-29T18:56:11Z")

</div>

I’m a new Julia programmer and want to use the InteractiveDynamics package. But when I try to add it, I get the following error report. How can I resolve this? @v1.6) pkg\> add InteractiveDynamics Resolving package ve…

---

## [How to create a DataFrame from 1×24×24 Array{Float64, 3}](https://discourse.julialang.org/t/how-to-create-a-dataframe-from-1x24x24-array-float64-3/62041)

<div class="topic-metadata">

**Author:** [@VivMendes](https://discourse.julialang.org/u/VivMendes)\
**Replies:** 4\
**Last updated:** [May 29, 2021, 4:53pm UTC](https://discourse.julialang.org/t/how-to-create-a-dataframe-from-1x24x24-array-float64-3/62041 "2021-05-29T16:53:25Z")

</div>

Hi. I have a matrix named “cycles” which is a 72×24 Matrix{Float64}. I want to obtain a cross-correlation matrix associated with its 24 columns. No problem with this: Cross\_Corr\_matrix = crosscor(cycles\[:,:\],cycles\[:,:\]…

---

## [Possible performance drop when using more than one socket threads](https://discourse.julialang.org/t/possible-performance-drop-when-using-more-than-one-socket-threads/62022)

<div class="topic-metadata">

**Author:** [@shipengcheng1230](https://discourse.julialang.org/u/shipengcheng1230)\
**Replies:** 2\
**Last updated:** [May 29, 2021, 4:50pm UTC](https://discourse.julialang.org/t/possible-performance-drop-when-using-more-than-one-socket-threads/62022 "2021-05-29T16:50:51Z")

</div>

Hello, this is originally raised in an issue. I hope posting here would bring more attention. Some dummy code for solving ODE: # Julia 1.6.1 using FFTW, BenchmarkTools, LinearAlgebra, Printf, Polyester, Random println…

---

## [How use Systems.henonheiles from InteractiveDynamics](https://discourse.julialang.org/t/how-use-systems-henonheiles-from-interactivedynamics/62042)

<div class="topic-metadata">

**Author:** [@murrayE](https://discourse.julialang.org/u/murrayE)\
**Replies:** 0\
**Last updated:** [May 29, 2021, 3:23pm UTC](https://discourse.julialang.org/t/how-use-systems-henonheiles-from-interactivedynamics/62042 "2021-05-29T15:23:49Z")

</div>

I’m trying to duplicate the first example of trajectory evolution in the docs for the InteractiveDynamcis package (https://juliadynamics.github.io/InteractiveDynamics.jl/dev/trajectory/). I’ve already created an environ…

---

## [Behaviour of Symbolics.solve\_for](https://discourse.julialang.org/t/behaviour-of-symbolics-solve-for/62019)

<div class="topic-metadata">

**Author:** [@EvoArt](https://discourse.julialang.org/u/EvoArt)\
**Replies:** 4\
**Last updated:** [May 29, 2021, 3:07pm UTC](https://discourse.julialang.org/t/behaviour-of-symbolics-solve-for/62019 "2021-05-29T15:07:21Z")

</div>

I’ve just started using Symbolics, and I really like it. However, I’m not sure about the output from solve\_for using Symbolics @variables p x y eq = x \*p + y \* (1 - p) ~0 Symbolics.solve\_for(eq,p) returns (p\*y + y\*(1 …

---

## [Automatically activating project on remote workers](https://discourse.julialang.org/t/automatically-activating-project-on-remote-workers/62034)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 1\
**Last updated:** [May 29, 2021, 8:27am UTC](https://discourse.julialang.org/t/automatically-activating-project-on-remote-workers/62034 "2021-05-29T08:27:03Z")

</div>

Starting Julia with multiple workers and an active project currently only activates the environment on the master process. Does it not make more sense to activate the project on all workers? jishnu:OffsetArrays.jl/ $ ju…

---

## [WebIO – simple examples?](https://discourse.julialang.org/t/webio-simple-examples/62028)

<div class="topic-metadata">

**Author:** [@baptnz](https://discourse.julialang.org/u/baptnz)\
**Replies:** 0\
**Last updated:** [May 29, 2021, 1:07am UTC](https://discourse.julialang.org/t/webio-simple-examples/62028 "2021-05-29T01:07:37Z")

</div>

I’m hoping to display a simple Three.js visual in the plot panel of Juno; unfortunately the working examples I’ve found are either too basic (displaying pure html tags), or too complicated (plotly, with full interactivit…

---

## [Finding disk space on windows](https://discourse.julialang.org/t/finding-disk-space-on-windows/62004)

<div class="topic-metadata">

**Author:** [@Jake](https://discourse.julialang.org/u/Jake)\
**Replies:** 2\
**Last updated:** [May 28, 2021, 10:35pm UTC](https://discourse.julialang.org/t/finding-disk-space-on-windows/62004 "2021-05-28T22:35:55Z")

</div>

I am trying to obtain the total disk capacity and the amount of free disk space on a Windows 10 machine. I don’t see any Julia command that will do this so I thought that a Windows command would give me the required inf…

---

## [What's the most efficient way to sum the results of multithreading?](https://discourse.julialang.org/t/whats-the-most-efficient-way-to-sum-the-results-of-multithreading/61944)

<div class="topic-metadata">

**Author:** [@yingqiuz](https://discourse.julialang.org/u/yingqiuz)\
**Replies:** 3\
**Last updated:** [May 28, 2021, 10:23pm UTC](https://discourse.julialang.org/t/whats-the-most-efficient-way-to-sum-the-results-of-multithreading/61944 "2021-05-28T22:23:53Z")

</div>

Hi, I need to sum the outputs of each thread. Is there a standard/efficient way to do this? for example: X = Matrix{Float64}(d, N) Threads.@threads for k = 1:N X\[:, k\] .= some\_calculations() end sum!(ones(Int64, d…

---

## [Massive data-dependent floating-point slowdown](https://discourse.julialang.org/t/massive-data-dependent-floating-point-slowdown/62017)

<div class="topic-metadata">

**Author:** [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Replies:** 3\
**Last updated:** [May 28, 2021, 9:36pm UTC](https://discourse.julialang.org/t/massive-data-dependent-floating-point-slowdown/62017 "2021-05-28T21:36:17Z")

</div>

I encountered a mysterious case where the same floating-point computation experiences a massive slowdown depending on the data — a factor of 20, or even 60 if I use @turbo from LoopVectorization.jl. I’m guessing it has …

---

## [Why isn't string replace variadic?](https://discourse.julialang.org/t/why-isnt-string-replace-variadic/62020)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 1\
**Last updated:** [May 28, 2021, 9:09pm UTC](https://discourse.julialang.org/t/why-isnt-string-replace-variadic/62020 "2021-05-28T21:09:51Z")

</div>

replace(s::AbstractString, pat=\>r; \[count::Integer\]) https://docs.julialang.org/en/v1/base/strings/#Base.replace-Tuple{AbstractString,%20Pair} If I want to make two replacements in one pass I have to use regex? It seem…

---

## [Properly implement Base.hash() for custom type](https://discourse.julialang.org/t/properly-implement-base-hash-for-custom-type/61951)

<div class="topic-metadata">

**Author:** [@anon60034542](https://discourse.julialang.org/u/anon60034542)\
**Replies:** 11\
**Last updated:** [May 28, 2021, 7:32pm UTC](https://discourse.julialang.org/t/properly-implement-base-hash-for-custom-type/61951 "2021-05-28T19:32:35Z")

</div>

Consider the following code: @enum WeaponType CloseRange Reloadable struct GameWeapon damage::Int32 type::WeaponType end Reading the documentation, it says: New types should implement the 2-argument form, ty…

---

## [Generalizing the inputs of the nlsolve function in Julia](https://discourse.julialang.org/t/generalizing-the-inputs-of-the-nlsolve-function-in-julia/62012)

<div class="topic-metadata">

**Author:** [@maoc](https://discourse.julialang.org/u/maoc)\
**Replies:** 0\
**Last updated:** [May 28, 2021, 7:32pm UTC](https://discourse.julialang.org/t/generalizing-the-inputs-of-the-nlsolve-function-in-julia/62012 "2021-05-28T19:32:08Z")

</div>

After an extensive process usyng the SymPy in Julia, I generated a system of nonlinear equations. My system is allocated in a matrix NxS. Something like this(NN = 2, S = 2). I would like to adapt the system to use th…

---

## [How to avoid memory allocation when having long expression](https://discourse.julialang.org/t/how-to-avoid-memory-allocation-when-having-long-expression/61998)

<div class="topic-metadata">

**Author:** [@JianghuiDu](https://discourse.julialang.org/u/JianghuiDu)\
**Replies:** 16\
**Last updated:** [May 28, 2021, 6:08pm UTC](https://discourse.julialang.org/t/how-to-avoid-memory-allocation-when-having-long-expression/61998 "2021-05-28T18:08:52Z")

</div>

const ⊕ = + const ⊗ = \* @. dTA\_dH += -KH2PO4 ⊗ KH3PO4 ⊗ TH3PO4 ⊗ (2 ⊗ H^3 ⊕ H^2 ⊗ KH3PO4 - KH2PO4 ⊗ KH3PO4 ⊗ KHPO4) / (H^3 ⊕ H^2 ⊗ KH3PO4 ⊕ H ⊗ KH2PO4 ⊗ KH3PO4 ⊕ KH2PO4 ⊗ KH3PO4 ⊗ KHPO4)^2 A…

---

## [Small, fixed powers](https://discourse.julialang.org/t/small-fixed-powers/61991)

<div class="topic-metadata">

**Author:** [@scheinerman](https://discourse.julialang.org/u/scheinerman)\
**Replies:** 5\
**Last updated:** [May 28, 2021, 2:41pm UTC](https://discourse.julialang.org/t/small-fixed-powers/61991 "2021-05-28T14:41:32Z")

</div>

Consider these two functions for computing the 4-th power: power4(x) = x^4 power31(x) = x \* x^3 The second is much speedier than the first because (looking at code\_llvm or code\_native) the first calls a general helper …

---

## [Cos() allocates and is slow in fastmath?](https://discourse.julialang.org/t/cos-allocates-and-is-slow-in-fastmath/61990)

<div class="topic-metadata">

**Author:** [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Replies:** 3\
**Last updated:** [May 28, 2021, 1:37pm UTC](https://discourse.julialang.org/t/cos-allocates-and-is-slow-in-fastmath/61990 "2021-05-28T13:37:22Z")

</div>

in v1.6.1, when --math-mode=fast: julia\> @btime cos($1.2); 217.234 ns (8 allocations: 576 bytes) julia\> @btime sin($1.2); 175.154 ns (6 allocations: 544 bytes) julia\> @btime tan($1.2); 188.837 ns (6 allocations: 5…

---

## [Does texw format still work in Weave.jl?](https://discourse.julialang.org/t/does-texw-format-still-work-in-weave-jl/61986)

<div class="topic-metadata">

**Author:** [@Minimum-Pollution-96](https://discourse.julialang.org/u/Minimum-Pollution-96)\
**Replies:** 0\
**Last updated:** [May 28, 2021, 12:40pm UTC](https://discourse.julialang.org/t/does-texw-format-still-work-in-weave-jl/61986 "2021-05-28T12:40:58Z")

</div>

I wanted to create a LaTeX document and tried using Weave.jl. But, the examples given there are broken (see: https://github.com/JunoLab/Weave.jl/issues/412 ). I would like to know whether someone had worked using that re…

---

## [Override foo{x}](https://discourse.julialang.org/t/override-foo-x/61969)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 4\
**Last updated:** [May 28, 2021, 5:37am UTC](https://discourse.julialang.org/t/override-foo-x/61969 "2021-05-28T05:37:40Z")

</div>

Is it possible to customize what happens when I do foo{x} for a particular type Foo or type X?

---

## [Font & Tools to print Julia code listings?](https://discourse.julialang.org/t/font-tools-to-print-julia-code-listings/61934)

<div class="topic-metadata">

**Author:** [@Arrigo\_Benedetti](https://discourse.julialang.org/u/Arrigo_Benedetti)\
**Replies:** 5\
**Last updated:** [May 28, 2021, 4:14am UTC](https://discourse.julialang.org/t/font-tools-to-print-julia-code-listings/61934 "2021-05-28T04:14:59Z")

</div>

I have been struggling for a long time trying to find a way to print Julia code listing where Unicode characters are properly rendered. I have been using enscript for many years to print C++ code, however it does not sup…

---

## [Fortran calling Julia. Julia 10x slower than Fortran](https://discourse.julialang.org/t/fortran-calling-julia-julia-10x-slower-than-fortran/61736)

<div class="topic-metadata">

**Author:** [@eduardovrs](https://discourse.julialang.org/u/eduardovrs)\
**Replies:** 15\
**Last updated:** [May 27, 2021, 7:11pm UTC](https://discourse.julialang.org/t/fortran-calling-julia-julia-10x-slower-than-fortran/61736 "2021-05-27T19:11:26Z")

</div>

Fortran calling Julia. Julia 10x slower than Fortran Dear Julia community, I am a beginner programmer and I enjoyed learning and coding in Julia a lot. I have been working on a Julia interface for Finite Element Analys…

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

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