# General Usage

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

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

**Page:** 610

---

## [LinearAlgebra.SingularException(9) while running radial basis function from Surrogates using multiquadric radial](https://discourse.julialang.org/t/linearalgebra-singularexception-9-while-running-radial-basis-function-from-surrogates-using-multiquadric-radial/59774)

<div class="topic-metadata">

**Author:** [@mdsa3d](https://discourse.julialang.org/u/mdsa3d)\
**Replies:** 3\
**Last updated:** [April 22, 2021, 5:41am UTC](https://discourse.julialang.org/t/linearalgebra-singularexception-9-while-running-radial-basis-function-from-surrogates-using-multiquadric-radial/59774 "2021-04-22T05:41:24Z")

</div>

I am trying to run the Radial basis from Surrogates to perform interpolation with multiquadricRadial. I have created the following script: using Surrogates using Plots; plotly() lb = \[0.0, 0.0\] ub = \[10.0, 10.0\] func…

---

## [How Can I Create Permanently-Stored Lookup Tables?](https://discourse.julialang.org/t/how-can-i-create-permanently-stored-lookup-tables/59755)

<div class="topic-metadata">

**Author:** [@RalphH](https://discourse.julialang.org/u/RalphH)\
**Replies:** 11\
**Last updated:** [April 22, 2021, 4:35am UTC](https://discourse.julialang.org/t/how-can-i-create-permanently-stored-lookup-tables/59755 "2021-04-22T04:35:03Z")

</div>

Hello, everyone. How can I store computed values permanently, i.e. so they never have to be recomputed? Specifically, I have generated 2 lookup tables via lengthy Monte Carlo simulations and stored them in CSV files. I …

---

## [Is there an interface to Mathematica through wolframescript?](https://discourse.julialang.org/t/is-there-an-interface-to-mathematica-through-wolframescript/35727)

<div class="topic-metadata">

**Author:** [@gangchern](https://discourse.julialang.org/u/gangchern)\
**Replies:** 22\
**Last updated:** [April 21, 2021, 11:16pm UTC](https://discourse.julialang.org/t/is-there-an-interface-to-mathematica-through-wolframescript/35727 "2021-04-21T23:16:26Z")

</div>

It should working as: input from julia , transform to Mathematica input , call run command: wolframescript some input . read the mathematica output and transform to julia output form So that I can use the mathematica…

---

## [Solving ODEs in a loop with DifferentialEquations.jl](https://discourse.julialang.org/t/solving-odes-in-a-loop-with-differentialequations-jl/59640)

<div class="topic-metadata">

**Author:** [@lucass-carneiro](https://discourse.julialang.org/u/lucass-carneiro)\
**Replies:** 10\
**Last updated:** [April 21, 2021, 7:54pm UTC](https://discourse.julialang.org/t/solving-odes-in-a-loop-with-differentialequations-jl/59640 "2021-04-21T19:54:04Z")

</div>

Hi there! I’m working on a problem where I must solve a system of ODEs repeatedly with different parameters and initial conditions. In particular, I’m not really interested in the solution as a whole, I only need to kno…

---

## [Get left hand side of SymPy equations](https://discourse.julialang.org/t/get-left-hand-side-of-sympy-equations/59694)

<div class="topic-metadata">

**Author:** [@fms-1988](https://discourse.julialang.org/u/fms-1988)\
**Replies:** 5\
**Last updated:** [April 21, 2021, 7:45pm UTC](https://discourse.julialang.org/t/get-left-hand-side-of-sympy-equations/59694 "2021-04-21T19:45:07Z")

</div>

I have a vector of equations: using SymPy θ,ω,dθ,dω,b,c = symbols("θ,ω,\\\\dot{θ},\\\\dot{ω},b,c") f1 = Eq(dθ,ω) f2 = Eq(dω,-b\*ω - c\* sin(θ)) eqns = \[f1;f2\] out: \\left\[ \\begin{array}{c} \\dot{θ} = ω \\\\ \\dot{ω} = -b\*ω - c\*…

---

## [Preallocating large matrices in all cores is slower than allocating every time](https://discourse.julialang.org/t/preallocating-large-matrices-in-all-cores-is-slower-than-allocating-every-time/59261)

<div class="topic-metadata">

**Author:** [@kaslusimoes](https://discourse.julialang.org/u/kaslusimoes)\
**Replies:** 7\
**Last updated:** [April 21, 2021, 7:28pm UTC](https://discourse.julialang.org/t/preallocating-large-matrices-in-all-cores-is-slower-than-allocating-every-time/59261 "2021-04-21T19:28:55Z")

</div>

Hi everyone, I am trying to improve a piece of code of mine (numerical simulations for a scientific research project) to scale it up. It essentially involves running one computationally and memory heavy function for se…

---

## [How to use ChainRules to tell Zygote about a more specialized rule?](https://discourse.julialang.org/t/how-to-use-chainrules-to-tell-zygote-about-a-more-specialized-rule/59721)

<div class="topic-metadata">

**Author:** [@bgctw](https://discourse.julialang.org/u/bgctw)\
**Replies:** 2\
**Last updated:** [April 21, 2021, 6:59pm UTC](https://discourse.julialang.org/t/how-to-use-chainrules-to-tell-zygote-about-a-more-specialized-rule/59721 "2021-04-21T18:59:23Z")

</div>

I am trying to optimize an ODE problem specified with ModelingToolkit. The objective function indexes into the ODESolution by a symbol. There is a Zygote adjoint for getindex(::VectorOfArray, i), and VectorOfArray is an …

---

## [Script package unable to run julia](https://discourse.julialang.org/t/script-package-unable-to-run-julia/59751)

<div class="topic-metadata">

**Author:** [@Ethan\_Gouveia](https://discourse.julialang.org/u/Ethan_Gouveia)\
**Replies:** 0\
**Last updated:** [April 21, 2021, 6:44pm UTC](https://discourse.julialang.org/t/script-package-unable-to-run-julia/59751 "2021-04-21T18:44:23Z")

</div>

When I try to run a .jl file with ctrl+shift+B an error occurs. Julia is in my PATH, and I can launch it from the terminal by typing “julia”, so not sure why I cant execute the file. What can I do to make the Script pack…

---

## [Performance optimisation: Julia vs C++](https://discourse.julialang.org/t/performance-optimisation-julia-vs-c/59689)

<div class="topic-metadata">

**Author:** [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Replies:** 31\
**Last updated:** [April 21, 2021, 2:55pm UTC](https://discourse.julialang.org/t/performance-optimisation-julia-vs-c/59689 "2021-04-21T14:55:24Z")

</div>

Hi all! This is for the performance tweaking addicts out there :smiley: I had a conversation with a “C++ friend” today in which upon request I tried to showcase to him that Julia can be as performant as C++ (say, withi…

---

## [Type stability with tuples is hard](https://discourse.julialang.org/t/type-stability-with-tuples-is-hard/59094)

<div class="topic-metadata">

**Author:** [@mroavi](https://discourse.julialang.org/u/mroavi)\
**Replies:** 23\
**Last updated:** [April 21, 2021, 1:39pm UTC](https://discourse.julialang.org/t/type-stability-with-tuples-is-hard/59094 "2021-04-21T13:39:51Z")

</div>

I came across this article that talks about loop fusion. I saw this as a great opportunity to optimize my code since a lot of intermediate allocations are happening in my program. After having adapted my code, the perfor…

---

## [Bars in plot do not fully extend to x axis](https://discourse.julialang.org/t/bars-in-plot-do-not-fully-extend-to-x-axis/59735)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 1\
**Last updated:** [April 21, 2021, 1:32pm UTC](https://discourse.julialang.org/t/bars-in-plot-do-not-fully-extend-to-x-axis/59735 "2021-04-21T13:32:53Z")

</div>

I recently received the following warning in Plots: ┌ Warning: Indices Base.OneTo(3) of attribute \`seriescolor\` does not match data indices 1:17. └ @ Plots /home/dfish/.julia/packages/Plots/SVksJ/src/utils.jl:102 ┌ Info…

---

## [Is it possible to work with eval(:(x=10)) without touching a global/modules scope](https://discourse.julialang.org/t/is-it-possible-to-work-with-eval-x-10-without-touching-a-global-modules-scope/59729)

<div class="topic-metadata">

**Author:** [@SteffenPL](https://discourse.julialang.org/u/SteffenPL)\
**Replies:** 3\
**Last updated:** [April 21, 2021, 1:04pm UTC](https://discourse.julialang.org/t/is-it-possible-to-work-with-eval-x-10-without-touching-a-global-modules-scope/59729 "2021-04-21T13:04:28Z")

</div>

Hi, is there a way to make this code work without messing up the global namespace? x = 10 function f() eval(:(local x = 20)) return eval(:x) end f() @assert f() == 20 @assert x == 10 This is a minimal example for…

---

## [Unable to add packages: ERROR malformed URL ''](https://discourse.julialang.org/t/unable-to-add-packages-error-malformed-url/59732)

<div class="topic-metadata">

**Author:** [@kobusherbst](https://discourse.julialang.org/u/kobusherbst)\
**Replies:** 0\
**Last updated:** [April 21, 2021, 12:58pm UTC](https://discourse.julialang.org/t/unable-to-add-packages-error-malformed-url/59732 "2021-04-21T12:58:07Z")

</div>

I am unable to add packages on a Windows 10 virtual machine with domain authentication. I get the following error for any package I try to add. \> (@v1.6) pkg\> add https://github.com/JuliaData/DataFrames.jl \> Clonin…

---

## [Compact way to store Diagonal static matrices?](https://discourse.julialang.org/t/compact-way-to-store-diagonal-static-matrices/59715)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 2\
**Last updated:** [April 21, 2021, 8:00am UTC](https://discourse.julialang.org/t/compact-way-to-store-diagonal-static-matrices/59715 "2021-04-21T08:00:34Z")

</div>

I want to store a large number of Diagonal 3x3 matrices. I am considering using a HybridArray whose individual elements are these 3x3 matrices. In my case I know that the matrices are Diagonal. I’m not sure which of thes…

---

## [Creating new dataframe column!](https://discourse.julialang.org/t/creating-new-dataframe-column/59711)

<div class="topic-metadata">

**Author:** [@mdsa3d](https://discourse.julialang.org/u/mdsa3d)\
**Replies:** 3\
**Last updated:** [April 21, 2021, 6:13am UTC](https://discourse.julialang.org/t/creating-new-dataframe-column/59711 "2021-04-21T06:13:36Z")

</div>

I am trying to create a new column for a dataframe, such that it appends values only when the columns from the other dataframe have similar values. For example: using DataFrames, Statistics a = \["1.0"; "2.0"; "2.0"; "4…

---

## [Function definition hook?](https://discourse.julialang.org/t/function-definition-hook/59709)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 2\
**Last updated:** [April 21, 2021, 5:54am UTC](https://discourse.julialang.org/t/function-definition-hook/59709 "2021-04-21T05:54:22Z")

</div>

Is it possible to hook into function definition? Whenever a new function or method is defined I want to do something with the new function.

---

## [Turing.jl: prior on quantiles](https://discourse.julialang.org/t/turing-jl-prior-on-quantiles/59510)

<div class="topic-metadata">

**Author:** [@jdossgollin](https://discourse.julialang.org/u/jdossgollin)\
**Replies:** 4\
**Last updated:** [April 21, 2021, 2:27am UTC](https://discourse.julialang.org/t/turing-jl-prior-on-quantiles/59510 "2021-04-21T02:27:58Z")

</div>

I’d like to develop a model with prior on quantiles of the outcome, rather than on the parameters themselves. This is pretty commonly used in expert elicitation contexts. However, when I try to implement this model, I’m …

---

## [Makie arrow through transparent mesh](https://discourse.julialang.org/t/makie-arrow-through-transparent-mesh/59666)

<div class="topic-metadata">

**Author:** [@sijo](https://discourse.julialang.org/u/sijo)\
**Replies:** 1\
**Last updated:** [April 20, 2021, 10:59pm UTC](https://discourse.julialang.org/t/makie-arrow-through-transparent-mesh/59666 "2021-04-20T22:59:37Z")

</div>

How can I draw arrows through semi-transparent objects with Makie? I can’t get the line to show properly through the transparent surface. Here’s a minimal example: using GLMakie scene = Scene(resolution = (800, 600), …

---

## [Generated Tuples of Functions](https://discourse.julialang.org/t/generated-tuples-of-functions/59499)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 3\
**Last updated:** [April 20, 2021, 10:20pm UTC](https://discourse.julialang.org/t/generated-tuples-of-functions/59499 "2021-04-20T22:20:11Z")

</div>

Continuing the discussion from Performance and allocation issue with arrays of functions (v1.5): I want to modify the question I originally posed above, to the case that the collection of functions on which I wish to ev…

---

## [Convert/parse a VersionNumber into a struct or similar](https://discourse.julialang.org/t/convert-parse-a-versionnumber-into-a-struct-or-similar/59692)

<div class="topic-metadata">

**Author:** [@Eben60](https://discourse.julialang.org/u/Eben60)\
**Replies:** 2\
**Last updated:** [April 20, 2021, 9:35pm UTC](https://discourse.julialang.org/t/convert-parse-a-versionnumber-into-a-struct-or-similar/59692 "2021-04-20T21:35:01Z")

</div>

Is there a function for that purpose? Sure it is not difficult to write for v"1.6.0", and not that difficult for "v"1.7.0-dev.100", but probably already done (many times).

---

## [Understanding allocations when collapsing function arugments](https://discourse.julialang.org/t/understanding-allocations-when-collapsing-function-arugments/59668)

<div class="topic-metadata">

**Author:** [@bashonubuntu](https://discourse.julialang.org/u/bashonubuntu)\
**Replies:** 15\
**Last updated:** [April 20, 2021, 7:24pm UTC](https://discourse.julialang.org/t/understanding-allocations-when-collapsing-function-arugments/59668 "2021-04-20T19:24:25Z")

</div>

Hi everyone, I was hoping I could be helped in understanding the following concept. The code is a bit too long to provide a clean MWE, but I am trying to understanding the following: julia\> @btime integrand\_B1\_new($y,$…

---

## [Not sure to understand how matrices are displayed](https://discourse.julialang.org/t/not-sure-to-understand-how-matrices-are-displayed/59371)

<div class="topic-metadata">

**Author:** [@Lecrapouille](https://discourse.julialang.org/u/Lecrapouille)\
**Replies:** 8\
**Last updated:** [April 20, 2021, 6:57pm UTC](https://discourse.julialang.org/t/not-sure-to-understand-how-matrices-are-displayed/59371 "2021-04-20T18:57:08Z")

</div>

Hi ! At least, since Julia 1.3, still now with Julia 1.6 I did not know how to fix misaligned simple matrices. julia\> A=\[45 "m" 6; 4.5 5 't'\] 2×3 Matrix{Any}: 45 "m" 6 4.5 5 't' This is an issue for my p…

---

## [Custom hash function in dict is very slow?](https://discourse.julialang.org/t/custom-hash-function-in-dict-is-very-slow/59683)

<div class="topic-metadata">

**Author:** [@pjentsch0](https://discourse.julialang.org/u/pjentsch0)\
**Replies:** 3\
**Last updated:** [April 20, 2021, 6:44pm UTC](https://discourse.julialang.org/t/custom-hash-function-in-dict-is-very-slow/59683 "2021-04-20T18:44:57Z")

</div>

why is using a custom hash function in a dict so slow? using BenchmarkTools import Base.hash,Base.isequal rtuple() = (trunc(Int,rand()\*10\_000),trunc(Int,rand()\*10\_000)) #make random tuple in \[0,10\_000) function Base.ha…

---

## [How can I clear the REPL's scrollback buffer?](https://discourse.julialang.org/t/how-can-i-clear-the-repls-scrollback-buffer/45049)

<div class="topic-metadata">

**Author:** [@NightMachinary](https://discourse.julialang.org/u/NightMachinary)\
**Replies:** 6\
**Last updated:** [April 20, 2021, 5:06pm UTC](https://discourse.julialang.org/t/how-can-i-clear-the-repls-scrollback-buffer/45049 "2021-04-20T17:06:50Z")

</div>

I like to clear the REPL’s scrollback buffer programmatically. This helps me when running functions with long outputs, as I can easily use the scrollbar to jump to anywhere in the logs created by that function. Using CTR…

---

## [Performance closures with changing value of closed over variables](https://discourse.julialang.org/t/performance-closures-with-changing-value-of-closed-over-variables/59671)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 1\
**Last updated:** [April 20, 2021, 4:58pm UTC](https://discourse.julialang.org/t/performance-closures-with-changing-value-of-closed-over-variables/59671 "2021-04-20T16:58:36Z")

</div>

Similar things have been discussed in other threads, but this particular example was surprising to me: julia\> function main(x) g(x,y) = x + y f(x,inner\_g) = inner\_g(x) y = 1 f(x, x -\> …

---

## [Libnetcdf not defined](https://discourse.julialang.org/t/libnetcdf-not-defined/59039)

<div class="topic-metadata">

**Author:** [@mixstam1453](https://discourse.julialang.org/u/mixstam1453)\
**Replies:** 6\
**Last updated:** [April 20, 2021, 4:45pm UTC](https://discourse.julialang.org/t/libnetcdf-not-defined/59039 "2021-04-20T16:45:52Z")

</div>

Hello everybody, I get “libnetcdf not defined” when i try to open a ncfile, using NCDatasets & NetCDF. I use Debian Buster, 32 bit. Julia 1.5.3. Have you any idea to solve it ? I already did this " using Pkg pkg"ad…

---

## [Cannot load image and do fftshift inside the same function](https://discourse.julialang.org/t/cannot-load-image-and-do-fftshift-inside-the-same-function/59663)

<div class="topic-metadata">

**Author:** [@alberttxu](https://discourse.julialang.org/u/alberttxu)\
**Replies:** 2\
**Last updated:** [April 20, 2021, 4:12pm UTC](https://discourse.julialang.org/t/cannot-load-image-and-do-fftshift-inside-the-same-function/59663 "2021-04-20T16:12:56Z")

</div>

Hi all, I encountered an error while trying to load an image and run an fftshift inside a function. My minimal working example is using TestImages, FFTW function f() img = testimage("mandrill") fftshift(img) e…

---

## [What would it take to bring this Julia 0.6 package to Julia 1.6?](https://discourse.julialang.org/t/what-would-it-take-to-bring-this-julia-0-6-package-to-julia-1-6/59652)

<div class="topic-metadata">

**Author:** [@lrnv](https://discourse.julialang.org/u/lrnv)\
**Replies:** 31\
**Last updated:** [April 20, 2021, 3:52pm UTC](https://discourse.julialang.org/t/what-would-it-take-to-bring-this-julia-0-6-package-to-julia-1-6/59652 "2021-04-20T15:52:19Z")

</div>

Hi, I found myself in a position where i need to solve a fully constraint lasso. There is a package there : GitHub - Hua-Zhou/ConstrainedLasso.jl: Algorithms for fit constrained lasso that does exactly what i need, but …

---

## [How to create a multilayer perceptron using Flux](https://discourse.julialang.org/t/how-to-create-a-multilayer-perceptron-using-flux/59673)

<div class="topic-metadata">

**Author:** [@Antonino\_Gandolfo](https://discourse.julialang.org/u/Antonino_Gandolfo)\
**Replies:** 0\
**Last updated:** [April 20, 2021, 3:27pm UTC](https://discourse.julialang.org/t/how-to-create-a-multilayer-perceptron-using-flux/59673 "2021-04-20T15:27:23Z")

</div>

Hi I’m new with Julia and I have some problems with the creation of a multilayer perceptron. I’ve tried following some guides about this topic but I couldn’t figure it out the solution. My question is: How can i add a…

---

## [Concatenate Generators](https://discourse.julialang.org/t/concatenate-generators/59653)

<div class="topic-metadata">

**Author:** [@etienne\_dg](https://discourse.julialang.org/u/etienne_dg)\
**Replies:** 18\
**Last updated:** [April 20, 2021, 3:01pm UTC](https://discourse.julialang.org/t/concatenate-generators/59653 "2021-04-20T15:01:00Z")

</div>

Hi, I try to initialize a vector in two parts, for example, a vector with fifty 0’s then fifty 1’s. I can create it in a loop, but it is not very concise: function foo1() a = Array{Int64}(undef, 100) for i in …

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

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