# General Usage

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

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

**Page:** 718

---

## [What is faster, abs(x) or x^2?](https://discourse.julialang.org/t/what-is-faster-abs-x-or-x-2/42547)

<div class="topic-metadata">

**Author:** [@azadoroz](https://discourse.julialang.org/u/azadoroz)\
**Replies:** 15\
**Last updated:** [August 7, 2020, 12:56am UTC](https://discourse.julialang.org/t/what-is-faster-abs-x-or-x-2/42547 "2020-08-07T00:56:48Z")

</div>

I need to compare many values to one. What would be faster: Option A: for i = 1 : N if abs(arr\[i\]) \> someValue doSomething(i); end end Option B: someValueSquared = someValue^2; for i = 1 : N if…

---

## [How do I forcefully upgrade a package to its latest version?](https://discourse.julialang.org/t/how-do-i-forcefully-upgrade-a-package-to-its-latest-version/44446)

<div class="topic-metadata">

**Author:** [@NightMachinary](https://discourse.julialang.org/u/NightMachinary)\
**Replies:** 1\
**Last updated:** [August 6, 2020, 7:19pm UTC](https://discourse.julialang.org/t/how-do-i-forcefully-upgrade-a-package-to-its-latest-version/44446 "2020-08-06T19:19:38Z")

</div>

Some packages have malfunctional requirements and set explicit, fixed versions for critical packages, e.g., setting LanguageServer to 2.0.1. How can I forcefully ignore these requirements, and install the latest version…

---

## [How to break apart a UnitRange?](https://discourse.julialang.org/t/how-to-break-apart-a-unitrange/44415)

<div class="topic-metadata">

**Author:** [@HelgavonLichtenstein](https://discourse.julialang.org/u/HelgavonLichtenstein)\
**Replies:** 11\
**Last updated:** [August 6, 2020, 6:55pm UTC](https://discourse.julialang.org/t/how-to-break-apart-a-unitrange/44415 "2020-08-06T18:55:16Z")

</div>

How would one break apart a UnitRange? From this example I’d like to create a Vector or Array that has 1,2,3,4,5,6 etc. in it, instead of 1:2, 3:4, 5:6 searching = DataFrame(A = 1:5:1000) searching\_specific = searching\[…

---

## [Reshape() still allocating memory in Julia 1.5.0](https://discourse.julialang.org/t/reshape-still-allocating-memory-in-julia-1-5-0/44437)

<div class="topic-metadata">

**Author:** [@benwcs](https://discourse.julialang.org/u/benwcs)\
**Replies:** 2\
**Last updated:** [August 6, 2020, 5:49pm UTC](https://discourse.julialang.org/t/reshape-still-allocating-memory-in-julia-1-5-0/44437 "2020-08-06T17:49:55Z")

</div>

It is great to see views no longer allocate memory in Julia 1.5.0! This we be very helpful for a project I am currenlty working on. However, it seems that calls to reshape still do, unless I use the @uviews macro supplie…

---

## [How would I remove a column from a dataframe by distributing its values among existing columns?](https://discourse.julialang.org/t/how-would-i-remove-a-column-from-a-dataframe-by-distributing-its-values-among-existing-columns/44265)

<div class="topic-metadata">

**Author:** [@Julia1](https://discourse.julialang.org/u/Julia1)\
**Replies:** 4\
**Last updated:** [August 6, 2020, 5:02pm UTC](https://discourse.julialang.org/t/how-would-i-remove-a-column-from-a-dataframe-by-distributing-its-values-among-existing-columns/44265 "2020-08-06T17:02:05Z")

</div>

Hi how’s it going? I have a situation where I’m keeping counts of certain visits, and in some scenarios the person visits multiple places during one trip. However, I can’t have this as part of my data, and need it to be…

---

## [Disjoint sets](https://discourse.julialang.org/t/disjoint-sets/44419)

<div class="topic-metadata">

**Author:** [@omar](https://discourse.julialang.org/u/omar)\
**Replies:** 2\
**Last updated:** [August 6, 2020, 4:59pm UTC](https://discourse.julialang.org/t/disjoint-sets/44419 "2020-08-06T16:59:58Z")

</div>

I tried using Disjoint sets but encountered an error “ERROR: LoadError: UndefVarError: IntDisjointSets not defined”. I’m using julia version 1.4.1 and my code was simply just: U = IntDisjointSets(10) println(U)

---

## [Julia Lang and VLSI design](https://discourse.julialang.org/t/julia-lang-and-vlsi-design/44356)

<div class="topic-metadata">

**Author:** [@Vrucoder](https://discourse.julialang.org/u/Vrucoder)\
**Replies:** 4\
**Last updated:** [August 6, 2020, 3:21pm UTC](https://discourse.julialang.org/t/julia-lang-and-vlsi-design/44356 "2020-08-06T15:21:12Z")

</div>

It is known from various articles on internet that Julia lang has better speed and efficiency. Can it be used in place of C++/SystemC in the VLSI design fields?

---

## [Deploying Julia on Heroku - Buildpacks and PackageCompiler Failing](https://discourse.julialang.org/t/deploying-julia-on-heroku-buildpacks-and-packagecompiler-failing/44043)

<div class="topic-metadata">

**Author:** [@markhalonen](https://discourse.julialang.org/u/markhalonen)\
**Replies:** 3\
**Last updated:** [August 6, 2020, 2:02pm UTC](https://discourse.julialang.org/t/deploying-julia-on-heroku-buildpacks-and-packagecompiler-failing/44043 "2020-08-06T14:02:42Z")

</div>

I’m trying to deploy this Julia HTTP api that simulates a coil gun using DiffEQ: https://github.com/laurium-labs/coilgunui It’s just a couple endpoints to get params and run the simulation. I’d like it to run through HT…

---

## [Using multiple dispatch with parametric constructors produces ambiguous call](https://discourse.julialang.org/t/using-multiple-dispatch-with-parametric-constructors-produces-ambiguous-call/44295)

<div class="topic-metadata">

**Author:** [@anon37204545](https://discourse.julialang.org/u/anon37204545)\
**Replies:** 8\
**Last updated:** [August 6, 2020, 1:54pm UTC](https://discourse.julialang.org/t/using-multiple-dispatch-with-parametric-constructors-produces-ambiguous-call/44295 "2020-08-06T13:54:26Z")

</div>

This code const CompoundTuple{T} = Tuple{Compound{T}, T} struct ChemEquation{T\<:Number} tuples::Vector{CompoundTuple{T}} end ChemEquation(tuples::Vector{CompoundTuple{T}}) where T = ChemEquation{T}(tuples) ChemEqu…

---

## [Splitpath and joinpath should be reversible](https://discourse.julialang.org/t/splitpath-and-joinpath-should-be-reversible/44379)

<div class="topic-metadata">

**Author:** [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Replies:** 6\
**Last updated:** [August 6, 2020, 1:54pm UTC](https://discourse.julialang.org/t/splitpath-and-joinpath-should-be-reversible/44379 "2020-08-06T13:54:15Z")

</div>

Well, maybe “reversible” is not quite the right word. I was suprised this doesn’t work. julia\> x=splitpath(raw"c:\\foo\\bar\\baz") 4-element Array{String,1}: "c:\\\\" "foo" "bar" "baz" julia\> joinpath(x) ERROR: MethodE…

---

## [Declaring a variable whose value cannot be changed](https://discourse.julialang.org/t/declaring-a-variable-whose-value-cannot-be-changed/44372)

<div class="topic-metadata">

**Author:** [@Haolun\_Li](https://discourse.julialang.org/u/Haolun_Li)\
**Replies:** 2\
**Last updated:** [August 6, 2020, 1:31pm UTC](https://discourse.julialang.org/t/declaring-a-variable-whose-value-cannot-be-changed/44372 "2020-08-06T13:31:45Z")

</div>

const x=1 then variable x’s value can be changed if a variable of the same type is reassigned. Is it possible to declare a variable so its value will NOT be changed by any assignment?

---

## [Which approach for matrix of road journey times (i.e. routing-based distances)?](https://discourse.julialang.org/t/which-approach-for-matrix-of-road-journey-times-i-e-routing-based-distances/44407)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 1\
**Last updated:** [August 6, 2020, 11:43am UTC](https://discourse.julialang.org/t/which-approach-for-matrix-of-road-journey-times-i-e-routing-based-distances/44407 "2020-08-06T11:43:27Z")

</div>

I need to get a matrix of road journey times by geographical coordinate pairs. I have colleagues that are using for this the R package osrm that in turn use the demo public server of project osrm, where they run their m…

---

## [Windows Chocolatey package manager has v1.5.0](https://discourse.julialang.org/t/windows-chocolatey-package-manager-has-v1-5-0/44410)

<div class="topic-metadata">

**Author:** [@johnh](https://discourse.julialang.org/u/johnh)\
**Replies:** 0\
**Last updated:** [August 6, 2020, 10:10am UTC](https://discourse.julialang.org/t/windows-chocolatey-package-manager-has-v1-5-0/44410 "2020-08-06T10:10:35Z")

</div>

I have recently been using the Chocolatey package manager for Windows and woudl recommend it to everyone. A big thanks to whoever maintains Julia here - v1.5.0 is already available.

---

## [Question about EMDSetting](https://discourse.julialang.org/t/question-about-emdsetting/44385)

<div class="topic-metadata">

**Author:** [@abcde](https://discourse.julialang.org/u/abcde)\
**Replies:** 1\
**Last updated:** [August 6, 2020, 7:15am UTC](https://discourse.julialang.org/t/question-about-emdsetting/44385 "2020-08-06T07:15:58Z")

</div>

using EmpiricalModeDecomposition a=convert(Vector{Float64},rand(20)) s= EMD\_heping\_1MX\_V\_35kV1=EmpiricalModeDecomposition.hht(a,s) This is my code,I don’t know how the keyword S should be defined, this is the code in th…

---

## [Question about Types](https://discourse.julialang.org/t/question-about-types/44386)

<div class="topic-metadata">

**Author:** [@abcde](https://discourse.julialang.org/u/abcde)\
**Replies:** 9\
**Last updated:** [August 6, 2020, 4:22am UTC](https://discourse.julialang.org/t/question-about-types/44386 "2020-08-06T04:22:19Z")

</div>

a=convert(Vector{Float64},rand(20)) In Workplace it is of type Vector, but in REPL it is of type Array. Why is that?Thank you very much!

---

## [Calling MATLAB function from Julia using the run() command](https://discourse.julialang.org/t/calling-matlab-function-from-julia-using-the-run-command/44299)

<div class="topic-metadata">

**Author:** [@josimar](https://discourse.julialang.org/u/josimar)\
**Replies:** 5\
**Last updated:** [August 6, 2020, 12:38am UTC](https://discourse.julialang.org/t/calling-matlab-function-from-julia-using-the-run-command/44299 "2020-08-06T00:38:29Z")

</div>

I am trying to call a MATLAB function from Julia but I am getting the error below. There is something wrong with the way that I am setting up the quotes. In the context of my problem below, I don’t know how to interpret…

---

## [Method naming conflicts even if method signature does not?](https://discourse.julialang.org/t/method-naming-conflicts-even-if-method-signature-does-not/44350)

<div class="topic-metadata">

**Author:** [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Replies:** 5\
**Last updated:** [August 5, 2020, 10:32pm UTC](https://discourse.julialang.org/t/method-naming-conflicts-even-if-method-signature-does-not/44350 "2020-08-05T22:32:33Z")

</div>

I have a simple question: If I export a function like weights(m::MyType) = m.weights from my package, why do I get things like WARNING: both MyPackage and StatsBase export "weights"; uses of it in module Main must be qu…

---

## [Order dependence of calls to isa through Cassette](https://discourse.julialang.org/t/order-dependence-of-calls-to-isa-through-cassette/44259)

<div class="topic-metadata">

**Author:** [@ckfinite](https://discourse.julialang.org/u/ckfinite)\
**Replies:** 1\
**Last updated:** [August 5, 2020, 10:07pm UTC](https://discourse.julialang.org/t/order-dependence-of-calls-to-isa-through-cassette/44259 "2020-08-05T22:07:59Z")

</div>

I’m having a bit of a weird problem with Cassette when trying to overdub isa , as the result appears to change based on the sequence of calls despite no explicit state being shared between the calls. The example using C…

---

## [Expand matrix from n x n to n+1 x n+1](https://discourse.julialang.org/t/expand-matrix-from-n-x-n-to-n-1-x-n-1/44365)

<div class="topic-metadata">

**Author:** [@mleprovost](https://discourse.julialang.org/u/mleprovost)\
**Replies:** 2\
**Last updated:** [August 5, 2020, 9:26pm UTC](https://discourse.julialang.org/t/expand-matrix-from-n-x-n-to-n-1-x-n-1/44365 "2020-08-05T21:26:25Z")

</div>

Hello, Is there a convenient function to augment in-place a matrix A from n \\times n to n+1 \\times n+1. We can always do A = hcat(vcat(A, zeros(1, size(A,1))), zeros(size(A,1)+1,1))

---

## [Detecting crosses in grids](https://discourse.julialang.org/t/detecting-crosses-in-grids/6720)

<div class="topic-metadata">

**Author:** [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Replies:** 53\
**Last updated:** [August 5, 2020, 9:03pm UTC](https://discourse.julialang.org/t/detecting-crosses-in-grids/6720 "2020-08-05T21:03:49Z")

</div>

Hi all, Thought I’d ask for some image analysis advice: I want to detect the cross points in images of a grid (marked a couple of these in red, just as an example): (a clean and full resolution of this image is avai…

---

## [Strange inconsistent in complex algebra](https://discourse.julialang.org/t/strange-inconsistent-in-complex-algebra/36851)

<div class="topic-metadata">

**Author:** [@gangchern](https://discourse.julialang.org/u/gangchern)\
**Replies:** 46\
**Last updated:** [August 5, 2020, 8:50pm UTC](https://discourse.julialang.org/t/strange-inconsistent-in-complex-algebra/36851 "2020-08-05T20:50:39Z")

</div>

The following code generate different result 1 Complex((-0.5) \* 0.5^2)^(-0.2) 2. ((-0.5) \* Complex(0.5)^2)^(-0.2) I run the code in Julia 1.1, the results are as following I thinks the point is how to define (…

---

## [Docs.julialang.org in Chrome cert revoked](https://discourse.julialang.org/t/docs-julialang-org-in-chrome-cert-revoked/44322)

<div class="topic-metadata">

**Author:** [@oheil](https://discourse.julialang.org/u/oheil)\
**Replies:** 2\
**Last updated:** [August 5, 2020, 6:43pm UTC](https://discourse.julialang.org/t/docs-julialang-org-in-chrome-cert-revoked/44322 "2020-08-05T18:43:32Z")

</div>

I currently can’t open docs.julialang.org in Chrome (latest version): It doesn’t happen in Firefox. Anybody else has this problem?

---

## [How to create a neural network using ReverseDiff.jl?](https://discourse.julialang.org/t/how-to-create-a-neural-network-using-reversediff-jl/44360)

<div class="topic-metadata">

**Author:** [@DeepQ](https://discourse.julialang.org/u/DeepQ)\
**Replies:** 0\
**Last updated:** [August 5, 2020, 6:24pm UTC](https://discourse.julialang.org/t/how-to-create-a-neural-network-using-reversediff-jl/44360 "2020-08-05T18:24:01Z")

</div>

I want to create a neural network using ReverseDiff.jl. Is it simple?

---

## [Issues when ODE solver and interpolations.jl are used together or something else perhaps?](https://discourse.julialang.org/t/issues-when-ode-solver-and-interpolations-jl-are-used-together-or-something-else-perhaps/44348)

<div class="topic-metadata">

**Author:** [@cbasile21](https://discourse.julialang.org/u/cbasile21)\
**Replies:** 4\
**Last updated:** [August 5, 2020, 4:27pm UTC](https://discourse.julialang.org/t/issues-when-ode-solver-and-interpolations-jl-are-used-together-or-something-else-perhaps/44348 "2020-08-05T16:27:37Z")

</div>

There was an unexpected behavior I noticed when using ode solver and itp that I would appreciate your help. I am sharing a problem where u\[1\] can be a assign to a value like 3000 , where the final solution was the value…

---

## [Adding more data to a JLD2 file](https://discourse.julialang.org/t/adding-more-data-to-a-jld2-file/44323)

<div class="topic-metadata">

**Author:** [@HelgavonLichtenstein](https://discourse.julialang.org/u/HelgavonLichtenstein)\
**Replies:** 5\
**Last updated:** [August 5, 2020, 3:51pm UTC](https://discourse.julialang.org/t/adding-more-data-to-a-jld2-file/44323 "2020-08-05T15:51:59Z")

</div>

I’m slow with these things, but I cannot get a JLD2 file to open and save new information. Using the instructions here jldopen("example.jld2", "w") do file file\["bigdata"\] end Is file supposed to be the name of t…

---

## [Speeding up force calculations and mutable structs](https://discourse.julialang.org/t/speeding-up-force-calculations-and-mutable-structs/44228)

<div class="topic-metadata">

**Author:** [@Michael\_Wang](https://discourse.julialang.org/u/Michael_Wang)\
**Replies:** 20\
**Last updated:** [August 5, 2020, 3:45pm UTC](https://discourse.julialang.org/t/speeding-up-force-calculations-and-mutable-structs/44228 "2020-08-05T15:45:07Z")

</div>

I put together a simple package to simulate many interacting Brownian particles. I’m trying to speed up the force calculation (for Lennard-Jones). Below is the force calculation using cell lists to find neighbors. The…

---

## [Zygote: Mutating arrays is not supported](https://discourse.julialang.org/t/zygote-mutating-arrays-is-not-supported/44309)

<div class="topic-metadata">

**Author:** [@DeepQ](https://discourse.julialang.org/u/DeepQ)\
**Replies:** 3\
**Last updated:** [August 5, 2020, 3:42pm UTC](https://discourse.julialang.org/t/zygote-mutating-arrays-is-not-supported/44309 "2020-08-05T15:42:15Z")

</div>

I am trying to calculate the laplacian of a neural network using Flux library. My code is: using Flux using Zygote model = Chain(Dense(2,5,sigmoid), Dense(5,1)) function laplace(x) a, b = size(x) Δ = Zygote.Bu…

---

## [Question about the data analysis](https://discourse.julialang.org/t/question-about-the-data-analysis/44345)

<div class="topic-metadata">

**Author:** [@abcde](https://discourse.julialang.org/u/abcde)\
**Replies:** 0\
**Last updated:** [August 5, 2020, 3:34pm UTC](https://discourse.julialang.org/t/question-about-the-data-analysis/44345 "2020-08-05T15:34:33Z")

</div>

I’m working on power system forecasting, and time series analysis is an indispensable part of it.Is there any Pkg in Julia that can be used for time series feature extraction?For example, the existing EMD(Empirical Mode …

---

## [Question about EMD](https://discourse.julialang.org/t/question-about-emd/44336)

<div class="topic-metadata">

**Author:** [@abcde](https://discourse.julialang.org/u/abcde)\
**Replies:** 2\
**Last updated:** [August 5, 2020, 3:32pm UTC](https://discourse.julialang.org/t/question-about-emd/44336 "2020-08-05T15:32:25Z")

</div>

May I ask which time series data can be processed in Julia’s Pkg?Like EMD(Mode Decomposition).The Pkg on Github is no longer available :persevere: thanks!

---

## [Question about Timeseries](https://discourse.julialang.org/t/question-about-timeseries/44235)

<div class="topic-metadata">

**Author:** [@abcde](https://discourse.julialang.org/u/abcde)\
**Replies:** 2\
**Last updated:** [August 5, 2020, 2:12pm UTC](https://discourse.julialang.org/t/question-about-timeseries/44235 "2020-08-05T14:12:20Z")

</div>

using CSV,Clustering,Statistics,DataFrames,TimeSeries,MarketData readtimearray("E:\\\\测试数据\\\\汇总15min.csv"; delim=',', meta=nothing, format="") This is the statement on the official website. Why does the program repor…

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

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